Reza
Reza

Reputation: 3919

Setting min and max for chart in Highcharts library error

Please take a look at my code in JSFiddle;

const chart = { title: { text: "" }, exporting: { enabled: false }, series: [], xAxis: [ { min: 0, max: 10, legend: { enabled: true } } ],
yAxis: [] };
const yAxis = { id: 0, title: { text: "test" }, min: 1, max: 100 }
chart.yAxis.push( yAxis );
const series = { type: "line", id: 0, data: [], name: "test" }
chart.series.push( series );
Highcharts.stockChart( 'container', chart );

Highchart Sample Code

Check console for seeing error.

The problem is in setting "min" and "max" of xAxis. If I remove those two properties, it works fine. Could someone tell me what the problem is. I need to have min and max for my chart.

Upvotes: 0

Views: 18

Answers (1)

ppotaczek
ppotaczek

Reputation: 39069

The id property should be unique and should be a string:

const yAxis = {
  id: '0',
  ...
}

Live demo: https://jsfiddle.net/BlackLabel/op4hudwf/

API Reference: https://api.highcharts.com/highstock/xAxis.id

Upvotes: 1

Related Questions