From 20eb3b52209e118b257b754bc39687f31ed53327 Mon Sep 17 00:00:00 2001 From: lang Date: Thu, 30 Oct 2014 16:25:21 +0800 Subject: [PATCH] =?UTF-8?q?force=20=E5=8A=A0=E5=85=A5=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/example/force.html | 9 ++++++--- doc/example/force1.html | 2 +- src/chart/force.js | 19 ++++++++----------- src/config.js | 8 +++++--- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/doc/example/force.html b/doc/example/force.html index 9b9fe062b8..274303ee3c 100644 --- a/doc/example/force.html +++ b/doc/example/force.html @@ -110,17 +110,20 @@ linkSymbol: 'arrow', steps: 10, coolDown: 0.9, - preventOverlap: true, + //preventOverlap: true, nodes:[ { category:0, name: '乔布斯', value : 10, - symbol: 'image://http://www.cnii.com.cn/hg/zt/2012315zt/content/attachement/jpg/site2/20120217/00137274b1a410a8340f07.jpg', + symbol: 'image://http://www.damndigital.com/wp-content/uploads/2010/12/steve-jobs.jpg', symbolSize: 30, draggable: true, itemStyle: { normal: { label: { - show: false + position: 'right', + textStyle: { + color: 'black' + } } } } diff --git a/doc/example/force1.html b/doc/example/force1.html index 7c4721b338..42e93fbf20 100644 --- a/doc/example/force1.html +++ b/doc/example/force1.html @@ -63,7 +63,7 @@ }, series : [ { - type:'chord', + type:'force', name : "人物关系", categories : [ { diff --git a/src/chart/force.js b/src/chart/force.js index daed5d56c9..d84cc8ddb5 100644 --- a/src/chart/force.js +++ b/src/chart/force.js @@ -427,26 +427,23 @@ define(function (require) { // 节点标签样式 if (this.deepQuery(queryTarget, 'itemStyle.normal.label.show')) { shape.style.text = node.data.name; - shape.style.textPosition = 'inside'; var labelStyle = this.deepQuery( - queryTarget, 'itemStyle.normal.label.textStyle' + queryTarget, 'itemStyle.normal.label' ) || {}; - shape.style.textColor = labelStyle.color || '#fff'; - shape.style.textAlign = labelStyle.align || 'center'; - shape.style.textBaseline = labelStyle.baseline || 'middle'; - shape.style.textFont = this.getFont(labelStyle); + var textStyle = labelStyle.textStyle || {}; + shape.style.textPosition = labelStyle.position; + shape.style.textColor = textStyle.color || '#fff'; + shape.style.textFont = this.getFont(textStyle); } if (this.deepQuery(queryTarget, 'itemStyle.emphasis.label.show')) { shape.highlightStyle.text = node.data.name; - shape.highlightStyle.textPosition = 'inside'; var labelStyle = this.deepQuery( queryTarget, 'itemStyle.emphasis.label.textStyle' ) || {}; - shape.highlightStyle.textColor = labelStyle.color || '#fff'; - shape.highlightStyle.textAlign = labelStyle.align || 'center'; - shape.highlightStyle.textBaseline = labelStyle.baseline || 'middle'; - shape.highlightStyle.textFont = this.getFont(labelStyle); + shape.highlightStyle.textPosition = labelStyle.position; + shape.highlightStyle.textColor = textStyle.color || '#fff'; + shape.highlightStyle.textFont = this.getFont(textStyle); } // 拖拽特性 diff --git a/src/config.js b/src/config.js index 0ae1a51c94..2b46a0735d 100644 --- a/src/config.js +++ b/src/config.js @@ -734,7 +734,7 @@ define(function() { borderWidth: 1, label: { show: true, - position: 'outer' + position: 'inside' // formatter: 标签文本格式器,同Tooltip.formatter,不支持回调 // textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE }, @@ -877,7 +877,8 @@ define(function() { normal: { // color: 各异, label: { - show: false + show: false, + position: 'inside' // textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE }, nodeStyle: { @@ -886,7 +887,8 @@ define(function() { }, linkStyle: { color: '#5182ab', - width: 1 + width: 1, + type: 'line' } }, emphasis: {