From 3d070728b5df53d7911e0fd5624116bce7c71717 Mon Sep 17 00:00:00 2001 From: YuanYifei Date: Wed, 26 Oct 2016 19:05:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=BC=8F=E6=96=97=E5=9B=BEto?= =?UTF-8?q?oltip=E6=B2=A1=E6=9C=89=E7=99=BE=E5=88=86=E6=AF=94=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chart/funnel/FunnelSeries.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/chart/funnel/FunnelSeries.js b/src/chart/funnel/FunnelSeries.js index 0d7c540635..f493bee4b3 100644 --- a/src/chart/funnel/FunnelSeries.js +++ b/src/chart/funnel/FunnelSeries.js @@ -41,7 +41,19 @@ define(function(require) { labelLineEmphasisOpt.show = labelLineEmphasisOpt.show && option.label.emphasis.show; }, + + // Overwrite + getDataParams: function (dataIndex) { + var data = this._data; + var params = FunnelSeries.superCall(this, 'getDataParams', dataIndex); + var sum = data.getSum('value'); + // Percent is 0 if sum is 0 + params.percent = !sum ? 0 : +(data.get('value', dataIndex) / sum * 100).toFixed(2); + params.$vars.push('percent'); + return params; + }, + defaultOption: { zlevel: 0, // 一级层叠 z: 2, // 二级层叠 @@ -98,4 +110,4 @@ define(function(require) { }); return FunnelSeries; -}); \ No newline at end of file +});