wergeld
wergeld

Reputation: 14442

Highstock Stock Tools Creating Indicator GUI Does Not See Chart Series

I have a chart with several series that have data monthly. I am trying to use the stock tools GUI to enable users to add/alter the SMA indicator. I can get the stock tools to load and have the popup to modify the SMA properties. Except, the GUI has no series listed in the drop down. I have created a very simplified version using unemployment data and just one series here. I am adding the libraries as per usual and my chart code is nothing fancy. My series looks like:

  type: 'line',
  name: 'Unemployment Rate (%)',
  tooltip: {
    valueSuffix: '%',
    valueDecimals: 1
  },
  visible: true,
  showInNavigator: true,
  data: [{
      x: 189406800000,
      y: 4.50
    },
    {
      x: 192085200000,
      y: 4.30
    },
    {
      x: 194590800000,
      y: 3.60
    },...

I get no errors in the console - just no way to create the SMA series linked to a series of my choosing. Note that if I manually create the SMA series and link to my data series it does appear but I do not want to create a default ahead of time.

Upvotes: 0

Views: 334

Answers (1)

ppotaczek
ppotaczek

Reputation: 39099

You need to add id property to your series:

series: [{
    id: 'one',
    data: [...]
}]

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

API Reference: https://api.highcharts.com/highstock/series.line.id

Upvotes: 1

Related Questions