La spline producida por Highchart a continuación se "vuelve a dibujar" cada vez que se actualiza ajax.
Mi pregunta, entonces, ¿hay alguna manera de que la spline se actualice "en el lugar" para que la spline no se vuelva a dibujar cada vez que se actualiza?
Intenté configurar animation: false, sin embargo, el redibujado sigue ocurriendo. ¡Gracias de antemano!
Código JS:
$(document).ready(function(){ function my_chart(response) { // $('#data-container').highcharts({ chart = Highcharts.chart('data-container', { chart: { renderTo: 'data-container', defaultSeriesType: 'spline' // animation: false }, title: { text: 'Live Reddit Stream' }, xAxis: {//{ type: 'datetime', categories: response.halfhour }, yAxis: { minPadding: 0.2, maxPadding: 0.2, title: {text: 'Value', margin: 80} }, series: [{ name: 'reddit_stream', data: response.count }] }); } $(function fetchdata() { $.ajax({ url: '/fetch_data', type:'POST', dataType: '', success: function(output_string){ //call my_chart function my_chart(output_string); }, complete:function(output_string){ setTimeout(fetchdata,10000); }, error: function (xhr, ajaxOptions, thrownError){ console.log(xhr.statusText); console.log(thrownError); } }); }); });Debe deshabilitar la animación en un nivel de serie:
Highcharts.chart('container', { ..., series: [{ animation: false, ... }] });Demostración en vivo: http://jsfiddle.net/BlackLabel/gmbLh1v3/
Pero es mejor actualizar un gráfico que crear uno nuevo después de cada solicitud. Ejemplo: http://jsfiddle.net/BlackLabel/nxmqwp4j/
Referencia API:
https://api.highcharts.com/highcharts/chart.animation
https://api.highcharts.com/highcharts/series.line.animation
https://api.highcharts.com/class-reference/Highcharts.Chart#update