开发者

JQPlot pie chart throwing "Unable to get value of the property '0': object is null or undefined" error

开发者 https://www.devze.com 2023-03-20 11:04 出处:网络
I\'m using the JQuery based charting library jqPlot (and the pie chart plugin from it) to generate a very basic pie chart.It works fine in FF, etc. but (surprise!) not in IE.In IE it actually loads ok

I'm using the JQuery based charting library jqPlot (and the pie chart plugin from it) to generate a very basic pie chart. It works fine in FF, etc. but (surprise!) not in IE. In IE it actually loads okay and looks fine, but once I roll my mouse over the chart it throws the following error:

Unable to get value of the property '0': object is null or undefined

The way I'm setting everything is very straightforward:

var optionsObj = {
               seriesColors: ['#3399cc', '#cc6666', '#7ba550', '#ffcc66', '#d17314'],
               grid: {
               },
               seriesDefaults: {
                  renderer: $.jqplot.PieRenderer开发者_运维问答,
                  rendererOptions: { lineLabels: true, lineLabelsLineColor: '#777'}
               }
               };

            line1 = [['Coffee', 9],['Beer', 4],['TV', 6],['Lost umbrellas', 2],['Bicycle rides', 10]];
            chart = $.jqplot('pieDiv', [line1], optionsObj);

I should also mention that I'm using the modified pie chart plugin that includes label lines, but I get this problem even when using the regular pie chart plugin. This can be found here: http://blog.statscollector.com/line-labels-for-the-pie-chart-in-jqplot/

Has anyone who has used this library before come across something like this? Any help would be greatly appreciated. Thanks.


Try this

var optionsObj = {
               seriesColors: ['#3399cc', '#cc6666', '#7ba550'],
               grid: {
               },
               seriesDefaults: {
                  renderer: $.jqplot.PieRenderer,
                  rendererOptions: { lineLabels: true, lineLabelsLineColor: '#777'}
               }
               };

            line1 = [['Coffee', 9],['Beer', 4],['TV', 6],['Lost umbrellas', 2],['Bicycle rides', 10]];
            chart = $.jqplot('pieDiv', line1, optionsObj);


Seems like you are missing series colors.Yo have 3 series colors while line 1 has 5 groups.

0

精彩评论

暂无评论...
验证码 换一张
取 消