tbedp / datavjs Goto Github PK
View Code? Open in Web Editor NEWDataV
Home Page: http://datavlab.org/datavjs/
License: Other
DataV
Home Page: http://datavlab.org/datavjs/
License: Other
deps.js与jquery.form插件冲突,执行jquery.form中的ajaxform或ajaxsubmit时在deps中总是会报no method [ajaxform]或[ajaxsubmit]。
看看chord的文字偏移问题
上海地图的原南汇合并到浦东新区,卢湾区合并到黄浦区,因此
datavjs/lib/charts/data/chinaMap/31.json文件需要更新
chord.js line 114:
for (i = 0; i <= this.groupNum; i++) {
应该改为
for (i = 0; i < this.groupNum; i++) {
否则图例里会有undefined出现,example里面没有出现是因为图例框超出了当前可见区域。
源码地址:https://github.com/TBEDP/datavjs/blob/master/lib/charts/force.js
Force.prototype.setSource = function (table, map) {
map = this.map(map);
//this.net = json;
if (table[0][0] === "node") {
table = table.slice(1);
}
var nData = [];
var lData = [];
var isNode = true;
var nodeNum;
var that = this;
table.forEach(function (d, i) {
var value;
if (isNode) {
if (d[map.nodeId] === "link") {
isNode = false;
nodeNum = i + 1;
} else {
if (d[map.nodeId] === "") {
throw new Error("ID can not be empty(line:" + (i + 1) + ").");
}
value = that._toNum(d[map.nodeValue]);
nData[i] = {
name: d[map.nodeName],
nodeValue: value
};
if (i === 0) {
that.nodeValueMin = value;
that.nodeValueMax = value;
}
that.nodeValueMin = (value < that.nodeValueMin) ? value : that.nodeValueMin;
that.nodeValueMax = (value > that.nodeValueMax) ? value : that.nodeValueMax;
}
} else {
if (d[map.linkSource - 3] === "") {
throw new Error("Source can not be empty(line:" + (i + 1) + ").");
}
if (d[map.linkTarget - 3] === "") {
throw new Error("Target can not be empty(line:" + (i + 1) + ").");
}
value = that._toNum(d[map.linkValue - 3]);
lData[i - nodeNum] = {
source: that._toNum(d[map.linkSource - 3]),
target: that._toNum(d[map.linkTarget - 3]),
value: that._toNum(d[map.linkValue - 3])
};
if (i === nodeNum) {
that.linkValueMin = value;
that.linkValueMax = value;
}
that.linkValueMin = (value < that.linkValueMin) ? value : that.linkValueMin;
that.linkValueMax = (value > that.linkValueMax) ? value : that.linkValueMax;
}
});
this.net.nodes = nData;
this.net.links = lData;
this.nodeValueMax++;
this.linkValueMax++;
};
这段代码中设置link的source和target的时候,应该根据数据的id来索引
lData[i - nodeNum] = {
source: that._toNum(d[map.linkSource - 3]),
target: that._toNum(d[map.linkTarget - 3]),
value: that._toNum(d[map.linkValue - 3])
};
fixed后的代码如下:
Force.prototype.setSource = function (table, map) {
map = this.map(map);
//this.net = json;
if (table[0][0] === "node") {
table = table.slice(1);
}
var nData = [],
lData = [],
isNode = true,
nodeNum,
that = this,
NUM = 3,
// FIXED: 用数据的id索引nodes
index = {},
source = map.linkSource - NUM,
target = map.linkTarget - NUM,
lValue = map.linkValue - NUM;
table.forEach(function (d, i) {
var value;
if (isNode) {
if (d[map.nodeId] === "link") {
isNode = false;
nodeNum = i + 1;
} else {
if (d[map.nodeId] === "") {
throw new Error("ID can not be empty(line:" + (i + 1) + ").");
}
value = +(d[map.nodeValue]);
nData[i] = {
name: d[map.nodeName],
nodeValue: value
};
if (i === 0) {
that.nodeValueMin = value;
that.nodeValueMax = value;
}
that.nodeValueMin = (value < that.nodeValueMin) ? value : that.nodeValueMin;
that.nodeValueMax = (value > that.nodeValueMax) ? value : that.nodeValueMax;
}
} else {
if (d[map.linkSource - 3] === "") {
throw new Error("Source can not be empty(line:" + (i + 1) + ").");
}
if (d[map.linkTarget - 3] === "") {
throw new Error("Target can not be empty(line:" + (i + 1) + ").");
}
value = +(d[map.linkValue - 3]);
// FIXED: 用数据的id索引nodes
index[d[map.id]] = i;
lData[i - nodeNum] = {
source: +(index[d[source]]),
target: +(index[d[target]]),
value: +(index[d[lValue]])
};
if (i === nodeNum) {
that.linkValueMin = value;
that.linkValueMax = value;
}
that.linkValueMin = (value < that.linkValueMin) ? value : that.linkValueMin;
that.linkValueMax = (value > that.linkValueMax) ? value : that.linkValueMax;
}
});
this.net.nodes = nData;
this.net.links = lData;
this.nodeValueMax++;
this.linkValueMax++;
};
源码地址:https://github.com/TBEDP/datavjs/blob/master/lib/charts/force.js
Force.prototype.setSource = function (table, map) {
map = this.map(map);
//this.net = json;
if (table[0][0] === "node") {
table = table.slice(1);
}
var nData = [];
var lData = [];
var isNode = true;
var nodeNum;
var that = this;
table.forEach(function (d, i) {
var value;
if (isNode) {
if (d[map.nodeId] === "link") {
isNode = false;
nodeNum = i + 1;
} else {
if (d[map.nodeId] === "") {
throw new Error("ID can not be empty(line:" + (i + 1) + ").");
}
value = that._toNum(d[map.nodeValue]);
nData[i] = {
name: d[map.nodeName],
nodeValue: value
};
if (i === 0) {
that.nodeValueMin = value;
that.nodeValueMax = value;
}
that.nodeValueMin = (value < that.nodeValueMin) ? value : that.nodeValueMin;
that.nodeValueMax = (value > that.nodeValueMax) ? value : that.nodeValueMax;
}
} else {
if (d[map.linkSource - 3] === "") {
throw new Error("Source can not be empty(line:" + (i + 1) + ").");
}
if (d[map.linkTarget - 3] === "") {
throw new Error("Target can not be empty(line:" + (i + 1) + ").");
}
value = that._toNum(d[map.linkValue - 3]);
lData[i - nodeNum] = {
source: that._toNum(d[map.linkSource - 3]),
target: that._toNum(d[map.linkTarget - 3]),
value: that._toNum(d[map.linkValue - 3])
};
if (i === nodeNum) {
that.linkValueMin = value;
that.linkValueMax = value;
}
that.linkValueMin = (value < that.linkValueMin) ? value : that.linkValueMin;
that.linkValueMax = (value > that.linkValueMax) ? value : that.linkValueMax;
}
});
this.net.nodes = nData;
this.net.links = lData;
this.nodeValueMax++;
this.linkValueMax++;
};
这段代码中设置link的source和target的时候,应该根据数据的id来索引
lData[i - nodeNum] = {
source: that._toNum(d[map.linkSource - 3]),
target: that._toNum(d[map.linkTarget - 3]),
value: that._toNum(d[map.linkValue - 3])
};
fixed后的代码如下:
Force.prototype.setSource = function (table, map) {
map = this.map(map);
//this.net = json;
if (table[0][0] === "node") {
table = table.slice(1);
}
var nData = [],
lData = [],
isNode = true,
nodeNum,
that = this,
NUM = 3,
// FIXED: 用数据的id索引nodes
index = {},
source = map.linkSource - NUM,
target = map.linkTarget - NUM,
lValue = map.linkValue - NUM;
table.forEach(function (d, i) {
var value;
if (isNode) {
if (d[map.nodeId] === "link") {
isNode = false;
nodeNum = i + 1;
} else {
if (d[map.nodeId] === "") {
throw new Error("ID can not be empty(line:" + (i + 1) + ").");
}
value = +(d[map.nodeValue]);
nData[i] = {
name: d[map.nodeName],
nodeValue: value
};
if (i === 0) {
that.nodeValueMin = value;
that.nodeValueMax = value;
}
that.nodeValueMin = (value < that.nodeValueMin) ? value : that.nodeValueMin;
that.nodeValueMax = (value > that.nodeValueMax) ? value : that.nodeValueMax;
}
} else {
if (d[map.linkSource - 3] === "") {
throw new Error("Source can not be empty(line:" + (i + 1) + ").");
}
if (d[map.linkTarget - 3] === "") {
throw new Error("Target can not be empty(line:" + (i + 1) + ").");
}
value = +(d[map.linkValue - 3]);
// FIXED: 用数据的id索引nodes
index[d[map.id]] = i;
lData[i - nodeNum] = {
source: +(index[d[source]]),
target: +(index[d[target]]),
value: +(index[d[lValue]])
};
if (i === nodeNum) {
that.linkValueMin = value;
that.linkValueMax = value;
}
that.linkValueMin = (value < that.linkValueMin) ? value : that.linkValueMin;
that.linkValueMax = (value > that.linkValueMax) ? value : that.linkValueMax;
}
});
this.net.nodes = nData;
this.net.links = lData;
this.nodeValueMax++;
this.linkValueMax++;
};
很久没看到更新了,是否几位老大在酝酿大版本?还是。。。
发现在像pie 和 bar 等经典图形中是有图例,而在line.js 中是没有的,pei 和 bar 都有 drawLegend 的方法,而在line.js 没有。是故意设计的吗?
Bubble 需要显示更多的信息 以及 json xml数据源的支持
Hi! This is the first time for me to construct a relation graph using Datavjs. I get a exception like "undefined is not a function " when I try to run my webpage with using {
var net = new DataV.Force("chart-relation",{"width": 700, "height": 500});
} to create my object. I have readed the "getting start.md" doc, but I just can't find the "compatible.js" in the master folder. Except that, I have included the all files needed. Now I get the exception related above. If you have any solution for this, please let me konw. Thanks advanced!
@theseue 宁朗看看这个图是谁开发的。补一下以上这些点。
您好:
关于force组件,能否提供点一个node,跟这个node有关的所有关系都显示出来,包括它二级、三级、四级。。。的关联关系?
期待您的回复
package.json 文件中没有指定模块uglify-js的版本号,这个模块的新版本2.x跟1.x的API不一样,运行 node bin/build.js 时如果加了压缩代码的选项会出错。
uglify-js 新版本压缩代码的例子:
var result = UglifyJS.minify("/path/to/file.js");
console.log(result.code); // minified output
// if you need to pass code instead of file name
var result = UglifyJS.minify("var b = function () {};", {fromString: true});
您好,代码中没有找到可视化地图的代码文件。就是类似于map.ipviking的黑客攻击的可视化地图。
最好存放在一个静态的变量上。不要存在实例上。因为实例可能会重复创建
RT,开放时间预计是多少呢?还是说会作为一个产品出售
帮你写了部分。需要补上剩余的
为什么不支持线图
请问为什么数据要用数组形式?为什么不用json?
很费解为什么选用数组的数据格式,请问可以支持json吗
@theseue 宁朗看看,补一下以上这些点。
datavjs/example/chinamap/chinamap_gradient_without_seajs.html
澳门没有显示
data-v 链接http://datav.jiaminghi.com/guide/
https://github.com/TBEDP/datavjs/blob/butterfly/example/force/DataExample.csv
查看了下,是csv的乱码导致的。
麻烦@theseue 宁朗fix一下。上传一份utf-8的数据
@theseue 宁朗看看这个图是谁开发的。补一下以上这些点。
A cload coder working at alibaba.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.