Javascript examples for highcharts:Line Chart
format x-axis label in line chart
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(function () {//from www. ja va 2s .c o m dateAndTimeArray = ['Feb-10 18:00', 'Feb-10 20:00', 'Feb-10 22:00', 'Feb-12 20:00'], chartData = [93.12, 94.18, 98.72,91.24], $('#container').highcharts({ chart: { zoomType: 'xy', spacingRight: 20 }, credits: { enabled: false }, title: { text: '' }, xAxis: { type: 'datetime', labels: { overflow: 'justify' }, startOnTick: true, showFirstLabel: true, endOnTick: true, showLastLabel: true, categories: dateAndTimeArray, tickInterval: 10, labels: { formatter: function() { return this.value.toString().substring(0, 6); }, rotation: 0.1, align: 'left', step: 10, enabled: true }, style: { fontSize: '8px' } }, yAxis: { title: { text: 'Measurement value' } }, tooltip: { xDateFormat: '%Y-%m-%d %H:%M', shared: true }, legend: { enabled: false }, plotOptions: { area: { fillColor: { linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, stops: [ [0, Highcharts.getOptions().colors[0]], [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')] ] }, lineWidth: 1, marker: { enabled: false }, shadow: false, states: { hover: { lineWidth: 1 } }, // threshold: null } }, series: [{ type: 'line', name: 'Value', data: chartData, marker: { enabled: false } }] }); }); </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: 310px; height: 400px; margin: 0 auto"></div> </body> </html>