Note that there are some explanatory texts on larger screens.

plurals
  1. POHighcharts - Update a series point [x,y] values?
    text
    copied!<p>I'm trying to update a point[x,y] in the chart. What's the problem? Ok, I chart and its chart series are like this:</p> <pre><code> series: [ { enableMouseTracking: false, name: 'Line1', type: 'line', color: '#5d5d5d', yAxis: 1, data: [[12000, 55.068493], [15064, 42.842]], marker: { symbol: 'circle' } }, { enableMouseTracking: false, name: 'Line2', type: 'line', color: '#5d5d5d', yAxis: 1, marker: { symbol: 'circle' }, data: [[12000, 57.671527], [16000, 42.620069]] },{ name: 'TOM', //type: 'line', color: '#ff4100', yAxis: 1, marker: { symbol: 'url(icons/tom.png)' }, data: [ { id:'tom_point', color: '#00FF00', y: fi_variable, x: tom_variable } ] } </code></pre> <p>Now the thing is that, I'm checking if <code>fi_variable</code> or <code>tom_variable</code> has changed and if its true, update these two variables, and finally update the chart.</p> <p>I have tried already, some methods like <code>chart.series[0].data[0].update(y = 10);</code> and its working for some points with fixed x,y values, but no luck for the rest of the points. For Instance I use <code>chart.series[0].data[1].update(y = 10);</code> will work ok, but this <code>chart.series[0].data[3].update(y = 10);</code> will not work.</p> <p>1- Is there any way to replace the <code>data[0]</code> from the above code line with an <code>id</code> of a point in our case <code>tom_point</code> ?</p> <p>Also I've tried this <code>chart.series[0].setData([[tom_variable,fi_variable, 'tom_point']]);</code> and again it wont working when the point is with an id or without fixed values.</p> <p>But If I try <code>chart.series[0]data[0].setData([[tom_variable,fi_variable]]);</code> it works but again not on 3rd element (in our case - as shown above) of the series.</p> <p>I can get the values for this point with the following, <code>var tomPoint = chart.get('tom_point').y;</code> but I can't set any x,y values back to chart and update it (the chart).</p> <p>I have also tried to check if the variables have changed and to redraw the chart with chart.redraw but nothing.</p> <p>Any Ideas how can I get this to work? Am I losing something?</p> <p>Thank you in Advance for your time.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload