Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
Adding a point with animation results in weird behavior

When I try to add a point with animations in High Charts, it results in this weird behavior:

Highcharts.chart('container', {
    chart: {
        events: {
            load: function () {
                var animate = {duration: 5000};
                var series = this.series[0];
                setInterval(function () {
                    var x = (new Date()).getTime(), // current time
                    y = Math.random();
                    series.addPoint([x, y], true, true, animate);
                }, 5000);
            }
        }
    },

    xAxis: {
        type: 'datetime'
    },

    series: [{
        name: 'Random data',
        data: (function () {
            var data = [],
                time = (new Date()).getTime(),
                i;

            for (i = -19; i <= 0; i += 1) {
                data.push({
                    x: time + i * 1000,
                    y: Math.random()
                });
            }
            return data;
        }())
    }]
});

This is the behavior I would like to achieve but instead of taking 1 second to render, I would like each point to take 5 seconds to render. How can I achieve this?

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Something happens that makes the animation take a little bit longer to finish its duration. So the chart will be redrawn to a different shape everytime you put extremely close or equal values for the setInterval and for the duration.

As a workaround, try adding a slightly higher interval of addition to the points enough to become unnoticed the difference. I.e: 100 MS more or 5100

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!