Okay, I've been banging my head against the wall for a couple days here and I feel like I'm not making any progress. Thanks in advance for reading.

Using the latest x.-dev versions of Google Charts API and Views2. This is the only setup that has given me a chart *at all*, so I'm assuming I'm more than halfway there.

I've got a CCK-created node type called "waste report." This is basically 12 decimal fields, plus a nodereference to a content type called "project" and an automatically generated title field. You pick your project from a dropdown of all active projects, type in values into the 12 decimal fields, and you're done. This part is no big deal.

What I'm trying to do is collect all this data into a pie chart. Here's what I've done so far:

I've built a View and called out the 12 decimal fields, as well as the "project" noderef. I group the results by project (eventually using an argument to pull just reports related to certain projects). The default view is just that: unformatted style and a list of fields. I also filter on the node type (waste report).

When I build this as a Views Calc view, it's great, no problem, I get exactly what I'd expect: a nice table showing the sum of each of the 12 decimal fields, properly labeled and grouped by project.

When I build a Google Chart view, I choose my grouping field (Project, no problem), Pie for chart type, enter (and re-enter and re-enter because it doesn't stick) the width and height. Under Legend Field, I HAVE NO IDEA WHAT TO PICK. This is confusing to me because a Legend Field makes no sense at all in the way I've constructed my data. If I choose "Project," I get a huge SQL error:

user warning: Unknown column 'node_data_field_tonnage_nonrecyclable_field_project_nid' in 'order clause' query:

No idea at all what Views is trying to do with this column or where it's getting the name of this column -- you're right, Views, it doesn't exist! It appears to be shoving together the View's first field (field_tonnage_nonrecyclable) adding that node_data_ stuff to the front, the "legend field" (_field_project) to the back, and ending the whole thing with _nid. What is this? What's going on?

So anyway, I want to get at least *something* displaying. The least annoying choice is to pick a field that I know has content -- "general trash" or "gypsum" or whatever I've filled in my sample data I've created. Again if it comes out empty, I get a big SQL error. I can also choose "node title," but that's even worse (it's an auto-created title that is basically [project] [date] ). In any case, this is totally unsuitable -- every slice of the pie chart comes out labeled "Gypsum" or "University 11/29/11" or whatever. The legend has no bearing on the field being summed and displayed.

So how do I do this via Views? What steps am I missing to just have the CCK field label attached to the label of the values that I'm summing and displaying?

I think anyone who's attempted to use Chart's Views Integration will agree that there is simply not enough documentation to get us through. What I find especially baffling is that in the one video that I found (http://lin-clark.com/blog/turning-cias-data-pretty-pictures-your-site-us...), she has no issues *at all* with the labels simply and automatically applying themselves. So is this a CCK thing? I don't see why it would be, she basically has done exactly what I've done -- created a CCK decimal field and labeled it.

To start, here is the support I would like:

* What is the intended use of the Legend field? I do not understand the instruction to "select a field to aggreagate the results on."

* Why are the pie slices not labeled with the CCK labels like they do, without issue, in Lin's video?

Thank you!

p.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pbeakley’s picture

Update: I've upgraded to Views 3.0-rc2 and that didn't really do anything. The pie is correctly summing and displaying, which is awesome. But the one thing I cannot seem to change, no matter what I do, is change the labels attached to each pie slice -- nor can I opt out of the Legend field.

Attached is how the pie, out of Views3, is appearing. The Legend field is set to "project", but that's just dumb. It is however the only non-data field in the View. Do I need to create an entirely new CCK field called "Legend" or something? I'm totally guessing at this point.

Also note that there is no notice at all beyond or before the value. For whatever reason, the label is not passed from the field to the chart. No idea how to proceed.

EDIT: link to the image here. Don't know how to upload an image to drupal.org -- probably not allowed.

13rac1’s picture

I don't have all the answers, because I've never used 6.x-1.x in production and ViewsCalc isn't available for 7.x-1.x. I can tell you that Linda is using Drupal 7, and the 7.x-1.x branch of chart works well. The primary issue you have may be related to: #1256050: Charts showing nid as value instead of value

pbeakley’s picture

Yeah, I explored that thread before. The issue isn't the value -- that's coming through just fine -- it's the labeling.

I think that, for whatever reason, D7 Fields pass along their labels in a different way than D6 CCK fields.

Kind of dreading moving this project to D7 but I'm testing that now. :-/

pbeakley’s picture

Oh bitter irony. In D7, I get a node count but not an actual value, although the labels are correct. It's exactly the opposite of the D6 problem, which is correct values but incorrect labels.

Utterly baffling because the test values come through just fine in a table.

kropka’s picture

Version: 6.x-1.x-dev » 7.x-1.1

Hi,
Im using newest Google Chart API, Views and Drupal, and i cant add proper label to my chart stats. In views output i have table like that

Label and count that are seperated fields.

Label, Count:
Label1, 12
Label2, 16 itd.

I cant see in chart label Label1 and this value ;/
I want to see one chart with field Label as label in field count.

klucid’s picture

I am having the same issue, but I'm not sure if I'm doing it right.

I have a chart view which I'm attempting to display how many nodes are in each taxonomy term. The terms are counting properly, but it would be great if I could somehow display the term name next to the counted value.

I noticed that the "Field | Settings" links disappear from from views when the format as changed to Chart. Should there be a setting there?

isall’s picture

Same problem, Want to use label on the chart, and these come from a different field. I the table they come out well, But on a chart they are failing. see screenshot attached.
It will be better if we can have setting for legend like in the views-2 version. So that one can set which fields to display on the legend. Thanks in advance.

Anybody’s picture

Same problem here!

Dr_Whut’s picture

Subscribing

ZenLax’s picture

Subscribing

drupov’s picture

Hi,

for me it's also weird. I'm loading two fields in my view, the title and a counter field. The pie chart should be made upon the values of the "counter" field and use the titles as labels, but it's the node id's that get taken for the chart calculation.

When using the 7.x-1.x-dev version the data is coming now from the value of the field, not the node id's anymore. :) But the pie-charts are single colored now and the labels are still missing.

In the views settings there are kind of missing inputs for where the label data should come from or which field should be used for the numeric data.

zhuber’s picture

Status: Active » Needs review
FileSize
2.32 KB

I had the same issue as the other people on this thread, I needed one field to be used as the label and another to be user for the data.
I altered the chart views plugin to accomplish this and I'm submitting the patch here.

FYI, this patch does not interfere with the other 'Append value to label' option. They can both be used (or not used) together.

zhuber’s picture

FileSize
2.69 KB

I forgot to include the default value for the new label field, which causes the new field to be ignored when exporting to features. This new patch includes this line, so please test this newer patch.

Pierre.Vriens’s picture

@pbeakley: thanks for sharing al those details, note the "related issue" I added now.
@zhuber: thanks for the patches, note the "parent" issue I added now.

Let's see how we can get this issue going, ideally fixed!

Pierre.Vriens’s picture