0

我正在使用 jqplot 绘制饼图、条形图和折线图。它在 IE9>= 中工作正常。但它在 IE8 中不起作用。当我同时使用饼图和条形图时,它给了我上述错误。它在 e.jqplot.PieRenderer 的饼图插件中显示错误。阻止此插件条形图后可以正常工作,但不能使用饼图。下面是我的代码。请就此提出建议。

var optionsObj = {
            title: 'Item wise stock',
            animate: !$.jqplot.use_excanvas,
            axes: {
                xaxis: {
                    renderer: $.jqplot.CategoryAxisRenderer,
                    ticks: dates,
                    label: 'Item'
                },
                yaxis: {
                    tickOptions: { showMark: true, formatString: "%d" },
                    padMin: 0,
                    label: 'Stock',
                    angle: -30,
                    labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
                    labelOptions: { fontSize: '11px' }
                }
            },

            grid: {
                drawGridLines: true,        // wether to draw lines across the grid or not.
                gridLineColor: '#cccccc',    // *Color of the grid lines.
                background: '#e6e6e6',      // CSS color spec for background color of grid.
                borderColor: '#999999',     // CSS color spec for border around grid.
                borderWidth: 2.0,           // pixel width of border around grid.
                shadow: true,               // draw a shadow for grid.
                shadowAngle: 45,            // angle of the shadow.  Clockwise from x axis.
                shadowOffset: 1.5,          // offset from the line of the shadow.
                shadowWidth: 3,             // width of the stroke for the shadow.
                shadowDepth: 3,             // Number of strokes to make when drawing shadow.
                // Each stroke offset by shadowOffset from the last.
                shadowAlpha: 0.07,           // Opacity of the shadow
                renderer: $.jqplot.CanvasGridRenderer,  // renderer to use to draw the grid.
                rendererOptions: {}         // options to pass to the renderer.  Note, the default
                // CanvasGridRenderer takes no additional options.
            },

            series: [
                { label: 'Bar', renderer: $.jqplot.BarRenderer },
                { label: 'Line', renderer: $.jqplot.LineRenderer, color: '#ef8c08' },
                ],

            legend: {
                show: true,
                location: 'ne'
            },
            seriesDefaults: {
                shadow: false,
                rendererOptions: {
                    barPadding: 0,
                    barMargin: 10,
                    barWidth: 25,
                    highlightMouseDown: true
                }
            },
            highlighter: {
                show: true,
                sizeAdjust: 7.5,
                tooltipContentEditor: function (str, seriesIndex, pointIndex, jqPlot) {

                    return '<table class="jqplot-highlighter"><tr><td>Item:</td><td>' + data[pointIndex][0].toString() + '</td></tr>  \
                     <tr><td>Stock:</td><td>' + data[pointIndex][1].toString() + '</td></tr></table>'

                }

            }
        };

        var plot2 = $.jqplot(location, values, optionsObj);
4

1 回答 1

1

在您的 html 页面中包含此标记:

<script type='text/javascript' src="excanvas.js"></script>

IE8 需要 excanvas 库来创建画布元素,因为 IE8 不支持画布元素。

您可以从这里下载 js 文件:Excanvas 库

于 2013-10-28T00:56:54.070 回答