yyshah
Posts: 6
Joined: Tue Jan 25, 2022 8:35 pm

Gantt chart legend based on a <key> within data

Wed Jan 26, 2022 5:56 pm

Hello,

I am trying to create a custom legend based on a certain field.

In below example, the event data has a "status" field for each event which can be active / inactive. https://jsfiddle.net/YameenYasin/hnopLwtb/57/
Is there a way we can creeate a legend based on status field -- Active / InActive without altering the order in which the data is displayed ?


Thanks

User avatar
michal.f
Posts: 483
Joined: Thu Aug 12, 2021 12:04 pm

Re: Gantt chart legend based on a <key> within data

Thu Jan 27, 2022 4:37 pm

Hello,

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

You can break it down into two series, active and inactive users.
Demo: https://jsfiddle.net/BlackLabel/fmsxe3nq/

Let me know if that was what you were looking for!
Best regards!
Michał Filipiec
Highcharts Developer

yyshah
Posts: 6
Joined: Tue Jan 25, 2022 8:35 pm

Re: Gantt chart legend based on a <key> within data

Thu Jan 27, 2022 6:51 pm

Thanks for your response.

Is there a way we can preserve the initial sort order ?

User avatar
michal.f
Posts: 483
Joined: Thu Aug 12, 2021 12:04 pm

Re: Gantt chart legend based on a <key> within data

Mon Jan 31, 2022 10:06 am

Hi,

Yes, it is possible using the data.y property, but first you need to define categories for the yAxis.

Demo: https://jsfiddle.net/BlackLabel/r0hbwd8z/
API: https://api.highcharts.com/gantt/series.gantt.data.y

Feel free to ask any further questions!
Best regards!
Michał Filipiec
Highcharts Developer

yyshah
Posts: 6
Joined: Tue Jan 25, 2022 8:35 pm

Re: Gantt chart legend based on a <key> within data

Mon Jan 31, 2022 4:07 pm

Thanks for your response. This is exactly what i was looking for. Appreciate it

User avatar
michal.f
Posts: 483
Joined: Thu Aug 12, 2021 12:04 pm

Re: Gantt chart legend based on a <key> within data

Tue Feb 01, 2022 10:39 am

You're welcome! In case of any further questions, feel free to contact us again.

Best regards!
Michał Filipiec
Highcharts Developer

Return to “Highcharts Gantt”