Chapter 2: Accessing Axis Data Type (1)

Time as string in categories in x-axis

HTML

<script type="text/javascript" src="http://code.highcharts.com/highcharts.js"></script>
<body>
<div style="margin: 5px 60px 5px 5px; " id='container'></div>
</body>

JavaScript

var chart;
    $(document).ready(function() {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                type: 'line',
                height: 250,
                spacingRight: 20 
            },
            title: {
                text: 'Market Data: Nasdaq 100'
            },
            subtitle: {
                text: 'May 11, 2012'
            },
            xAxis: {
                categories: [ '9:30 am', '10:00 am', '10:30 am', '11:00 am', '11:30 am', '12:00 pm',
                              '12:30 pm', '1:00 pm', '1:30 pm', '2:00 pm', '2:30 pm',
                              '3:00 pm', '3:30 pm', '4:00 pm' ],
                labels: {
                    step: 3
                }
            },
            yAxis: {
                title: {
                    text: null
                }
            },
            legend: {
                enabled: false
            },
            credits: {
                enabled: false
            },
            series: [{
              
              data: [ 2606.01, 2622.08, 2636.03, 2637.78, 2639.15, 2637.09  ]
            }]
        });
    });