Timeline / Schedule In Highcharts
Is there a way to do a timeline / schedule in HighCharts that looks similar to this? https://developers.google.com/chart/interactive/docs/gallery/timeline#an-advanced-example. I fo
Solution 1:
You could enable dataLabels
and set inside
to true
for them. Demo: http://jsfiddle.net/u3eWz/322/
plotOptions: {
columnrange: {
grouping: false,
dataLabels: {
enabled: true,
inside: true,
format: '{point.series.name}'
}
}
},
Another option could be to try Gantt chart. It is being developed, but for your requirements should be working fine already.
Demo: http://jsfiddle.net/o3woh3ye/
var year = 365 * 1000 * 60 * 60 * 24;
// THE CHART
Highcharts.chart('container', {
chart: {
type: 'gantt'
},
title: {
text: 'Gantt Chart'
},
xAxis: [{
type: 'datetime',
tickInterval: year * 5,
labels: {
format: '{value:%Y}',
style: {
fontSize: '15px'
}
},
gridLineWidth: 1,
maxPadding: 0.2
}],
yAxis: [{
categories: ['President', 'Vice President', 'Secretary of State'],
reversed: true,
grid: true
}],
series: [{
showInLegend: false,
dataLabels: {
format: '{point.taskName}'
},
data: [{
start: Date.UTC(1780,0,1),
end: Date.UTC(1788,0,1),
taskGroup: 0,
taskName: 'George Washington'
}, {
start: Date.UTC(1788,0,1),
end: Date.UTC(1794,0,1),
taskName: 'John Adams',
taskGroup: 0
}, {
start: Date.UTC(1770,0,1),
end: Date.UTC(1780,0,1),
taskName: 'John Adams',
taskGroup: 1
}, {
start: Date.UTC(1780,0,1),
end: Date.UTC(1790,0,1),
taskName: 'Name Name',
taskGroup: 2
}]
}]
});
#container {
max-width: 800px;
height: 400px;
margin: 1em auto;
}
<script src="http://github.highcharts.com/highcharts.js"></script>
<script src="http://github.highcharts.com/gantt/modules/gantt.src.js"></script>
<div id="container"></div>
Post a Comment for "Timeline / Schedule In Highcharts"