【问题标题】:Manipulate ZoomChart charts from DOM从 DOM 操作 ZoomChart 图表
【发布时间】:2019-06-21 15:29:54
【问题描述】:

在一个网站中,ZoomCharts 已集成,我想通过 chrome 扩展的内容脚本将图表中的价格像 $99 屏蔽到 $xxx。但我在 DOM 的图表上找不到任何数值

【问题讨论】:

    标签: javascript google-chrome dom charts zoomcharts


    【解决方案1】:

    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
    

    【讨论】:

      猜你喜欢
      • 2021-05-09
      • 1970-01-01
      • 2016-01-12
      • 2017-02-21
      • 2022-11-23
      • 2011-02-19
      • 2011-11-04
      • 2011-01-23
      • 2017-09-04
      相关资源
      最近更新 更多