Suppressed data label
author(s): Kzoon
by kzoon
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px; width:200px"></div>
JavaScript
(function(H) {
var addEvent = H.addEvent,
arrayMax = H.arrayMax,
defined = H.defined,
extend = H.extend,
format = H.format,
merge = H.merge,
noop = H.noop,
pick = H.pick,
relativeLength = H.relativeLength,
Series = H.Series,
seriesTypes = H.seriesTypes,
stableSort = H.stableSort,
isArray = H.isArray,
splat = H.splat;
H.Series.prototype.alignDataLabel = function(
point,
dataLabel,
options,
alignTo,
isNew
) {
var series = this,
chart = this.chart,
inverted = this.isCartesian && chart.inverted,
enabledDataSorting = this.enabledDataSorting,
plotX = pick(point.dlBox && point.dlBox.centerX,
point.plotX, -9999),
plotY = pick(point.plotY, -9999),
bBox = dataLabel.getBBox(),
rotation = options.rotation,
align = options.align,
isInsidePlot = chart.isInsidePlot(plotX,
Math.round(plotY), {
inverted: inverted,
paneCoordinates: true,
series: series
}),
setStartPos = function(alignOptions) {
if (enabledDataSorting && series.xAxis && !justify) {
series.setDataLabelStartPos(point,
dataLabel,
isNew,
isInsidePlot,
alignOptions);
}
};
var baseline,
normRotation,
negRotation,
rotCorr, // rotation correction
// Math.round for rounding errors (#2683), alignTo to allow column
// labels (#2700)
alignAttr, // the final position;
justify = pick(options.overflow, (enabledDataSorting ? 'none' : 'justify')) === 'justify',
visible = this.visible &&
point.visible !== false &&
(point.series.forceDL ||
(enabledDataSorting && !justify) ||
isInsidePlot ||
(
// If the data label is inside the align box, it is
// enough that parts of the align box is inside the
// plot area (#12370). When stacking, it is always
...