0

I use "Column" type High chart to Show two different data sets in my application. Both data are marked in a same column chart as different series. But I need to set two various plotOption{} for the graphs.

Highcharts is throwing error if I set the property within the Series[].

If I set the Property using plotOptions{}, the property is getting applied for both the column Charts.

eg:

 series: [
    {
      type: 'column',
      name: 'Data1',
      data: data1,
      color: "#31598a",
      index: 0,
      legendIndex: 0
    },
    {
      type: 'column',
      name: 'Data2',
      data: data2,
      color: "#7e95a5",
    }]

here, I want to use the property "linkedTo: ':previous'" only for the 'data2' series..

 plotOptions: {
    column: {
      grouping: false,
      shadow: false,
      borderWidth: 0,
      pointPadding: 0.3,
      pointWidth:12
    }

Defining the property inside this plotOptions is applying it to both the column series..

Is there anyway to apply property only to one particular series??

Thanks in Advance.

Wojciech Wirzbicki
  • 3,887
  • 6
  • 36
  • 59
Shylesh
  • 65
  • 9
  • 1
    Please provide a [MCVE], that would make it a lot easier to help you. – ewolden Dec 12 '18 at 09:59
  • I don't see why the `linkedTo` isn't working in the serie. [Here a simple Fiddle](https://jsfiddle.net/oy7mt19s/) – Core972 Dec 12 '18 at 12:38
  • @Core972 Yeah.. Even I saw many similar fiddle examples where properties are directly declared inside the Series.. But in my scenario, I couldn't declare any property inside. I'm being alerted to declare it in plotOptions. – Shylesh Dec 12 '18 at 14:45
  • @Shylesh, please provide an example. – Core972 Dec 12 '18 at 15:04

1 Answers1

0

You should define individual options for series directly and it should works.

To workaround, you can create a new type of series, which will differ only by the type name from the column series and use it in plotOptions:

var H = Highcharts;

H.seriesType('column2', 'column');


H.chart('container', {
    plotOptions: {
        column: {
            ...
        },
        column2: {
            ...
        }
    },

    series: [{
            type: 'column',
            ...
        },
        {
            type: 'column2',
            ...
        }
    ]
});

Live demo: http://jsfiddle.net/BlackLabel/omz0u7gs/

ppotaczek
  • 36,341
  • 2
  • 14
  • 24
  • This workaround looks promising.. But when I tried to implement Highcharts.seriesType, there shows a error "[ts] Property 'seriesType' does not exist on type 'Static'. " What do I do ?? – Shylesh Dec 13 '18 at 10:46
  • Hi Shylesh, Maybe you did not import Highcharts? Without looking into your code, it's hard to say anything. – ppotaczek Dec 13 '18 at 12:13
  • Yeah.. There was a Issue with the Highcharts module import.. This work around Works now! Thanks Alot! – Shylesh Dec 14 '18 at 13:41