leandrosk
Posts: 4
Joined: Fri Dec 30, 2022 7:30 pm

Column, area and other options in typeChange Stock tools button

Hello everyone, I'm wondering whether it's possible to have more options for the typeChange button, other than the ones listed in https://api.highcharts.com/highstock/st ... typeChange?

In stock demos https://www.highcharts.com/demo/stock other chart types like column, area, etc. are shown. Is it possible to include those options in the typeChange button?

Thank you in advance.

Leandro.-
kamil.k
Posts: 458
Joined: Thu Oct 06, 2022 12:49 pm

Re: Column, area and other options in typeChange Stock tools button

Hello there!

Welcome to our forum and thanks for contacting us with your question.

You can easily add custom buttons to the already existing typeChange button list. I've prepared an example: https://jsfiddle.net/BlackLabel/Lk63d4er/.

Note that you can style this button based on the defined type-area class, and what happens on a click defines the init method. Also, take a look at the custom object named typeArea defined inside the stockTools.gui.definitions.typeChange object, that's the way of adding new elements to the existing button list.

Let me know if that was what you were looking for,
Kind Regards!
Kamil Kubik
Highcharts Developer
leandrosk
Posts: 4
Joined: Fri Dec 30, 2022 7:30 pm

Re: Column, area and other options in typeChange Stock tools button

Hi Kamil, thanks for the answer =)

I got that other types different than the ones listed on https://api.highcharts.com/highstock/st ... typeChange must be added as custom buttons. I was wondering whether that would be possible without the need of custom buttons, but if that's the only way it helps anyway.

I looked into the fiddle you provided and I can change to area chart with the custom button, but as soon as I attempt to get back to line or candlestick type the chart X axis get's kind of broken and no data is displayed. Can you point out which should be the code needed to make the example work properly while swithing back and forth through the 3 different chart types in the example?

Thank you!

L.-
kamil.k
Posts: 458
Joined: Thu Oct 06, 2022 12:49 pm

Re: Column, area and other options in typeChange Stock tools button

Unfortunately, it's the most straightforward way to achieve that. I've created a more complex example, showing a few possible types, take a look: https://jsfiddle.net/BlackLabel/2tgjrmkf/

As you mentioned, in the previous example other types didn't show up as the data was wrong, my apologies for that.

Let me know if this example meets your needs,
Regards!
Kamil Kubik
Highcharts Developer

Return to “Highcharts Stock”