I am trying to create charts using jchartfx. I can trying with the example provided.my problem is when I run the HTML directly from the folder. its working and rendering the properly.But when I add that page into visual studio and try to run the app.I am getting the runtime Js Error.
here is my HTML Code
<!DOCTYPE html>
<html>
<head>
<link href="jchartfx.css" rel="stylesheet" />
<script src="jchartfx.system.js"></script>
<script src="jchartfx.coreBasic.js"></script>
</head>
<body onload="loadChart()">
<div id="ChartDiv" style="width: 600px; height: 400px"></div>
<script type="text/javascript" lang="javascript">
var chart1;
function loadChart() {
chart1 = new cfx.Chart();
chart1.getData().setSeries(2);
chart1.getAxisY().setMin(500);
chart1.getAxisY().setMax(2000);
var series1 = chart1.getSeries().getItem(0);
var series2 = chart1.getSeries().getItem(1);
series1.setGallery(cfx.Gallery.Lines);
series2.setGallery(cfx.Gallery.Bar);
var data = [
{ "Month": "Jan", "Bikes": 1800, "Parts": 1300 },
{ "Month": "Feb", "Bikes": 1760, "Parts": 900 },
{ "Month": "Mar", "Bikes": 1740, "Parts": 970 },
{ "Month": "Apr", "Bikes": 1750, "Parts": 1010 },
{ "Month": "May", "Bikes": 1810, "Parts": 1070 },
{ "Month": "Jun", "Bikes": 1920, "Parts": 1180 }
];
chart1.setDataSource(data);
var divHolder = document.getElementById('ChartDiv');
chart1.create(divHolder);
}
</script>
</body>
</html>
Error : Unable to get value of the property 'call': object is null or undefined
Any suggestion on why am getting this?
Update:
I have added <meta content="IE=9" http-equiv="X-UA-Compatible" />
in the head section it is working fine.but it gives the same error when I try to run the view in MVC application.
Is any meta tag will fix this?
Try adding
<meta http-equiv="X-UA-Compatible" content="IE=8" />
tag.