should show only days and month, hide milliseconds - Javascript highcharts

Javascript examples for highcharts:Chart Configuration

Description

should show only days and month, hide milliseconds

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <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  .  java2s.c o m*/
    var m_chart_data = []; var u_chart_data = [];
    var d = new Date('03\/05\/14 11:03 AM');
    m_chart_data.push({
       x: d.getTime(),
       y: 1212
    });
    u_chart_data.push({
           x: d.getTime(),
           y: 120
    });
    total_chart_fn(m_chart_data, u_chart_data);
});
function total_chart_fn(m_data, u_data) {
        var tracking_chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                backgroundColor:'#f5f5f5',
                marginLeft: 50,
                borderRadius: 0
            },
            title: {
                text: null
            },
            legend: {
                borderWidth: 0
            },
            xAxis: {
                type: 'datetime',
                dateTimeLabelFormats: {
                  minTickInterval: 24 * 3600 * 1000,
                  millisecond: '%b %e'
                },
                title: {
                    text: null
                }
            },
            yAxis: {
                title: {
                    text: null
                },
                labels: {
                    formatter: function() {
                        return this.value;
                    }
                }
            },
            tooltip: {
                formatter: function() {
                        return '<b>'+ this.y +' '+
                        'at ' + Highcharts.dateFormat('%e %B', this.x);
                }
            },
            exporting: {
                enabled: false
            },
            series: [{
                name: 'N',
                data: u_data
            }, {
                name: 'M',
                data: m_data
            }]
        });
    }

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container" style="height: 400px; width: 500px"></div>  
   </body>
</html>

Related Tutorials