/**
* Extend the Axis.getLinePath method in order to visualize breaks with two
* parallel slanted lines. For each break, the slanted lines are inserted into
* the line path.
*/
Highcharts.wrap(
Highcharts.Axis.prototype,
'getLinePath', function (proceed, lineWidth) {
const axis = this,
brokenAxis = axis.brokenAxis,
path = proceed.call(this, lineWidth),
start = path[0];
let x = start[1],
y = start[2];
(brokenAxis.breakArray || []).forEach(function (brk) {
if (brk.to <= axis.min || brk.from >= axis.max) {
// Skip breaks outside the view.
return;
}
if (axis.horiz) {
x = axis.toPixels(brk.from);
path.splice(
1, 0,
['L', x - 4, y], // stop
['M', x - 9, y + 5],
['L', x + 1, y - 5], // left slanted line
['M', x - 1, y + 5],
['L', x + 9, y - 5], // higher slanted line
['M', x + 4, y]
);
} else {
y = axis.toPixels(brk.from);
path.splice(
1, 0,
['L', x, y - 4], // stop
['M', x + 5, y + 1],
['L', x - 5, y - 9], // lower slanted line
['M', x + 5, y + 9],
['L', x - 5, y - 1], // higher slanted line
['M', x, y + 4]
);
}
});
return path;
}
);
(async () => {
const data = await fetch(
'https://demo-live-data.highcharts.com/aapl-c.json'
).then(response => response.json());
data[data.length - 10][1] *= 1.3;
// Create the chart
Highcharts.stockChart('container', {
rangeSelector: {
selected: 1
},
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.