chartjs / Chart.js

Simple HTML5 Charts using the <canvas> tag
https://www.chartjs.org/
MIT License
64.26k stars 11.88k forks source link

How do I run this locally ? #189

Closed avinassh closed 9 years ago

avinassh commented 11 years ago

I am not able to figure how do I run this locally. I am new to HTML5, JS, but even the pages in doc directory are also showing the charts. I am not getting what I am missing.

any help regarding this is appreciated.

SimonHFrost commented 11 years ago

Hi awesomo. This doesn't seem like an overly appropriate area for this request, I'd suggest in the future posting it to stack overflow. Ensure that you have the three files index.html, graphing.js and chart.js in the same directory and when you open index.html locally in your browser you should be able to see a graph.

index.html:

<html>
<body>
    <canvas id="myChart" width="800" height="450"></canvas>
    <script type="text/javascript" src="Chart.js"></script>     
    <script type="text/javascript" src="graphing.js"></script>
</body>
</html>

and

graphing.js:

var data = {
labels : ["January","February","March","April","May","June","July"],
datasets : [
    {
        fillColor : "rgba(151,187,205,0.5)",
        strokeColor : "rgba(151,187,205,1)",
        pointColor : "rgba(151,187,205,1)",
        pointStrokeColor : "#fff",
        data : [1,2,3,4,5,6,7]
    }
]
}

var context = document.getElementById("myChart").getContext("2d");
var myNewChart = new Chart(context).Line(data);
fulldecent commented 9 years ago

thank you,

recommending to close issue