Loading string data from table gets parsed as Date - Javascript highcharts

Javascript examples for highcharts:Chart Data

Description

Loading string data from table gets parsed as Date

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/modules/data.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <script src="https://code.highcharts.com/modules/export-data.js"></script> 
      <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> 
      <table id="datatable"> 
         <thead> 
            <tr> 
               <th></th> 
               <th>Jane</th> 
               <th>John</th> 
            </tr> 
         </thead> 
         <tbody> 
            <tr> 
               <th>Base 0</th> 
               <td>3</td> 
               <td>4</td> 
            </tr> 
            <tr> 
               <th>Base 1</th> 
               <td>2</td> 
               <td>0</td> 
            </tr> 
            <tr> 
               <th>Base 2</th> 
               <td>5</td> 
               <td>11</td> 
            </tr> 
            <tr> 
               <th>Base 3</th> 
               <td>1</td> 
               <td>1</td> 
            </tr> 
            <tr> 
               <th>Base 4</th> 
               <td>2</td> 
               <td>4</td> 
            </tr> 
         </tbody> 
      </table> 
      <script type="text/javascript">
Highcharts.chart('container', {
    data: {//  ww  w.  j a  v a 2 s .  c o  m
        table: 'datatable'
    },
    chart: {
        type: 'column'
    },
    title: {
        text: 'Data extracted from a HTML table in the page'
    },
    xAxis: {
       type: 'category'
    },
    yAxis: {
        allowDecimals: false,
        title: {
            text: 'Units'
        }
    },
    tooltip: {
        formatter: function () {
            return '<b>' + this.series.name + '</b><br/>' +
                this.point.y + ' ' + this.point.name.toLowerCase();
        }
    }
});

      </script>  
   </body>
</html>

Related Tutorials