I get this error when I set up a view dataviz with the latest dev version of the module.

Notice: Undefined offset: 1 in views_dataviz_plugin_style_dataviz->render() (line 200 of C:\xampp\htdocs\example\sites\all\modules\views_dataviz\views_dataviz_plugin_style_dataviz.inc).

CommentFileSizeAuthor
#7 views_dataviz-undef_offset-1909350-5.patch823 bytescck

Comments

davapiano’s picture

I get the same error.

vkouroub’s picture

Same here.

vivdrupal’s picture

Same here.

Complete notice is -- depending on the number of records displayed (here 10):

Notice: Undefined offset: 1 in views_dataviz_plugin_style_dataviz->render() (line 200 of /home/content/mysitefolder/sites/all/modules/views_dataviz/views_dataviz_plugin_style_dataviz.inc).
Notice: Undefined offset: 2 in views_dataviz_plugin_style_dataviz->render() (line 200 of /home/content/mysitefolder/sites/all/modules/views_dataviz/views_dataviz_plugin_style_dataviz.inc).
Notice: Undefined offset: 3 in views_dataviz_plugin_style_dataviz->render() (line 200 of /home/content/mysitefolder/sites/all/modules/views_dataviz/views_dataviz_plugin_style_dataviz.inc).
Notice: Undefined offset: 4 in views_dataviz_plugin_style_dataviz->render() (line 200 of /home/content/mysitefolder/sites/all/modules/views_dataviz/views_dataviz_plugin_style_dataviz.inc).
Notice: Undefined offset: 5 in views_dataviz_plugin_style_dataviz->render() (line 200 of /home/content/mysitefolder/sites/all/modules/views_dataviz/views_dataviz_plugin_style_dataviz.inc).
Notice: Undefined offset: 6 in views_dataviz_plugin_style_dataviz->render() (line 200 of /home/content/mysitefolder/sites/all/modules/views_dataviz/views_dataviz_plugin_style_dataviz.inc).
Notice: Undefined offset: 7 in views_dataviz_plugin_style_dataviz->render() (line 200 of /home/content/mysitefolder/sites/all/modules/views_dataviz/views_dataviz_plugin_style_dataviz.inc).
Notice: Undefined offset: 8 in views_dataviz_plugin_style_dataviz->render() (line 200 of /home/content/mysitefolder/sites/all/modules/views_dataviz/views_dataviz_plugin_style_dataviz.inc).
Notice: Undefined offset: 9 in views_dataviz_plugin_style_dataviz->render() (line 200 of /home/content/mysitefolder/sites/all/modules/views_dataviz/views_dataviz_plugin_style_dataviz.inc).
Notice: Undefined offset: 10 in views_dataviz_plugin_style_dataviz->render() (line 200 of /home/content/mysitefolder/sites/all/modules/views_dataviz/views_dataviz_plugin_style_dataviz.inc).

maximpodorov’s picture

The possible fix:

--- views_dataviz_plugin_style_dataviz.inc.orig 2013-03-01 15:12:22.000000000 +0400
+++ views_dataviz_plugin_style_dataviz.inc      2013-03-05 11:11:43.000000000 +0400
@@ -197,7 +197,7 @@
             // Jumping through some hoops to push new values to the beginning of the
             // array instead of to the end. Needed because in views we want values
             // before labels but G Charts wants labels before values.
-            if (!is_array($data[$row_index+1])) $data[$row_index+1] = array();
+            if ((!isset($data[$row_index+1])) || (!is_array($data[$row_index+1]))) $data[$row_index+1] = array();
             array_unshift($data[$row_index+1], ($key === $header) ? $value : floatVal($value)) ;
           }
         }
cck’s picture

Hi, the fix works for me. $data is already an array and initialized with labels a few lines above. I don't see the reason to use is_array(), a check with isset() should be enough.

maximpodorov’s picture

Status: Active » Needs review
cck’s picture

Assigned: Unassigned » cck
StatusFileSize
new823 bytes

Hi, here is the patch based on #5 to review.

everpat’s picture

I applied the fix in #7 and it removed the notices. I will report if anything changes going forward.
Thank you.

cursor’s picture

Status: Needs review » Reviewed & tested by the community
JadH’s picture

I had the same issue.
I applied the patch in #7 and it works.

Anonymous’s picture

Patch #7 works!

Exploratus’s picture

#7 works for me also! Can we get this commited?

annikaC’s picture

+1 on patch in #7!