Dynamically adding scale markers?

2019-06-21 18:50发布

问题:

I was wondering if there was any way to dynamically add scale-x markers AFTER the graph has been rendered, perhaps via a function like-so:

zingchart.exec('myChart', 'addscalexmarker', {
    type: "line",
    range: 14,
    label: {
        text: "label!! yay!"
    }
}

I can't seem to figure out any other way to get this to work... Thanks in advance!

回答1:

While ZingChart does have a large range of API methods to allow users to modify different pieces of a chart, not every attribute is accessible through a named method.

My suggestion would be to use the setdata method which is a catch-all API method to modify the chart's JSON. The management of the chart's state would be external to ZingChart, but updates would be handled with a single setdata method call.

   zingchart.exec('myChart', 'setdata',{
     data : myConfig
   });

Working Demo : http://demos.zingchart.com/view/BG8SXI4W

I am on the ZingChart team -- let me know if you have any further questions.



标签: zingchart