Jquery plugins 无法获取属性的值';渲染器';:对象为null或未定义:Jqplot

Jquery plugins 无法获取属性的值';渲染器';:对象为null或未定义:Jqplot,jquery-plugins,jqplot,Jquery Plugins,Jqplot,我正在使用jqplot绘制柱状图、条形图和折线图。在IE9>=中工作正常。但它在IE8中不起作用。当我同时使用piechart和bar chart时,它给了我上述错误。它在e.jqplot.PieRenderer'的piechart插件中显示错误。阻塞此插件后,条形图可以正常工作,但不能使用图表。下面是我的代码。请对此提出建议 var optionsObj = { title: 'Item wise stock', animate: !$.jqpl

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

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);
var optionsObj={
标题:“项目库存”,
动画:!$.jqplot.use_excanvas,
轴线:{
xaxis:{
渲染器:$.jqplot.CategoryAxisRenderer,
日期,
标签:“项目”
},
亚克斯:{
勾选选项:{showMark:true,格式字符串:“%d”},
padMin:0,
标签:“股票”,
角度:-30,
labelRenderer:$.jqplot.CanvasAxisLabelRenderer,
标签选项:{fontSize:'11px'}
}
},
网格:{
drawGridLines:true,//是否在网格上绘制线。
gridLineColor:“#cccc”,//*网格线的颜色。
背景:'#e6',//网格背景色的CSS颜色规范。
borderColor:“#999999”,//网格周围边框的CSS颜色规范。
borderWidth:2.0,//网格周围边框的像素宽度。
shadow:true,//为网格绘制阴影。
阴影角度:45,//阴影的角度。从x轴顺时针方向。
shadowOffset:1.5,//从阴影线偏移。
阴影宽度:3,//阴影的笔划宽度。
阴影深度:3,//绘制阴影时要进行的笔划数。
//每个笔划从上一个笔划偏移阴影偏移。
shadowAlpha:0.07,//阴影的不透明度
渲染器:$.jqplot.CanvasGridRenderer,//用于绘制网格的渲染器。
RenderOptions:{}//传递给渲染器的选项。注意,默认值为
//CanvasGridRenderer不接受其他选项。
},
系列:[
{标签:'Bar',呈现程序:$.jqplot.BarRenderer},
{label:'Line',renderer:$.jqplot.LineRenderer,颜色:'#ef8c08'},
],
图例:{
秀:没错,
地点:'ne'
},
系列默认值:{
影子:错,
渲染器选项:{
barPadding:0,
利润率:10,
条宽:25,
highlightMouseDown:对
}
},
荧光灯:{
秀:没错,
SizedJust:7.5,
tooltipContentEditor:函数(str、serieIndex、pointIndex、jqPlot){
返回'Item:'+data[pointIndex][0].toString()+'\
股票:'+数据[pointIndex][1].toString()+''
}
}
};
变量plot2=$.jqplot(位置、值、选项Obj);

在html页面中包含此标记:

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

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


你可以从这里下载js文件:

就在我头上,为什么你要同时使用bar和pie呢。我不明白你希望从中得到什么样的输出?这是一个页面上的单独图形。你能将JSFIDLE eaxple作为输出共享吗?确保这是第一个包含的文件。你的错误只是因为这个。我100%肯定,因为我测试了你的代码。