confusedDude
Posts: 21
Joined: Wed Jul 27, 2022 9:31 am

Different sizes charts.

Hey.

I wanna have different pointWidth depending on if a task is parent or child.

Given that i have to set the pointwidth in the plotoptions i have some problem accessing the current point.

plotOptions: {
series: {
pointWidth: 40;
},
}

I have tried to use a callback function like
plotWidth : () => {
//conditions return either 40 if point is parent, or 20 if point is child;
}

Any thougts? :)

Morten
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Different sizes charts.

Hey Morten!

Unfortunately, there is no callback function for pointWidth property, but the good news is, that you can set a pointWidth for individual points. So with some custom simple JS logic fired when the chart is loaded you can change pointWidth of each point to your preferences. I have prepared a simple demo for you with that code - check it below.

Demo: https://jsfiddle.net/BlackLabel/3bLqck9u/
API Reference: https://api.highcharts.com/highcharts/chart.events.load
https://api.highcharts.com/class-refere ... int#update
https://api.highcharts.com/class-refere ... art#redraw

Let me know if that was what you were looking for.
Best regards!
Hubert Kozik
Highcharts Developer
confusedDude
Posts: 21
Joined: Wed Jul 27, 2022 9:31 am

Re: Different sizes charts.

This is great. Thank you :)
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Different sizes charts.

You're welcome! In case of any further questions, feel free to contact us again.
Hubert Kozik
Highcharts Developer
confusedDude
Posts: 21
Joined: Wed Jul 27, 2022 9:31 am

Re: Different sizes charts.

Hey again.

hmm, this works, however it creates a bug with the labels. Labels looking real blurry, and i inspected the labels with the dev tools and it looks like it create a lot of identical labels, sitting on top of eachother. The labels also is stuck at the position in which the graph is loades so if i scroll the "fat labels" are staying in position and the one in the bottom moves accordingly to the scrolling.

Morten
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Different sizes charts.

Morten,

I am not quite sure if I understand your problem. Could you send some images of your issue? Or in the best way, please recreate the problem in the online editor that I could work on. You can use the demo from my previous post.

I am looking for your response.
Regards!
Hubert Kozik
Highcharts Developer

Return to “Highcharts Gantt”