Javascript examples for highcharts:Line Chart
align bottom of legend to the X axis line for line chart
<html> <head> <title>Highcharts test tool</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-git.js"></script> <style id="compiled-css" type="text/css"> #container {//from w ww.j a v a2s. com min-width: 300px; max-width: 800px; height: 300px; margin: 1em auto; } </style> <script type="text/javascript"> $(function(){ $('#container').highcharts({ chart:{ marginLeft:170, }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, legend: { verticalAlign: 'bottom', floating:true, }, 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] }] }, function(){ //legend var legend = $('#container .highcharts-legend'); var x = legend.position().left; var y = legend.position().top - 20; legend.attr({ transform: 'translate(' + x + ',' + y + ')' }); //title var title = $('#container .highcharts-title'); x = title.position().left-690; y = title.position().top; title.attr({ transform: 'translate(' + x + ',' + y + ')' }); }); }); </script> </head> <body> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <div id="container"></div> </body> </html>