maksam07
Posts: 2
Joined: Wed Apr 07, 2021 12:58 pm

How to have a common X-axis for a Multi Series Graph?

Hello everyone!
I have a table in my database, multiple data is stored in one row, for example: [date, data1, data2, data3, data4, label]

The first index stands for the X-axis
The next 4 are 4 series of the Y-axis
The last index denotes a string description and should appear somewhere in the tooltip

Can you help me implement the correct configuration?
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: How to have a common X-axis for a Multi Series Graph?

Hello maksam07!

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

In this case, we can use the data module and complete function to modify the data before parsing it to the chart. In Highcharts the data couldn't be string, so firstly I've saved all the labels in the array and delete series with labels (they're strings) so the data can be displayed properly.

Then in the tooltip formatter you can specify which label would you like to display.

API references:
https://api.highcharts.com/highcharts/data.complete
https://api.highcharts.com/highcharts/tooltip.formatter

Demo:
https://jsfiddle.net/BlackLabel/9gLozwsp/

Let me know if that was what you were looking for!
Best regards!
Dominik Chudy
Highcharts Developer
maksam07
Posts: 2
Joined: Wed Apr 07, 2021 12:58 pm

Re: How to have a common X-axis for a Multi Series Graph?

dominik.c wrote: Thu Apr 08, 2021 12:47 pm In this case, we can use the data module and complete function to modify the data before parsing it to the chart. In Highcharts the data couldn't be string, so firstly I've saved all the labels in the array and delete series with labels (they're strings) so the data can be displayed properly.
Unfortunately, I need to use StockChart
For ordinary charts, I found a solution, but StockChart does not have the same settings, so the solution did not work for me
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: How to have a common X-axis for a Multi Series Graph?

Hi again!

The solution I've provided to you works also with StockChart, check it out: https://jsfiddle.net/BlackLabel/qcdhx7fz/

Best regards!
Dominik Chudy
Highcharts Developer

Return to “Highcharts Stock”