eraka
Posts: 123
Joined: Thu Apr 28, 2022 6:55 am

Remove data point from highchart gantt

HI

How to remove highchart gantt point, i wanted to use point.remove() but on which event i fire it.
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Remove data point from highchart gantt

Hi there,

It is completely up to you on which event you are going to remove the point. You can remove it on a chart.events.load (to remove it during the chart load), or simply on a button click.

Take a look at the simple example.
DEMO: https://jsfiddle.net/BlackLabel/okf3n8rg/
API Reference: https://api.highcharts.com/class-refere ... int#remove

Please do not hesitate to contact us with any further questions,
Have a great day!
Kamil Musiałowski
Highcharts Developer
eraka
Posts: 123
Joined: Thu Apr 28, 2022 6:55 am

Re: Remove data point from highchart gantt

thanks kamil !!
i did exactly the same.

One question here can we dynamically define Y axis, rather than static. I have used below configurations but can we have these categories defined from api

yAxis: {
type: 'category',
categories: ['L 1', 'L 2', 'L 3', 'L 4'],
min: 0,
max: 3,
},
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Remove data point from highchart gantt

You're welcome!

I'm sorry, but I don't really get what you mean by defining an yAxis programmatically. In Gantt chart, the yAxis categories come from your data - more specifically, from series.data.name. In the previous demo I've sent you, you can see how we do not specify an yAxis anywhere, yet it's categories are programmatically created from the names in your data.

If that's not what you meant, please elaborate a bit more on that to help me understand the issue better.

Thank you!
Kamil Musiałowski
Highcharts Developer
eraka
Posts: 123
Joined: Thu Apr 28, 2022 6:55 am

Re: Remove data point from highchart gantt

yes i saw that so basically series.data.name will take as y axis values. So what i understand if from API i got data[4] array.

so i can use
data: [{
name: data[0] or data
start: Date.UTC(2014, 10, 18),
end: Date.UTC(2014, 10, 20)
}, {
name:data[1]
start: Date.UTC(2014, 10, 20),
end: Date.UTC(2014, 10, 25),
}, {
name: data[2]
start: Date.UTC(2014, 10, 23),
end: Date.UTC(2014, 10, 26)
}, {
name:data[3]
start: Date.UTC(2014, 10, 27),
end: Date.UTC(2014, 10, 29),
}]

or specifically i can iterate over i.
please correct me if i am wrong

regards
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Remove data point from highchart gantt

Yes, from API you will get an array of data with 4 items, each containing the specified options (such as name, start, end - and other Highcharts default properties). When it comes to setting the name in your data, if you have in your code a variable called data, which is an array of strings, you can use that in the way you showed me in your post. Highcharts are built using JavaScript, so any JS technique can be used inside them.

Best regards!
Kamil Musiałowski
Highcharts Developer
eraka
Posts: 123
Joined: Thu Apr 28, 2022 6:55 am

Re: Remove data point from highchart gantt

Thanks that helps a lot!!
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Remove data point from highchart gantt

Good to hear that!

Feel free to contact us anytime in the future,
Regards!
Kamil Musiałowski
Highcharts Developer

Return to “Highcharts Gantt”