alingat
Posts: 4
Joined: Thu Dec 16, 2021 8:43 pm

Highcharts dynamic series name

Hi,

I am trying to do a dynamic series name on column type chart, how do we do this with highcharts? Also, I need to add those 6 data per category.

see image below, dates will change depending on what the API sends.

Thanks!
Attachments
column.PNG
column.PNG (13.92 KiB) Viewed 1788 times
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Highcharts dynamic series name

Hi alingat,

Thanks for contacting us with your question.

I need some more details on what exactly do you want to achieve. What do you mean by dynamic series name? Series name can be set with name option, which can be later updated with series.update() method. New data can be added using addPoint or setData.

If data may vary depending on your API response, then all you have to do is parse your data correctly and create a chart based on that data.

Thanks in advance for clarification.
Regards!
Mateusz Bernacik
Highcharts Developer
alingat
Posts: 4
Joined: Thu Dec 16, 2021 8:43 pm

Re: Highcharts dynamic series name

Hi!

Based on my image, the "Jun 21, Jul 21, Aug 21, Sep 21, Oct 21, Current" can change depending on what the API gives me.

an example of the JSON would be
monthName is the name of the series.

[
{
"recordType": "BUSINESS_PROCESS",
"year": 2022,
"monthName": "Jan",
"recordsCount": 20
},
{
"recordType": "BUSINESS_PROCESS",
"year": 2022,
"monthName": "Feb",
"recordsCount": 30
},
{
"recordType": "BUSINESS_PROCESS",
"year": 2022,
"monthName": "March",
"recordsCount": 40
},
{
"recordType": "BUSINESS_PROCESS",
"year": 2022,
"monthName": "April",
"recordsCount": 50
},
{
"recordType": "BUSINESS_PROCESS",
"year": 2022,
"monthName": "May",
"recordsCount": 60
},
{
"recordType": "BUSINESS_PROCESS",
"year": 2022,
"monthName": "Jun",
"recordsCount": 70
},
]
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Highcharts dynamic series name

Hi alingat,

Here is a demo showing how to parse your data to meet your chart requirements:
https://jsfiddle.net/BlackLabel/q7u281pk/

You have metnioned that chart should be depenent on an API responses. All you have to do is to parse your data to fit formats specified in our docs, and then use previously mentioned functions to update your chart.
API reference: https://api.highcharts.com/highcharts/s ... olumn.data

Let me know if you have any further questions!
Regards!
Mateusz Bernacik
Highcharts Developer
alingat
Posts: 4
Joined: Thu Dec 16, 2021 8:43 pm

Re: Highcharts dynamic series name

Thanks @mateusz.b!
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Highcharts dynamic series name

You're welcome! In case of any further questions, feel free to contact us again.
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Maps”