Javascript examples for highcharts:Line Chart
set arrows at the end of x-axis and y-axis in line chart
<html> <head> <title>Highcharts Demo</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-compat-git.js"></script> <style id="compiled-css" type="text/css"> .highcharts-axis-line {/*www . ja v a 2s.co m*/ fill: black; stroke-linejoin: round; } </style> <script type="text/javascript"> $(function() { Highcharts.wrap(Highcharts.Axis.prototype, 'getLinePath', function(p, lineWidth) { var linePath = p.call(this, lineWidth); if (this.options.arrowOnEnd) { var arrowFactor = 20, x, y, arrowPath, newPath; if (this.horiz) { x = linePath[4] = linePath[4] - arrowFactor; y = linePath[5]; arrowPath = [ 'L', x - 0.35 * arrowFactor, y - 0.35 * arrowFactor, 'L', x + 1 * arrowFactor, y, 'L', x - 0.35 * arrowFactor, y + 0.35 * arrowFactor, 'L', x, y ]; newPath = linePath.concat(arrowPath); } else { x = linePath[1]; y = linePath[2] = linePath[2]; // + arrowFactor; arrowPath = [ 'M', x, y, 'L', x - 0.35 * arrowFactor, y + 0.35 * arrowFactor, 'L', x, y - 1 * arrowFactor, 'L', x + 0.35 * arrowFactor, y + 0.35 * arrowFactor, 'L', x, y ]; newPath = arrowPath.concat(linePath); } return newPath; } return linePath; }); Highcharts.chart('container', { yAxis: { lineWidth: 1, lineColor: 'black', arrowOnEnd: true }, xAxis: { arrowOnEnd: true, lineColor: 'black' }, series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] }); }); </script> </head> <body> <script src="https://code.highcharts.com/highcharts.src.js"></script> <div id="container" style="height: 400px"></div> </body> </html>