Javascript examples for highcharts:Area Chart
select a portion of an area chart
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript"> $(function () {// ww w. j a v a2 s . com var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'areaspline' }, title: { text: 'US and USSR nuclear stockpiles' }, subtitle: { text: 'Source: <a href="">'+'your server.com</a>' }, xAxis: { labels: { formatter: function() { return this.value; // clean, unformatted number for year } } }, yAxis: { title: { text: 'Nuclear weapon states' }, labels: { formatter: function() { return this.value / 1000 +'k'; } } }, tooltip: { formatter: function() { if(this.series.name.indexOf("USA") == -1){ return this.series.name +' produced <b>'+ Highcharts.numberFormat(this.y, 0) +'</b><br/>warheads in '+ this.x; } else { return false } } }, plotOptions: { area: { pointStart: 1940, marker: { enabled: false, symbol: 'circle', radius: 2, states: { hover: { enabled: true } } } } }, series: [{ name: 'USA', data: [100, 300, 400, 235, 343, 213, 100 , null , null , 232 , 400, 500 ] }, { name: 'USSR/Russia', data: [null , null , null , null , null , null , 100 , 340, 234, 232 , null , null , null , null ] }] }); }); }); </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" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>