I want to create a highcharts graph where the width increases as data points increase.
Currently, I have:
I am using vuejs with highcharts, but it should work similarly with jquery or other frameworks.
<div class="col-md-6" style="overflow:auto"> //set overflow css
<div id="container_h"></div>
<div>
Here is the script code that renders the highchart:
this.chart = Highcharts.chart('container_h', {
chart: {
type: 'column'
},
credits: {
enabled: false
},
title: {
text: ''
},
xAxis: {
categories: this.ranges
},
yAxis:{
min: 0,
title: {
text: 'Total trucks'
},
stackLabels:{
enabled:true,
style:{
fontWeight: 'bold',
color:(Highcharts.theme && Highcharts.theme.textColor) || 'gray'
}
}
},
tooltip:{
headerFormat:'<b>{point.x}</b><br/>',
pointFormat:'{series.name}: {point.y}<br/>Total: {point.stackTotal}'
},
plotOptions:{
column:{
stacking:'normal',
dataLabels:{
enabled:true,
color:(Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
}
}
},
series:this.chartdata
});
The above code renders a chart like this: https://i.sstatic.net/OXKt2.png
What I want to achieve is to have fixed width columns in the highchart that creates a scroll on the x-axis as they grow. Something like this: https://i.sstatic.net/mHFBm.png
How can I accomplish this?