Reputation: 119
I trying to use HighCharts to display the number of males and females in the various age groups for 3 cities.
I thought a Bubble chart would be perfect. x-axis: Male, Female y-axis: Age groups (0-10 years, 11-20 years, 21-30 years and above 30) series: the 3 cities bubble size: number of people
The problem is that both x and y axis require numbers for the axis intervals and not text. So I changed my chart data to return 0 & 1 for female and male and numbered each Age Group (where 1 = 0-10 years, 2 = 11-20 years etc.)
Now the chart works fine but off course the axis interval labels are meaningless. Is there a way that I can change the labels to text?
So for the purpose of generating the chart, I can use 0 & 1 but for the interval labels I would like it to display "female" and "male".
I searched quite a bit, but could only find ways to customize the tooltip.
Upvotes: 2
Views: 1149
Reputation: 19093
Without seeing your chart code, it's not easy to say the best way to solve this.
The first option I would look at is using x-axis categories.
An alternative option may be to do this using the axis labelformatter function (http://api.highcharts.com/highcharts#xAxis.labels.formatter).
For your case, you could do something like:
function() {
if (this.value === 1) {
return "female";
} else {
return "male";
}
}
Upvotes: 1