How to dynamically update highcharts using jQuery UI sliders

纵然是瞬间 提交于 2019-12-06 07:45:37

I don't quite upderstand how you want your calculation to work, but I can help with how to update the chart. Basically, you need to create a new aray of datapoints, and then call setData on the appropriate chart series.

I tried this on your example. The calcuation (ui.value * i) needs to be changed, but it ilustrates how to update the chart. It uses the valueof the second slider to update the first series points:

slide: function(event, ui) {
    $('#slider2_value').html('$' + ui.value);
    var newdata = [];
    for (var i=0 ; i<6 ; i++) {
        newdata.push(ui.value * i);
    }
    chart.series[0].setData (newdata);
},

http://jsfiddle.net/BLKQf/

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