charts don't show up in IE 8
See original GitHub issueI get Object doesn't suport this property or method
on this line:
var ctx = sellerGraph.get(0).getContext("2d");
I have included excanvas.
Issue Analytics
- State:
- Created 10 years ago
- Comments:29 (7 by maintainers)
Top Results From Across the Web
Internet Explorer 8 won't display charts and graphs
Internet Explorer 8 won't display charts and graphs.
Read more >javascript - Google chart not displaying in IE 8 - Stack Overflow
The code below displays a stacked bar graph. It works well with Chrome and Firefox. However, IE does not display the chart. I...
Read more >My charts are not showing in Internet Explorer 7 or 8
The most common reason why a chart works in modern browsers, but fails in IE6, 7 and 8, is stray commas in the...
Read more >Chart not showing in IE8 / IE9 but fine in Chrome
You can use the the debugger to show the errors if you aren't seeing them - press F12 in IE to get it...
Read more >PI19492: IE8 DOES NOT DISPLAY CQ CHARTS IN CQ WEB
The issue was seen if the OS locale is set as Japanese, however the issue may not be locale dependent. The issue was...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I know this is long closed, but I wanted to share some insight on this topic in case others needed it. I got chart.js working in IE8 and I had to do several different things to get it working.
Load the excanvas JS lib into your project
<head><script type="PATHTOJSFOLDER/js/excanvas.js"></script></head>
(while you’re at it make sure that the Chart.js lib is properly loaded too)Implement Polyfills Implement 3 different polyfills for functions that are deprecated in legacy IE browsers:
Array.prototype.forEach
forEach JS Page (Scroll down to Polyfill section)Object.keys
Object.keys JS Page (Scroll down to Polyfill section)defineProperties
defineProperties JS Page (Scroll down to Polyfill section)If you don’t want to manually insert the polyfills into your project & you’re lazy like me, polyfills for these functions can be found in the Modernizr JS Library & the lib can be loaded into your project.
Manually Create The Canvas Object Here’s the jquery that I used to render the canvas element inside of a div.
Insert Canvas Object Into Div And the chart was beautifully drawn in IE8 inside of this div (note how ID is referenced in code above, this places the chart’s
</div>`<canvas>
element inside of the DIV): `<div id="event-chart-container">So i did everything what @bvacchiano said and i had to include some more prototypes functions.
Array.prototype.reduce Array.prototype.map
I’m using 2.1.2 like she did and i am assuming here…
/*!
But in line 3769: i get this error that Object.defineProperty is not defined: Because IE8 does not support this. I google it and found out that you cannot define getters and setters in non DOM objects. So you cannot define in Chart object a getter for data.
Object.defineProperty(this, ‘data’, { get: function() { return this.config.data; } });
I actually got it working by simply comment this and add to the controller the property data:
So for future reference for people desperate to make this work in IE8 version 2.1.2 and btw i do know that you shoulnt change the API here is my environment.
Jquery 1.7 ( I know don’t ask )
Included files in this order ( Important ):
$.import_js(‘Js/moment/moment.js’); <-- Because Chart 2.x uses this btw i not using chart bundle ( important ) - http://momentjs.com/ $.import_js(‘Js/chart/excanvas.js’); ( https://github.com/arv/ExplorerCanvas ) $.import_js(‘Js/chart/ielegacyfunctions.js’); <-- Where i put the compability functions ( Costume made for this purpose only ) - heres the file -> https://drive.google.com/file/d/0BwuW9dMO692cbld2NllNdlYyZlE/view?usp=sharing $.import_js(‘Js/chart/chartjs-deps-legacy.js’); --> ( https://github.com/lynndylanhurley/chartjs-deps-legacy ) $.import_js(‘Js/chart/Chart.js’); <- 2.1.2
Legends in bars will not apear… but i actually do not need them. Tested in Chrome and IE Edge but renders in IE8