Home › Forums › Chart Support › Y data points do not graph › Reply To: Y data points do not graph
Hi I used the method as mentioned and tried replicating the same in my html, but i get a weird error at the $ajax declaration "Uncaught ReferenceError: $ is not defined "
The code is here
<!DOCTYPE HTML>
<html>
<head>
<script type=”text/javascript”>
window.onload = function () {$.ajax({
url : “http://api.wunderground.com/api/ac7e64a2f6e2d449/history_20130515/q/Ct/Higganum.json”,
dataType : “jsonp”,
success : function (parsed_json) {var y = 0;
var data = [];
var dataSeries = {
type : “line”
};
var dataPoints = [];
var chart = new CanvasJS.Chart(“chartContainer”, {
zoomEnabled : true,
title : {
text : “Zoom And Observe AxisX Labels”,
},
axisX : {
labelAngle : 0,
},
axisY : {
includeZero : true,
},legend : {
horizontalAlign : “right”,
verticalAlign : “center”,
},
data : data, // random generator below});
var data_len = parsed_json.history.observations.length;
for (var i = 0; i < 3; i++) {
dataPoints.push({
x : i,
y : parsed_json.history.observations[i].tempi
});
// dataPoints.push({ x: i, y: 8}); // This works fine
console.log(parsed_json.history.observations[i].tempi);
alert(“hi”);
}
console.log(dataPoints);
dataSeries.dataPoints = dataPoints;
data.push(dataSeries);
chart.render();}
});
}
</script><script type=”text/javascript” src=”D:\Hasan\Node.js\Canvas\canvasjs-1.4.1/canvasjs.min.js”></script>
</head>
<body><div id=”chartContainer4″ style=”height: 300px; width: 100%;”></div>
Hasan
</body>
</html>