No matter what I select, the label for my x-axis is just 0, 1, 2, etc...

I'm using an aggregate view, I don't know if that helps the debug process. I'll take a look at the code myself and see if I can find a fix.

Comments

terbs’s picture

Confirming that the aggregation has nothing to do with the inability to set the label. I made a basic view of comments per node. Setting node title as the x-axis label is not possible. Using highcharts library 2.1.9

terbs’s picture

I couldn't find anywhere in the module code where the label was actually being passed to the JS, so I figure that piece was just incomplete? dunno?

Anyway, I got my x-axis labels working by putting this chunk of code in views_highcharts_theme.inc around line 96

It's not thoroughly tested.

//Get which field we've set as our label from the options
$label_field = NULL;
$label_field = $vars['options']['x_axis']['dataset_label'];

if($label_field){
  
  //Return all labels based on the view
  $view_rows = $vars['view']->style_plugin->rendered_fields;
  
  $labels = array();
  foreach($view_rows as $key => $row){
  	$labels[] = $row[$label_field];
  }
  
  
  $highcharts_config->xAxis->categories = $labels;
}

somimi’s picture

Thank you!! I've been trying to figure out where the labels were being passed as well, and kept thinking I was just missing something or not understanding the code. I used this snippet and my x-axis labels are finally showing up!

meSte’s picture

Here is working fine, BUT the code suggested in comment #2, conforming to the latest dev (Jan 10th), must be placed at line 71.

Georgique’s picture

Subscribe

Georgique’s picture

Version: 7.x-1.x-dev » 7.x-1.0-alpha5
Status: Active » Fixed

Fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.