It is currently Mon Dec 11, 2017 5:11 pm Advanced search

xAxis labels not showing proper values

Support and discussion for cloud.highcharts.com.

xAxis labels not showing proper values

Postby RuneS » Wed Nov 29, 2017 11:12 am

Hi

I'm new to Higcharts Cloud, and I have a few difficulties getting started. I have a column chart with percentages on the yAxis and category-style variables on the xAxis. As a default, Highcharts Cloud correctly shows the values as xAxis labels. However, when changing the yAxis format by adding " %" at the end, the xAxis labels suddenly changes to index numbers instead of text values. If I change the yAxis label format through custom code instead of point and click, I can change the yAxis label format without affecting the xAxis label format. I then get the chart to look the way I want it to in Highcharts Cloud (https://cloud.highcharts.com/show/Bkwn5ZjgM).

However, when inserting the inject code into our cms-system (Episerver), the xAxis labels is again replaced by index numers. I tried exporting the code to JSFiddle (https://jsfiddle.net/RuneS/6khjv78n/) and don't get the proper labels to show there either. I can change the format of the labels in the sense that I can, say, add something to the end. So I guess thes syntax is not all wrong, but that I need to figure out why values are not retrieved?
RuneS
 
Posts: 2
Joined: Tue Nov 28, 2017 5:24 pm

Re: xAxis labels not showing proper values

Postby daniel_s » Mon Dec 04, 2017 11:58 am

hi RuneS,

Values of xAxis aren't displayed in the way you expect, because you didn't define xAxis type of your chart, so its returned values are just index numbers by default. You've to specify your xAxis.type equal to 'category', and it should solve your problem. Take a look at code below:
Code: Select all
"xAxis": [{
    "type": "category",
    "labels": {
        "format": "{value}"
     }
}]

Live example: https://jsfiddle.net/c75p9h36/

API Reference: https://api.highcharts.com/highcharts/xAxis.type

Best regards!
Daniel Studencki,
Highcharts Developer
daniel_s
 
Posts: 228
Joined: Fri Sep 01, 2017 1:01 pm

Re: xAxis labels not showing proper values

Postby RuneS » Wed Dec 06, 2017 12:06 pm

Great, that solved it. Thanks a lot:-)
RuneS
 
Posts: 2
Joined: Tue Nov 28, 2017 5:24 pm


Return to Highcharts Cloud

Who is online

Users browsing this forum: No registered users and 0 guests