ty2610
Posts: 6
Joined: Wed Jun 30, 2021 2:44 pm

X axis labels with Series array

I've been searching around, but I cant seem to find a solution to my problem. I am trying to replicate the chart found in this fiddle: http://jsfiddle.net/2d7ej1qf/. I am specifically trying to get the x axis labels for each bar. If I apply a categories array, it will only take the first element, and list it at the x axis, assumedly because I have multiple objects, but only size 1 of the data arrays. I have pasted my series structure below. Is there a way I can keep this structure while also getting the separate x axis labels? I would prefer to not have to put these under the same data object.

Code: Select all

[
    {
      name: 'Avg (1,255,840,752.00)',
      data: [
        {
          name: 'Avg',
          y: 1255840752,
          custom: {
            displayText: '1,255,840,752.00'
          }
        }
      ],
      type: undefined
    },
    {
      name: 'Count (4,799,569,849.00)',
      data: [
        {
          name: 'Count',
          y: 4799569849,
          custom: {
            displayText: '4,799,569,849.00'
          }
        }
      ],
      type: undefined
    },
    {
      name: 'Max (11,473,156.00)',
      data: [
        {
          name: 'Max',
          y: 11473156,
          custom: {
            displayText: '11,473,156.00'
          }
        }
      ],
      type: undefined
    }
  ]
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: X axis labels with Series array

Hello ty2610,

Thanks for contacting us with your question.

You data format must be correct with the one specified in documentation: https://api.highcharts.com/highcharts/series.bar.data
Demo:https://jsfiddle.net/BlackLabel/kpy50tnq/

This is the only way to make your chart work properly, if you data comes in different format you need to parse it.

Let me know if you have any further questions.
Regards!
Mateusz Bernacik
Highcharts Developer
ty2610
Posts: 6
Joined: Wed Jun 30, 2021 2:44 pm

Re: X axis labels with Series array

This isn't really a question about making work, if I take the series object I posted in my first post, and put it over your fiddle, it works just fine.

https://jsfiddle.net/xc2ehdgz/

it's about getting the x axis labels
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: X axis labels with Series array

ty2610,

I thought that all points should be members of a single series. Are X axis labels fine now? They're displayed based on point name. If not, tell me what exactly would you like to change.

Regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Usage”