Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

129
Vistas
Freeze Highchart Animation

The spline produced from Highchart below is "re-drawn" every time ajax refreshes.

My question then is there a way for the spline to be updated "in-place" so the spline isn't re-drawn every time a refresh occurs?

I've tried setting animation: false however the redrawing keeps happening. Thank you in advance!

JS code:

$(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);
            }
        });
    });
 });
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You need to disable animation on a series level:

    Highcharts.chart('container', {
        ...,
        series: [{
            animation: false,
            ...
        }]
    });

Live demo: http://jsfiddle.net/BlackLabel/gmbLh1v3/


But it is better to update a chart than create a new one after every request. Example: http://jsfiddle.net/BlackLabel/nxmqwp4j/


API Reference:

https://api.highcharts.com/highcharts/chart.animation

https://api.highcharts.com/highcharts/series.line.animation

https://api.highcharts.com/class-reference/Highcharts.Chart#update

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda