fcnealvillangca
fcnealvillangca

Reputation: 13

Draggable line series gives a TypeError: Cannot read properties of undefined (reading 'chart')

I'm currently using

when I try to click and drag the point of the line it gives Draggable line series gives a TypeError: Cannot read properties of undefined (reading 'chart')

My settings in the series is

  series: [
    {
      type: "candlestick",
      name: "Ethereum",
      id: "ethereum",
      data: ohlcdata,
    },
    {
      dragDrop: {
        draggableY: true,
      },
      type: "line",
      name: "Trend Line",
      data: [
        [1060646400000, 0.6848],
        [1209010862151.3945, 0.8521739130434782],
      ],
      yAxis: 0,
    },
    {
      type: "macd",
      id: "oscillator",
      linkedTo: "ethereum",
      yAxis: 1,
      params: {
        period: 26,
        signalPeriod: 9,
        shortPeriod: 12,
      },
    },
  ],

as per documentation but this gives me error.

I also try to import the https://github.com/highcharts/draggable-points/blob/master/draggable-points.js in the script the typeerror was gone but still not working

Upvotes: 0

Views: 26

Answers (1)

jedrzejruta
jedrzejruta

Reputation: 546

@fcnealvillangca In order to make the trend line points draggable, you should disable dataGrouping for this series.

 {
    dragDrop: {
        draggableY: true,
    },
    type: 'line',
    dataGrouping: {
        enabled: false,
    },
    data: [
        [1060646400000, 0.6848],
        [1209010862151.3945, 0.8521739130434782]
    ]
}

Demo: https://jsfiddle.net/BlackLabel/sg5cod4b/

API: https://api.highcharts.com/highstock/series.line.dataGrouping.enabled

Upvotes: 0

Related Questions