Dynamically adding scale markers?

余生长醉 提交于 2019-12-10 13:58:04

问题


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.



来源:https://stackoverflow.com/questions/32407355/dynamically-adding-scale-markers

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!