Garabound
Posts: 5
Joined: Fri May 08, 2020 10:56 pm

expand overwrite yAxis formatter

Hi everyone, I have the next code
https://jsfiddle.net/garabound/kezu2b9m/

If you expand the first item, it will show the child of it, as you can see I add a circle/dot with a specific color in accordance with a business logic (this work fine). For the first parent the child have a green circle, but if you open the second parent (it have a orange circle) it change the first child and both are now orange.

I need to keep the corresponding color, have anyone a solution for this dilema?

Greetings to everyone from Chile
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: expand overwrite yAxis formatter

Hi,
Thanks for contacting us with your question.

It seems to me that you will need to rebuild the yAxis.labels.formatter and add the security that if the color is already there, don't return another color.

Let me know how are you going with this.
Best regards.
Sebastian Hajdus
Highcharts Developer
artakserkses
Posts: 51
Joined: Tue Feb 23, 2021 11:23 am

Re: expand overwrite yAxis formatter

Or, You can check if parent is what you need it to be.
Cause:
1. You are checking if thi.value has PM (no matter where, so if you will have something like 23.blablablaPMblablabla it will be true as well)
and if something has PM you are returning circle + value.
But in var sub and var item you are taking just the prueba value, so in this if clause you are taking all PMs, and then you give them circle from "prueba" value.
You need to check in some way parent of "this" value (ex. you have this.pos which is always +1 of position of its parent)
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: expand overwrite yAxis formatter

Hi artakserkses,
Thanks for your suggestions :)

Regards.
Sebastian Hajdus
Highcharts Developer

Return to “Highcharts Gantt”