I want to create a population pyramid with CSV data in highcharts. But the second (right) x-axis is not labeled correctly. Instead of the age groups the Ids of the bars appear. How can I label the right x-axis analogous to the left x-axis?
Jsfiddle: https://jsfiddle.net/martindfurrer/d4r0oxc9/
xAxis: [{
type: 'category',
reversed: false,
title: {
text: 'Age category',
},
}, { // mirror axis on right side
opposite: true,
linkedTo: 0,
type: 'category',
reversed: false,
title: {
text: 'Age category',
},
}],
You need to define which series
belongs to that second xAxis
.
series: [{
name: 'Foreign men',
},
{
name: 'Swiss men',
},
{
name: 'Foreign women',
xAxis: 1
},
{
name: 'Swiss women ',
xAxis: 1
},
],
Demo: https://jsfiddle.net/BlackLabel/rk4bufx7/
API: https://api.highcharts.com/highcharts/series.line.xAxis