Search code examples
angulartypescripthighchartsangular2-highcharts

How to set new yAxis data in chart dynamically (highcharts + angular2(4))?


I have spline chart:

  this.chart = {
            chart: {
                type: 'spline',
                zoomType: 'x',
                animation: true,
                marginRight: 10,
                renderTo: chartId
            },

How can I add new data ( new lines) after user clicked to some button?

private addingAxisData() {
// What should be here?
}

Solution

  • Data can be set for series and not for axis.

    Check this documentation for dynamic interaction with Chart object - it shows how new points could be added dynamically.

    It's possible to use setData the same way to set data for whole series.