未验证 提交 08bd44ae 编写于 作者: D Deqing Li 提交者: GitHub

Merge pull request #11752 from deqingli/sankey

fix formatter tooltip can't get value in sankey diagram #11459
......@@ -138,6 +138,17 @@ var SankeySeries = SeriesModel.extend({
}
},
// Override Series.getDataParams()
getDataParams: function (dataIndex, dataType) {
var params = SankeySeries.superCall(this, 'getDataParams', dataIndex, dataType);
if (params.value == null && dataType === 'node') {
var node = this.getGraph().getNodeByIndex(dataIndex);
var nodeValue = node.getLayout().value;
params.value = nodeValue;
}
return params;
},
defaultOption: {
zlevel: 0,
z: 2,
......
......@@ -180,7 +180,10 @@ under the License.
color: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'],
tooltip: {
trigger: 'item',
triggerOn: 'mousemove'
triggerOn: 'mousemove',
formatter: function (params) {
return params.name + ': ' + params.value;
}
},
animation: false,
series: [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册