Project Management
author(s):
Jon Arild Nygård
by esantiagovieira
HTML
<script src="https://code.highcharts.com/gantt/highcharts-gantt.js"></script>
<div id="container"></div>
JavaScript
(function(H) {
var isNumber = H.isNumber,
XRangeSeries = H.seriesTypes.xrange;
H.seriesTypes.gantt.prototype.drawPoint = function(point, verb) {
console.log('i am running ', point)
var series = this,
seriesOpts = series.options,
renderer = series.chart.renderer,
shapeArgs = point.shapeArgs,
plotY = point.plotY,
graphic = point.graphic,
state = point.selected && 'select',
cutOff = seriesOpts.stacking && !seriesOpts.borderRadius,
diamondShape;
if (point.options.milestone) {
if (isNumber(plotY) && point.y !== null && point.visible !== false) {
diamondShape = renderer.symbols[point.options.customSymbol](
shapeArgs.x || 0,
shapeArgs.y || 0,
shapeArgs.width || 0,
shapeArgs.height || 0
);
if (graphic) {
graphic[verb]({
d: diamondShape
});
} else {
point.graphic = graphic = renderer.path(diamondShape)
.addClass(point.getClassName(), true)
.add(point.group || series.group);
}
// Presentational
if (!series.chart.styledMode) {
point.graphic
.attr(series.pointAttribs(point, state))
.shadow(seriesOpts.shadow, null, cutOff);
}
} else if (graphic) {
point.graphic = graphic.destroy(); // #1269
}
} else {
XRangeSeries.prototype.drawPoint.call(series, point, verb);
}
};
})(Highcharts)
Highcharts.ganttChart('container', {
series: [{
data: [{
name: 'New offices',
id: 'new_offices',
owner: 'Peter'
}, {
name: 'Inspect building',
id: 'inspect_building',
dependency: 'prepare_building',
parent: 'new_offices',
start: 2,
end: 7,
owner: 'Ivy'
}, {
name: 'Passed inspection',
id: 'passed_inspection',
dependency: 'inspect_building',
parent: 'new_offices',
start: 8,
...