kevin liu
Posts: 8
Joined: Tue Feb 28, 2023 2:37 am

Is there any way to group x data automatically and make bar value as counts?

I have composed charts that include scatter and columns.
The data is only array for scatter data. but I need to show columns that shows counts of spots.
so columns should be grouped automatically and counts it. also position should be right.
any help would be appreciated.

Here is example picture for reference.

Image
jakub.s
Posts: 1228
Joined: Fri Dec 16, 2022 11:45 am

Re: Is there any way to group x data automatically and make bar value as counts?

Hi,

Welcome to our forum & thanks for the question!

If I understand correctly, you might want to use the histogram series linked to the scatter one.

Demo: https://jsfiddle.net/BlackLabel/rdmxb9op/
API: https://api.highcharts.com/highcharts/series.histogram

Let me know if that's what you were looking for.

Regards,
Jakub
Jakub
Highcharts Developer
kevin liu
Posts: 8
Joined: Tue Feb 28, 2023 2:37 am

Re: Is there any way to group x data automatically and make bar value as counts?

jakub.s wrote: Tue Feb 28, 2023 7:21 am Hi,

Welcome to our forum & thanks for the question!

If I understand correctly, you might want to use the histogram series linked to the scatter one.

Demo: https://jsfiddle.net/BlackLabel/rdmxb9op/
API: https://api.highcharts.com/highcharts/series.histogram

Let me know if that's what you were looking for.

Regards,
Jakub
thank you looks correct. I will test and let you know result.
jakub.s
Posts: 1228
Joined: Fri Dec 16, 2022 11:45 am

Re: Is there any way to group x data automatically and make bar value as counts?

Great!

Do not hesitate to let me know if you encounter any problems.

Regards,
Jakub
Jakub
Highcharts Developer
kevin liu
Posts: 8
Joined: Tue Feb 28, 2023 2:37 am

Re: Is there any way to group x data automatically and make bar value as counts?

jakub.s wrote: Tue Feb 28, 2023 11:51 am Great!

Do not hesitate to let me know if you encounter any problems.

Regards,
Jakub
I tested histogram. but it seems only make grouped data for y value. can we get it for x value?
jakub.s
Posts: 1228
Joined: Fri Dec 16, 2022 11:45 am

Re: Is there any way to group x data automatically and make bar value as counts?

I'm sorry but I don't think I fully understand.

Histogram is just a graph showing frequency distributions.

What exactly would you like to achieve with this histogram?
Could you elaborate on that?

Regards,
Jakub
Jakub
Highcharts Developer
kevin liu
Posts: 8
Joined: Tue Feb 28, 2023 2:37 am

Re: Is there any way to group x data automatically and make bar value as counts?

Histogram data is calculated by y axis value by default. but I would like to know if there is function that can calculate frequency distributions for x axis values. it means I just wanna show distributions of x axis. is it possible? @jakube
jakub.s
Posts: 1228
Joined: Fri Dec 16, 2022 11:45 am

Re: Is there any way to group x data automatically and make bar value as counts?

Okay, I get it now.

Unfortunately, there's no option like that in the API.

What we could do however is preprocess your data, create an additional invisible series with only the x-values and link the histogram series to this invisible one.

Then, you will not be able to see this additional series, but the histogram will be based on the frequency distribution of the x-values.

Here's a demo: https://jsfiddle.net/BlackLabel/qfgch8ae/

Let me know if you encounter any problems with implementing that into your project.

Best regards,
Jakub
Jakub
Highcharts Developer

Return to “Highcharts Stock”