Skip to content

Commit

Permalink
修改样式..加入大小的控制
Browse files Browse the repository at this point in the history
  • Loading branch information
pissang committed Jul 1, 2013
1 parent 88adae6 commit 3a49701
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 44 deletions.
43 changes: 23 additions & 20 deletions doc/example/webkit-dep-pre.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion doc/example/webkit-dep.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@

myChart = ec.init(document.getElementById("Main"));
webkitDepData.minRadius = 5;
webkitDepData.density = 1;
webkitDepData.maxRadius = 8;
webkitDepData.density = 1.1;
webkitDepData.attractiveness = 1.1;
webkitDepData.itemStyle = {
normal : {
linkStyle : {
opacity : 0.2
}
}
}

myChart.setOption({
tooltip : {
trigger: 'item'
Expand Down
39 changes: 17 additions & 22 deletions doc/example/webkit-dep.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,45 @@ define({
{
"name": "HTMLElement",
"keyword": {},
"base": "HTMLElement",
"itemStyle": {
"normal": {
"brushType": "both",
"color": "#D0D102",
"strokeColor": "#5182ab",
"lineWidth": 2
"brushType": "fill",
"color": "#58b4c1"
}
}
},
{
"name": "WebGL",
"keyword": {},
"base": "WebGLRenderingContext",
"itemStyle": {
"normal": {
"brushType": "both",
"color": "#01A4A4",
"strokeColor": "#5182ab",
"brushType": "fill",
"color": "#4F57AA",
"lineWidth": 2
}
}
},
{
"name": "SVG",
"keyword": {},
"base": "SVGElement",
"itemStyle": {
"normal": {
"brushType": "both",
"color": "#00A1CB",
"strokeColor": "#5182ab",
"lineWidth": 2
"brushType": "fill",
"color": "#72818B"
}
}
},
{
"name": "CSS",
"keyword": {},
"base": "CSSRule",
"itemStyle": {
"normal": {
"brushType": "both",
"color": "#61AE24",
"strokeColor": "#5182ab",
"lineWidth": 2
"brushType": "fill",
"color": "#8F002E"
}
}
},
Expand All @@ -54,9 +51,7 @@ define({
"keyword": {},
"itemStyle": {
"normal": {
"brushType": "both",
"strokeColor": "#5182ab",
"lineWidth": 2
"brushType": "fill"
}
}
}
Expand Down Expand Up @@ -339,7 +334,7 @@ define({
},
{
"name": "CSSRule",
"value": 1,
"value": 3,
"category": 3
},
{
Expand Down Expand Up @@ -749,7 +744,7 @@ define({
},
{
"name": "HTMLElement",
"value": 1,
"value": 3,
"category": 0
},
{
Expand Down Expand Up @@ -1599,7 +1594,7 @@ define({
},
{
"name": "SVGElement",
"value": 1,
"value": 3,
"category": 2
},
{
Expand Down Expand Up @@ -2364,7 +2359,7 @@ define({
},
{
"name": "WebGLRenderingContext",
"value": 1,
"value": 3,
"category": 1
},
{
Expand Down
3 changes: 2 additions & 1 deletion src/chart/force.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ define(function(require) {
linkShapes = [];

var area = viewportWidth * viewportHeight;
var attractiveness = self.deepQuery([serie], 'attractiveness');
// Formula in 'Graph Drawing by Force-directed Placement'
k = 0.5 * Math.sqrt( area / nodesRawData.length );
k = 0.5 / attractiveness * Math.sqrt( area / nodesRawData.length );

// 这两方法里需要加上读取self.selectedMap判断当前系列是否显示的逻辑
_buildLinkShapes(nodesRawData, linksRawData);
Expand Down
1 change: 1 addition & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ define(function() {
minRadius : 10,
maxRadius : 20,
density : 1.0,
attractiveness : 1.0,
// 分类里如果有样式会覆盖节点默认样式
categories : [],
itemStyle: {
Expand Down

0 comments on commit 3a49701

Please sign in to comment.