Reputation: 47
I just want to use a simple chart on my website. I've found chartist.js. I've read http://gionkunz.github.io/chartist-js/getting-started.html
I've looked at the example on: http://jsbin.com/qalewi/edit?html,css,js,output
I'm just unsure how to link the HTML and JS files. I initially created the HTML file and linked a chart.js file which had the code from the example. But when I run it nothing happens.
Thanks
Upvotes: 1
Views: 2821
Reputation: 71
The above code is right.If its not working on your system.Please cut the js file and add this file after div. Kiran
Upvotes: 0
Reputation: 2568
This is the complete html file you need
<html>
<head>
<script src="http://cdn.jsdelivr.net/chartist.js/latest/chartist.min.js"></script>
<link href="http://cdn.jsdelivr.net/chartist.js/latest/chartist.min.css" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Oxygen:300' rel='stylesheet' type='text/css'>
<meta charset="utf-8">
<title>Chartist.js - Simple line chart</title>
</head>
<body>
<div class="ct-chart"></div>
<script>
new Chartist.Line('.ct-chart', {
labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],
series: [
[2, 3, 2, 4, 5],
[0, 2.5, 3, 2, 3],
[1, 2, 2.5, 3.5, 4]
]
}, {
width: 500,
height: 300
});
</script>
</body>
</html>
Upvotes: 5