devjm
Posts: 2
Joined: Wed Mar 03, 2021 7:04 pm

Scatterplot - Make a specific point be the center of the chart.

Hello,

I'm trying to do the following:

I have a scatterplot chart where I want one data point to be in the middle of the chart, even when zooming in/out.

In the following chart (taken from the example page), let's imagine that I need the top most point of the female one be the center of the view.

How can I do this?

Example link:

https://jsfiddle.net/gh/get/library/pur ... mo/scatter

Thank you
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Scatterplot - Make a specific point be the center of the chart.

Hello devjm!

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

I'm not sure if I understand you correctly. Do you want to change this point's x and y values to make it centered in the chart? If yes, I suggest using selection event in which you can update the x and y properties of the point using update method. The values for x and y you need to calculate based on the look of the chart. If you have any problems with that, you can reach me any time.

API references:
https://api.highcharts.com/highcharts/c ... .selection
https://api.highcharts.com/class-refere ... int#update

If this is not what you were looking for please describe your requirements more precisely. :-)
Best regards!
Dominik Chudy
Highcharts Developer
devjm
Posts: 2
Joined: Wed Mar 03, 2021 7:04 pm

Re: Scatterplot - Make a specific point be the center of the chart.

Hi Dominik.c,

Look at the image below:

Image

I need to get the blue point to the center of the chart (which is the point of reference). I don't want to move the position of the points, I just need to move the position of the view to that specific point.
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Scatterplot - Make a specific point be the center of the chart.

Hi again!

I'm sorry but I don't understand what you mean by changing the position of the view. Does the view mean the area that you zoom in? If you select the area "properly" you'll get your point in the middle of the chart. Without changing the point's position I'm afraid there's no way to make the point centered.

Best regards!
Dominik Chudy
Highcharts Developer

Return to “Highcharts Usage”