Left axis as a table
author(s): Lars Cabrera
by jpeter06
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>
<button onclick="getVisible()">
getVisible
</button>
<button id="add" data-id="comienzo">Add 10%</button>
CSS
#container {
max-width: 1200px;
min-width: 800px;
height: 400px;
margin: 1em auto;
}
.scrolling-container {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
JavaScript
var chart = Highcharts.ganttChart('container', {
chart: {
events: {
load() {
const chart = this,
points = chart.series[0].points;
points.forEach(point => {
if (point.id === 'comienzo2' || point.id === 'run') {
point.update({
color: 'red'
})
}
})
}
}
},
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.'
}
}
},
navigator: {
enabled: true
},
plotOptions: {
series: {
point: {
events: {
click: function(e) {
console.log('clicked:',e)
}
}
}
}
},
accessibility: {
point: {
descriptionFormatter: function (point) {
var dependency = point.dependency &&
point.series.chart.get(point.dependency).name,
dependsOn = dependency ? ' Depends on ' + dependency + '.' : '';
return Highcharts.format(
'{point.yCategory}. Start {point.x:%Y-%m-%d}, end {point.x2:%Y-%m-%d}.{dependsOn}',
{ point, dependsOn }
);
}
}
},
xAxis: {
tickPixelInterval: 70
},
yAxis2: {
type: 'category',
grid: {
enabled: true,
borderColor: 'rgba(0,0,0,0.3)',
borderWidth: 1,
columns: [{
title: {
text: 'Project'
},
labels: {
format: '{point.name}'
}
}, {
title: {
text: 'Assignee'
},
...