cdaringe
cdaringe

Reputation: 1538

Add series to highcharts dynamically without initial data

I'm trying to add & remove data series to and from Highcharts that consume dynamic data. However, my dynamically added data never renders onto the chart, even though the series has been added.

I have:

For example:

See http://jsfiddle.net/dLovcw7x/2/

You will note that MY_NEW_SERIES never seems to render anything interesting, except a place in the legend.

Here's the consolidated version.

...
events: {
  load: function () {
      var MY_NEW_SERIES = this.addSeries({ ...config })
      var existingSeries = this.series[0] // <== i dont want this at all
      setInterval(function () {
        // as shown in HC demos...
        var x = new Date().getTime()
        var y = Math.random()
        MY_NEW_SERIES.addPoint([x, y + 0.5], true, true) // **doesn't render!**
        existingSeries.addPoint([x, y], true, true) // renders OK
      }, 1000);
  }
}

I know there are about 1M other SO posts that make this look like a dupe, but none of them are specific to dynamically adding series w/out initial data wherein addSeries has already been called and data points added.

Thx!

Upvotes: 0

Views: 755

Answers (1)

cdaringe
cdaringe

Reputation: 1538

@Grzegorz Blachliński's comment was right on. Thx! See his comment above.

Upvotes: 0

Related Questions