You might have come across a situation when you use jquery.flot.js for graphs ,flot graphs were not generated in IE9 due to the following Javascript Error in "jquery.flot.js" file. While debugging you will get the error like :
"unable to get value of the property "init_" : object is null or undefined ".
In the method ConstuctCanvas(), in place of this snippet:
------------------------------------------------------------------------------
function makeCanvas(width, height)
{
var c = document.createElement('canvas');
c.width = width;
c.height = height;
if ($.browser.msie) // excanvas hack
c = window.G_vmlCanvasManager.initElement(c);
return c;
}
------------------------------------------------------------------------------
Use the following snippet
-------------------------------------------------------------------------------------
function makeCanvas(width, height) {
var c = document.createElement('canvas');
c.width = width;
c.height = height;
if (($.browser.msie) && (( parseInt($.browser.version, 10) ) < 9))
c = window.G_vmlCanvasManager.initElement(c);
return c;
}
---------------------------------------------------------------------
and inside the same ConstructCanvas() method there will be snippet.
-------------------------------------------------------------------------------------
if ($.browser.msie) // excanvas hack
window.G_vmlCanvasManager.init_(document);
-------------------------------------------------------------------------------
Replace the above snippet with the following snippet
------------------------------------------------------------------------------------
if (($.browser.msie) && (( parseInt($.browser.version, 10) ) < 9))
window.G_vmlCanvasManager.init_(document);
--------------------------------------------------------------------------------------
In the above two snippet i have provided, you need to observe only one thing, ie i am checking for the IE browser version.If the browser is 'MicroSoft Internet Explorer' and the browser version is older than 9.
-------------------------------------------------------------------------------
if (($.browser.msie) && (( parseInt($.browser.version, 10) ) < 9))
---------------------------------------------------------------------
This will fix the issue.
Hope this will help
Cheers
-Pradeepa Achar
Comments