Create chart from json data - Javascript highcharts

Javascript examples for highcharts:Chart Json Data

Description

Create chart from json data

Demo Code

ResultView the demo in separate window

<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">
var datax=[{"name":"Tokyo","data":[["test",7.0],["test2",6.9]]},{"name":"New York","data":[["test",5.0],["test2",8.9]]}];
$(function () {//from w  ww  . j  a va2  s . c o  m
        $('#container').highcharts({
            title: {
                text: 'Monthly Average Temperature',
                x: -20 //center
            },
            subtitle: {
                text: 'Source: WorldClimate.com',
                x: -20
            },
            xAxis: {
                type: 'category'
            },
            yAxis: {
                title: {
                    text: 'Temperature (?C)'
                },
                plotLines: [{
                    value: 0,
                    width: 1,
                    color: '#808080'
                }]
            },
            tooltip: {
                valueSuffix: '?C'
            },
            legend: {
                layout: 'vertical',
                align: 'right',
                verticalAlign: 'middle',
                borderWidth: 0
            },
            series: datax
        });
    });

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script srchttp: jsfiddle.net gq9m7 1 #run="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>  
   </body>
</html>

Related Tutorials