I have a highchart chart container in Angular which contains a marker, a line, and an area graph together. I am trying to display the labels in the graphs without a tooltip option. and the labels are displayed on the charts. But I have a few styling issues with the following example I am a bit confused about the label positioning.
Here is the working code.
In the above,
- The marker value is displaying, but the name is not displaying.
- When the graphs come to a smaller value, all the labels will get overlapped and difficult to read. I need to solve this.
- In the area graph, I only need to show the label as left starting as "Band Start" and right end as "Band End", Currently it shows whatever the value gives in the coordinate.(I tried removing the names but it shows like ' : value').
Here is the code snippet I have added to plot the positions.
Highcharts.SVGRenderer.prototype.symbols.connector = function(x, y, w, h, options) {
var anchorX = options && options.anchorX,
anchorY = options && options.anchorY,
path,
yOffset,
lateral = w / 2,
H = Highcharts;
if (H.isNumber(anchorX) && H.isNumber(anchorY)) {
path = ['M', anchorX, anchorY];
// Prefer 45 deg connectors
yOffset = y - anchorY;
if (yOffset < 0) {
yOffset = -h - yOffset;
}
if (yOffset < w) {
lateral = anchorX < x + (w / 2) ? yOffset : w - yOffset;
}
// Anchor below label
if (anchorY > y + h) {
path.push('L', x + lateral, y + h);
// Anchor above label
} else if (anchorY < y) {
path.push('L', x + lateral, y);
// Anchor left of label
} else if (anchorX < x) {
path.push('L', x, y + h / 2);
// Anchor right of label
} else if (anchorX > x + w) {
path.push('L', x + w, y + h / 2);
}
}
return path || [];
};
'{point.name}' + ': ' + '{x}', but there is no defined name for the marker point in the last series. You can add it as below:Live demo: https://jsfiddle.net/BlackLabel/bokyaqxf/