MikeLimp
Posts: 3
Joined: Wed Sep 21, 2022 4:47 pm

X-Range сurrent date and other

Hello Highcharts team! There are a couple of questions that I couldn't find answers to

My layout:
highcharts.png
highcharts.png (24.36 KiB) Viewed 221 times
1) The left panel with the checkboxes. I understand formatter can't handle anything other than div/span. Tried to do it through div and before. after clicking on the item I wanted to change the class and change the rendering styles. There is no way to change the value in formatter (like changing the class after the click from off to on) Is there any way to change the value in formatter or should I do this component separately?

2) Is it possible to draw the current time line(plotLine) as on the layout (on the scale of the x-axis) ?

3) Is it possible to click on an empty cell and select the whole line?
At the moment I can only click on yaxis labels or point
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: X-Range сurrent date and other

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

1. You need to set yAxis.labels.useHTML to true to display improved HTML elements, another thing is filtering which has been added since Highcharts version 9. To use other HTML tags with their attributes you need to add them to the allow list. You can read more about it in the link to the documentation attached below.

2. Yes, it is possible. The xAxis.currentDateIndicator property is used for this.

3. It is not possible to do that easily using the API options.

Demo: https://jsfiddle.net/BlackLabel/mr7u5wsy/
Docs: https://www.highcharts.com/docs/chart-c ... formatting
API: https://api.highcharts.com/gantt/yAxis.labels.useHTML
https://api.highcharts.com/gantt/xAxis. ... eIndicator

Let me know if you have any further questions!
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
MikeLimp
Posts: 3
Joined: Wed Sep 21, 2022 4:47 pm

Re: X-Range сurrent date and other

Thanks for the answers.
On point 3: Can I just click on an empty cell and call a function that gets yAxis pos and xAxis time tick (for example yAxis.value: 2, xAxis.value: {start,end} ) ?
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: X-Range сurrent date and other

Hello,

A topic related to this has recently appeared on the forum: viewtopic.php?f=19&t=49525

Let me know if that was what you were looking for!
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
MikeLimp
Posts: 3
Joined: Wed Sep 21, 2022 4:47 pm

Re: X-Range сurrent date and other

Thank you very much ! This topic will help me with highlighting the whole line
I asked the question wrong. I'd like to double click on an empty cell to call some modal, which would get the data from xAxis and yAxis and add a new point
In the attached screenshot, the function would get yAxis.value: 'item3', xAxis.value: {x: 4.30, x2: 5.30}
Can I implement something like this?
dbClick.png
dbClick.png (27.77 KiB) Viewed 172 times
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: X-Range сurrent date and other

Hi,

You can implement something like this, in the click event on the graph you can simulate a double click and after the y coordinates of the click and points you will find a match. As you look at the console of the sent demo, it returns the index and x of a given point after a double click.

Demo: https://jsfiddle.net/BlackLabel/o2xmbr1a/

Feel free to ask any further questions!
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/

Return to “Highcharts Usage”