👍:0
You have to actually call one of the chart types. You have that dataset object declared and initialized but you’re not passing it to anything!
Assuming that’s supposed to be a line chart, you need to call
myNewChart.Line(data);
And you need to fix the problem with the <canvas>
id. Fixed fiddle.
👍:0
<title>ChartJS - Few Chart Examples Using Chart engine Libs</title>
<script src="jquery-2.1.4.min.js"></script>
<script src="Chart.js"></script>
</head>
<body>
<p>Line<br/>Pie<br/>Radar_Chart <br/> using chartJS libs <br/> <bl/> To display uncomment the drawing line in Index.html</p>
<canvas id="mycanvas" width="256" height="356"> </canvas>
<canvas id="mycanvas2" width="956" height="356"> </canvas>
<script>
$(document).ready(function(){
var ctx = $("#mycanvas").get(0).getContext("2d");
var ctx = document.getElementById("mycanvas2").getContext("2d");
var myLineChart = new Chart(ctx);
var datas = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
//gray with red circle
label: "My First dataset",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "red",
pointHighlightFill: "red",
pointHighlightStroke: "rgba(220,220,220,1)",
data: [16,25,13,12,45,16,56,16,75]
},
{
//blue progress/line
label: "My Second dataset",
fillColor: "rgba(151,187,205,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [6,5,43,2,45,6,76,76,45]
}
]
};
var myLineChart = new Chart(ctx).Line(datas);