Left axis as a table
author(s):
Lars Cabrera
by esantiagovieira
HTML
<script src="https://code.highcharts.com/gantt/highcharts-gantt.js"></script>
<script src="https://code.highcharts.com/gantt/modules/exporting.js"></script>
<script src="https://code.highcharts.com/gantt/modules/accessibility.js"></script>
<div class="scrolling-container">
<div id="container"></div>
</div>
CSS
#container {
max-width: 1200px;
min-width: 800px;
height: 400px;
margin: 1em auto;
}
.scrolling-container {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
JavaScript
Highcharts.ganttChart('container', {
title: {
text: 'Left Axis as Table'
},
lang: {
accessibility: {
axis: {
xAxisDescriptionPlural: 'The chart has a two-part X axis showing time in both week numbers and days.',
yAxisDescriptionSingular: 'The chart has a tabular Y axis showing a data table row for each point.'
}
}
},
accessibility: {
point: {
descriptionFormatter: function (point) {
return Highcharts.format(
point.milestone ?
'{point.name}, milestone for {point.assignee} at {point.x:%Y-%m-%d}.' :
'{point.name}, assigned to {point.assignee} from {point.x:%Y-%m-%d} to {point.x2:%Y-%m-%d}.',
{ point }
);
}
}
},
xAxis: {
tickPixelInterval: 70
},
yAxis: {
uniqueNames: true,
type: 'category',
grid: {
enabled: true,
// borderColor: 'rgba(0,0,0,0.3)',
// borderWidth: 1,
columns: [{
title: {
text: 'Projects'
},
}, {
title: {
text: 'Assignee'
},
labels: {
format: '{point.assignee}'
}
}, {
title: {
text: 'Est. days'
},
labels: {
formatter: function () {
var point = this.point,
days = (1000 * 60 * 60 * 24),
number = (point.x2 - point.x) / days;
return Math.round(number * 100) / 100;
}
}
}, {
labels: {
format: '{point.start:%e. %b}'
},
...