This module is, by far, the most promising charting module in Drupal 7. I would love to see it improved.

One issue is that I cannot set the x-axis of a graph. How can it be done? I have two good integer fields in my view. I would like to show one on the x-axis and the other one on the y-axis. Just like the one on the demo page (finance.performance.gov). On the first graph, the x-axis is set as years (2001, 2002 etc). How can I do it?

Comments

stovak’s picture

Can you give me some more specifics on reproducing this?

Sinan Erdem’s picture

StatusFileSize
new29.65 KB
new37.69 KB
new8.63 KB

Of course.

I have two integer fields "jumpdata" and "period". They are multi-valued fields, but i only use the last integer from each field. I also added node:nid as another field.

I have 8 nodes containing this fields.

So what I have is:

Node 1: jumpdata:14 period:2
Node 2: jumpdata:11 period:3
Node 3: jumpdata:15 period:4
Node 4: jumpdata:3 period:1
Node 5: jumpdata:9 period:1
Node 6: jumpdata:11 period:1
Node 7: jumpdata:9 period:2
Node 8: jumpdata:3 period:0

I actually need jumpdata and period on the y-axis and nid (or any other field, maybe an integer field) on the x-axis. What I get is numbers from 0 to 7 on the x-axis.

I thought "Data labels column" is related but when I change it, nothing changes.

I am attaching my settings and results if you wanna look.

Thanks.

Sinan

Sinan Erdem’s picture

What I observe now is that if I add the "content: title" as a field, it is used as the x-axis values, no matter what I choose as "Data labels column".

If I remove "title" field, then numbers form 0 to 7 is displayed...

DerTobi75’s picture

I have the same problem. I would like to have another field as X-Axis.

Is this possible in any way?

stovak’s picture

I will be working on improving it. I wrote the module for a book coming out. As soon as I finish the book I will be able to devote more time to its development. Will be trying to hit a few of these bugs over Thanksgiving weekend.

Sinan Erdem’s picture

I cannot wait to see this module fully working.

Charts and graphs are very important on many applications and I believe Opencharts is a very good and complete solution. This module is only inches away from giving almost all the things to a views user.

stovak’s picture

I will try to get this into the dev branch in the very near future.

DerTobi75’s picture

@stovak

Could you also add some more settings for the x & y-axis to the view?

yAxis: {
reversed: true
},

and min: and max: would be great.

TIA,

Tobi

stovak’s picture

Yes, this will be in the Dev version soon.

DerTobi75’s picture

Great, can not wait to get it ;) Thank you!

stovak’s picture

Status: Active » Needs review

Lots of updates since this was an issue. Please update to latest DEV and double check to see if this is still an issue.

Alexander_Gurov’s picture

Status: Needs review » Active

Hi, I cant find a way to use any field data for x-axis. Could you please provide some info about how could I make it?

Alexander_Gurov’s picture

Small update:
I created some new option in highchart views plugin in options_form

<?php
$form['x_axis']['x_axis_categories'] = array(
      '#title' => t('x_axis_categories'),
      '#type' => 'radios',
      '#options' => $highcharts_fields,
      '#required' => TRUE,
      '#default_value' => $this->options['x_axis']['x_axis_categories'],
    );
?>

and using it to fill xAxis.categories property in chart objectlike that from views_highcharts.views.inc in preprocess function

<?php
foreach ($vars['view']->result as $row) {
    $array_row = (array) $row;
    $highcharts_config->xAxis->categories[] = $array_row['field_' . $vars['options']['x_axis']['x_axis_categories']][0]['rendered']['#markup'];
  }
?>

Could you please say me what for do you use Data Labels Column ( $form['x_axis']['dataset_label'] )? I just cant find where that option is used in code.

stovak’s picture

Pushed up a fix for x-axis labels in Alpha 4 release.

guillaumev’s picture

Still have issues here, trying to use a taxonomy term name as the X axis label

guillaumev’s picture

Status: Active » Needs review
StatusFileSize
new1.23 KB

Here is an initial patch. It might need some more care, but it works for me...

scottrigby’s picture

Component: Documentation » API

This needs reviews before it will be committed, as I'm not testing the 1.x branch.

In the 7.x-2.x branch this is not a problem, so we could close this issue - but I will keep this open because there is a patch that needs review by someone who uses the 1.x branch.