BarCoP18
Posts: 3
Joined: Thu Jun 06, 2024 3:46 pm

Displaying big array data with limited xAxis labels

Hi!
I have a question about using spline chart:
I want to display a graph of numbers on xAxis, the size of the array can be between 0-60.

because of my format of xAxis label, I can only display up to 21 xAxis labels and no more.

I want to been able to display the entire data, (first xAxis label will be the first value of the array and the same with the last value of the array).
and the rest of 19 slots remains will display the data.

its important to me to display the entire values of the array, but don't need to display the entire xAxis labels (like a graph stock where I can see data of 1 month, the xAxis labels will be the days of the month with some gap, but hovering between labels will display on tooltip the data between [assuming I have data for each day])

How can I do it?
User avatar
dawid.d
Site Moderator
Posts: 992
Joined: Thu Oct 06, 2022 11:31 am

Re: Displaying big array data with limited xAxis labels

Hello,

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

Sorry, but I don't quite understand what you mean. Can you somehow sketch the chart you want to program?

I'm waiting for your response.
Best regards!
Dawid Draguła
Highcharts Developer
BarCoP18
Posts: 3
Joined: Thu Jun 06, 2024 3:46 pm

Re: Displaying big array data with limited xAxis labels

For this example, lets say I want to display an array with the numbers of 41-100 (sorted).
I have only 21 slot on XAxis and want to use them all, where the first x label will be day 1 (01/03 for example), and y value will be 41, and the y value of 21th label will be 60, where the X value will be the last date (60 days forth).
The X values represented dates (from the format: DD/MM), I don't have enough room for each day in this 2-month input, but wanted to display from start to end, where X values will be dates through this 60 days (with gap of a days I guess), and wanted that the entire Y labels will be displayed (the 41-100 values),

I see that you have an example of stock chart in this link: https://www.highcharts.com/docs/stock/g ... rted-stock, where the
X labels are from March 11th to June 3rd, where hovering the mouse between the X labels will present the data of y between them
(between Mar 11 to Mar 18 we can see the data of the days between)

I want this ability of Hidhcharts stock chart in the chart 'SPLINE'.
User avatar
dawid.d
Site Moderator
Posts: 992
Joined: Thu Oct 06, 2022 11:31 am

Re: Displaying big array data with limited xAxis labels

Hi,

See a demo below with 60 data values and spline series. Is this something you mean?

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

If you want to set strict positions for the ticks on the axis, you can use the xAxis tickPositions or tickPositioner options. See it in the API:
- https://api.highcharts.com/highstock/xA ... kPositions
- https://api.highcharts.com/highstock/xA ... Positioner

I hope you'll find it useful!
Best regards
Dawid Draguła
Highcharts Developer
BarCoP18
Posts: 3
Joined: Thu Jun 06, 2024 3:46 pm

Re: Displaying big array data with limited xAxis labels

Thank you for your response! This is the behavior I seek (display Y values where X labels are limited and Y>X).
My question is: Can I reproduce the behavior in your jsfiddle example in charts that are not stock?
I have a license for Highcharts Core, and looking to implement this behavior in other types of charts.

I want the behavior of hovering between x-axis labels to display the values between them in the tooltip (which are not displayed in the x AXis but ideally displayed in the chart as a Y value event, though its x value is not displayed on the x Axis [between x labels]).

Is this behavior only for stock charts?
User avatar
dawid.d
Site Moderator
Posts: 992
Joined: Thu Oct 06, 2022 11:31 am

Re: Displaying big array data with limited xAxis labels

Hi,

In the demo below you have the same chart in Highcharts Core, adjusted to look a bit more like Stock.

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

Did you mean something like this?
Dawid Draguła
Highcharts Developer

Return to “Highcharts Stock”