Basic HTML5 Chart Example - CanvasJS JavaScript Charts

Basic HTML5 Chart Example - CanvasJS JavaScript Charts

by canvasjs

HTML

<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<br/><!-- Just so that JSFiddle's Result label doesn't overlap the Chart -->

<div id="chartContainer" style="height: 360px; width: 100%;"></div>

JavaScript

var chart = new CanvasJS.Chart("chartContainer",
    {
        axisY:{
            valueFormatString:"$#######.00",
        },
        axisX:{
           valueFormatString:"####",
        },
      data: [
      {        
        type: "spline",
        xValueFormatString:"Year ####",
        yValueFormatString:"$#######.00",
        dataPoints: [
        { x: 1910, y: 100000 },
        { x: 1920, y: 51000},
        { x: 1930, y: 160000 },
        { x: 1940, y: 130000 },
        { x: 1950, y: 70000 },
        { x: 1960, y: 110000 },
        { x: 1970, y: 90000 },
        { x: 1980, y: 150000 },
        { x: 1990, y: 140000}
        ]
      }
      ]
    });

    chart.render();