Page 1 of 1

Gantt chart legend based on a <key> within data

Posted: Wed Jan 26, 2022 5:56 pm
by yyshah
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

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

Posted: Thu Jan 27, 2022 4:37 pm
by michal.f
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!

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

Posted: Thu Jan 27, 2022 6:51 pm
by yyshah
Thanks for your response.

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

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

Posted: Mon Jan 31, 2022 10:06 am
by michal.f
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!

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

Posted: Mon Jan 31, 2022 4:07 pm
by yyshah
Thanks for your response. This is exactly what i was looking for. Appreciate it

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

Posted: Tue Feb 01, 2022 10:39 am
by michal.f
You're welcome! In case of any further questions, feel free to contact us again.

Best regards!