Question

I am using jqPlot to draw some simple line charts and it works great in Chrome. But in every version of IE (including 9) the jqPlot-plugins are not working. I've tried the pointLabels, dateAxisRenderer and highlighter plugin but they don't have any effect.

My code is pretty much the same as in the examples on the jqPlot site. The only difference I am aware of is that I create the div-element placeholder for the chart dynamically via JavaScript.

That's the code I use to create the chart:

 scurve_chart = $.jqplot('cv', [line1], {
            title: 'distribute costs',
            seriesDefaults: { 
                showMarker:false,
                pointLabels: { show: true, location: 's', ypadding: 3 }
            },
            axes: {
                xaxis: {
                    min: 0.5,
                    tickOptions: {
                        formatString: '%.0f'
                    }
                },
                yaxis: {
                    max: Math.round(max_value_to_dist * 1.10),
                    min: 0,
                    tickOptions: {
                        formatString: '%.0f'
                    }
                }
            }
        });

I use the latest version of jqplot and jquery-1.4.1

//update: Solution

The problem was that I included all plugin-files directly from the jqplot homepage. For example: <script type="text/javascript" src="http://www.jqplot.com/src/plugins/jqplot.dateAxisRenderer.min.js"></script>

It seems like IE does not like it that way.

Was it helpful?

Solution

You omitted to show your includes in the example code you provide - does it draw anything at all in IE or it draws the basic line graph but doesnt use the renderers ?

For IE, you need to include the following line (ensuring the path to excanvas.js is pointed to the same directory that contains your jqplot.js)

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

Also for each plugin, there is another include to be added e.g. for the barrenderer

<script type="text/javascript" src="../plugins/jqplot.barRenderer.min.js">
</script>

again with the correct path specified to the .js file

If you have the paths specified, check they are listed before the tag containing $(document).ready(function() and ensure any .css files are loaded right at the start.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top