I have been working on chartjs. It works fine in IE10 but when I change the document mode to IE8 it throws the below error
Object doesn't support property or method 'getContext' line.html, line 43 character 2
I tried all the solutions suggested here
I included excanvas.js but no luck.
You can check the demo here , visit this page and change the document mode to IE8. But the parent site works fine when we change browser mode and document mode to IE8. Please help me fix this issue
I have been working on chartjs. It works fine in IE10 but when I change the document mode to IE8 it throws the below error
Object doesn't support property or method 'getContext' line.html, line 43 character 2
I tried all the solutions suggested here
I included excanvas.js but no luck.
You can check the demo here , visit this page and change the document mode to IE8. But the parent site works fine when we change browser mode and document mode to IE8. Please help me fix this issue
Share Improve this question edited Jul 21, 2015 at 3:03 Vignesh Subramanian asked Aug 19, 2013 at 10:14 Vignesh SubramanianVignesh Subramanian 7,30914 gold badges96 silver badges158 bronze badges1 Answer
Reset to default 5in my html i have this in my header
<!--[if lt IE 9]>
<script type="text/javascript" src="../shared/js/excanvas/r73/excanvas.js?v=${BUILD.TAG}"></script>
<![endif]-->
in my html i have this for my body
<!--[if lt IE 9]>
<body class="oldie">
<![endif]-->
<!--[if (gte IE 9)|!(IE)]>
<body>
<!--<![endif]-->
then i use the chart.js like so (with jquery)
var isOldIE = $("body").hasClass("oldie");
var $canvas = this.$element.find("canvas");
var canvas = $canvas[0];
// kick old ie into creating fake canvas straight away
if(isOldIE) {
canvas = G_vmlCanvasManager.initElement(canvas);
}
var chartObj = new Chart(canvas.getContext("2d"));
// do your stuff eg
chartObj.Pie(CHARTJS_DATA, CHARTJS_CONFIG);