首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法获取属性‘renderer’的值:对象为空或未定义: Jqplot

无法获取属性‘renderer’的值:对象为空或未定义: Jqplot
EN

Stack Overflow用户
提问于 2013-10-25 21:26:23
回答 1查看 856关注 0票数 0

我正在使用jqplot来绘制曲线图、条形图和折线图。它在IE9>=中工作得很好。但它在IE8中不起作用。当我同时使用piechart和条形图时,它会给出上述错误。并且它在e.jqplot.PieRenderer‘的piechart插件中显示错误。阻止此插件后,条形图可以正常工作,但不是拼图。下面是我的代码。请在这方面提出建议。

代码语言:javascript
复制
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);
EN

回答 1

Stack Overflow用户

发布于 2013-10-28 08:56:54

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

代码语言:javascript
复制
<script type='text/javascript' src="excanvas.js"></script>

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

您可以从以下位置下载js文件:Excanvas library

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19591183

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档