Skip to content

Instantly share code, notes, and snippets.

@dancek
Created June 19, 2013 12:34
Show Gist options
  • Save dancek/5813942 to your computer and use it in GitHub Desktop.
Save dancek/5813942 to your computer and use it in GitHub Desktop.
Highcharts columnrange with minPointLength support (fix for https://github.com/highslide-software/highcharts.com/issues/1448 )
/**
* The ColumnRangeSeries class
*/
defaultPlotOptions.columnrange = merge(defaultPlotOptions.column, defaultPlotOptions.arearange, {
lineWidth: 1,
pointRange: null
});
/**
* ColumnRangeSeries object
*/
seriesTypes.columnrange = extendClass(seriesTypes.arearange, {
type: 'columnrange',
/**
* Translate data points from raw values x and y to plotX and plotY
*/
translate: function () {
var series = this,
yAxis = series.yAxis,
plotHigh;
colProto.translate.apply(series);
// Set plotLow and plotHigh
each(series.points, function (point) {
var shapeArgs = point.shapeArgs,
options = series.options,
minPointLength = pick(options.minPointLength, 0),
dh;
point.plotHigh = plotHigh = yAxis.translate(point.high, 0, 1, 0, 1);
point.plotLow = point.plotY;
// adjust shape
shapeArgs.y = plotHigh;
shapeArgs.height = point.plotY - plotHigh;
if (shapeArgs.height < minPointLength) {
dh = (minPointLength - shapeArgs.height);
shapeArgs.height += dh;
shapeArgs.y -= dh / 2;
}
});
},
trackerGroups: ['group', 'dataLabels'],
drawGraph: noop,
pointAttrToOptions: colProto.pointAttrToOptions,
drawPoints: colProto.drawPoints,
drawTracker: colProto.drawTracker,
animate: colProto.animate,
getColumnMetrics: colProto.getColumnMetrics
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment