Highcharts Stock Demo

author(s): Torstein Hønsi

by Fusher

HTML

<div id="container" style="height: 400px; min-width: 400px"></div>

<script src="http://code.highcharts.com/stock/highstock.js"></script>
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
<script type="text/javascript" src="http://www.highcharts.com/samples/data/large-dataset.js"></script>

JavaScript

$(function() {
	var chart = new Highcharts.StockChart({
	    
	    chart: {
	        renderTo: 'container'
	    },
	    
	    rangeSelector: {
	    	selected: 1
	    },
        yAxis: {
            gridLineWidth: 0    
        },
        xAxis: {
            gridLineWidth: 1,
            tickPositioner: function(min, max) {
                return this.series[0].processedXData;
            },
            labels: {
                
                formatter: function() {
                    return Highcharts.dateFormat('%m %Y', this.value);    
                }
            }
        },
	    series: [{
			name: 'Temperature',
			data: temperatures.splice(0, 10),
			pointStart: Date.UTC(2004, 3, 1), // first of April
			pointInterval: 30 * 24 * 3600 * 1000, // monthly data
			tooltip: {
				valueDecimals: 1,
				valueSuffix: '°C'
			}
		}]
	});
});