I had a nasty error when I tried to display PHP CustomField using Views Charts :
warning: reset() expects parameter 1 to be array, boolean given in [...]/sites/all/modules/charts_graphs/apis/charts_graphs_google_charts/charts_graphs_google_charts.class.inc on line 109.

so here are some tips that may help those who may encounter the same problem :

I looked more in both charts_graphs_google_charts.class.inc and views_plugin_style_charts.inc and it appeared that when trying to transform views data from views-centric representation into Standard Charts and Graphs input format ( See L241 function _transform_data($db_rows) in views_plugin_style_charts.inc), no labels where found for PHP CustomField unless you manually add them in $data in the PHP input (Value) of PHP CustomField so basically what I did in each PHP CustomField value :

$value = [something...];
$data->[right_label] = $value;
print $value;

The [right_label] can be retrieved by displaying $fields_x_names (dsm($fields_x_names);) in L265 into views_plugin_style_charts.inc after :


    $fields_x_names = array();    
    $series_full_names = $this->_get_fields(TRUE);
    $x_label_alias_found = FALSE;
    $aliases = array();

    foreach ($views_fields as $idx => $f) {
      $db_alias = $f->field_alias;
      if (in_array($idx, $this->options['views_charts_series_fields'])) {
        $fields_x_names[$db_alias] = $series_full_names[$idx];
      }

      $aliases[$db_alias] = $idx;

      if ((trim($x_label_column) == trim($idx)) && ($x_label_alias_found == FALSE)) {
        $x_label_column = $db_alias;
        $x_label_alias_found = TRUE;
      }
    })

and just like that it worked!

Comments

jonlibrary’s picture

This helped me out. I wasn't getting an error, but the labels weren't displaying. Now they do! Thanks a lot.

jonlibrary’s picture

Issue summary: View changes

Deleting the "("