Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically adding scale markers?

Tags:

zingchart

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!

like image 276
Brian Corbin Avatar asked Sep 04 '15 22:09

Brian Corbin


1 Answers

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.

like image 195
mike-schultz Avatar answered Sep 28 '22 11:09

mike-schultz