javascriptinternet-explorer-9flotprotovis

Flot and Internet Explorer 9?


I am just about to choose a chart library for my ASP.NET application.

I had my eye on flot which is also used by stackoverflow. When I go to the flot examples here: http://people.iola.dk/olau/flot/examples/

They look great. But not in IE9. I don't see anything in IE9. If I put my IE9 into IE8 or IE7 mode it works. If I go to the User page here on SO

https://stackoverflow.com/users/22656/jon-skeet?tab=reputation

it works also in IE9. What am I missing? Is there a secret SupportIE9=true switch?

I had a look at protovis as an alternative. http://vis.stanford.edu/protovis/ex/

That looks great in IE9 but if I put the browser into IE7 or IE8 it is depressing again.

Hints? How to make these work or an alternative which works cross-IE-version? Firefox is not in issue. Works with all libraries :)


Solution

  • Get the latest version of flot (currently 0.8.3).

    There are some changes since around version (0.6) that pretain to IE9, specifically, the way IE6-8 support canvas is via a library called excanvas. IE9 now supports canvas natively, so the inclusion of excanvas should only happen if the user doesn't have IE9. The specific change in the subversion repository for flot is this one:

    http://code.google.com/p/flot/source/detail?r=293
    

    An example of the change you need to make is this:

    <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
    

    Becomes this:

    <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->