【发布时间】:2019-06-21 15:29:54
【问题描述】:
【问题讨论】:
标签: javascript google-chrome dom charts zoomcharts
【问题讨论】:
标签: javascript google-chrome dom charts zoomcharts
ZoomCharts 正在使用 Canvas 来呈现图表。要更改标签内容,您可以像这样使用 styleFunction:http://jsfiddle.net/7np69cLo/
但是,请注意,您需要访问图表实例才能更改行为。
要从已经实例化的图表的外部脚本执行此操作,您可以这样做:
let e = document.getElementById("demo"); // set to dom element that contains the chart
let chart = e._DVSL_ChartInstance; // get the chart instance
chart.updateSettings({
slice: {
styleFunction: function(slice){
slice.label = "foo";
slice.innerLabel = "bar";
}
}
}); // set your own style function as in the above jsfiddle example
【讨论】: