Jiren
Posts: 13
Joined: Tue Aug 15, 2023 7:10 am

Getting the edges of Geojson chart

Mon Aug 28, 2023 9:48 am

How can I get the coordinates of these red points (look at the screenshot)?
Attachments
highcharts.png
highcharts.png (9.33 KiB) Viewed 626 times

jakub.j
Posts: 871
Joined: Tue Jan 24, 2023 11:14 am

Re: Getting the edges of Geojson chart

Mon Aug 28, 2023 1:12 pm

Thanks for contacting us with your question!

It depends on what you need those coordinates for. The easiest way is to show how to draw rectangles on both the corners of the chart. I did that using Highcharts.SVGRenderer.

The first argument when drawing the rectangle is the x coordinate and the second one is y. If you want to place something in the top right corner, check the coordinates of the first rect drawn, basically, it's based on the chart.chartWidth and for the bottom left corner we need chart.chartHeight as in the second rectangle.

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

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

Jiren
Posts: 13
Joined: Tue Aug 15, 2023 7:10 am

Re: Getting the edges of Geojson chart

Tue Aug 29, 2023 2:35 am

jakub.j wrote:
Mon Aug 28, 2023 1:12 pm
Let me know if that was what you were looking for!
No, this isn't what I'm looking for:
hc2.png
hc2.png (18.87 KiB) Viewed 617 times
I'm not looking for the borders of the chart, I'm looking for the borders of my object.
As you can see, I can get the bottom left one (because it has the coordinates of 0;0), but I don't understand how to get the top right.

jakub.j
Posts: 871
Joined: Tue Jan 24, 2023 11:14 am

Re: Getting the edges of Geojson chart

Tue Aug 29, 2023 7:24 am

Hey!

There is no direct way to find out the exact coordinates of the corners, but we have a demo with built in functionality, so that the lon/lat are displayed on mouse move. You can apply this logic in your chart and check your desired coordinates.

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

I hope you will find it useful
Regards
Jakub
Jakub
Highcharts Developer

Return to “Highcharts Maps”