Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It seems like the value of a column is not sent to Google API, but the node id.
When I check the field 'Append value to label', I see 'column name:<nid>', not 'column name:<value>'. The charts do not show any sensible data, since column values are not used.
I created 2 different views: one with integers as columns, another with text. Both have the same problem.
Comment | File | Size | Author |
---|---|---|---|
#28 | screenshot.jpg | 43.03 KB | kimberlydb |
#26 | chart.png | 14.45 KB | mfoda |
#10 | 1256050_10_ showing nid instead of value.patch | 1.36 KB | johnv |
#7 | chart-1256050.patch | 1.69 KB | claudiu.cristea |
Comments
Comment #1
maulik.kamdar CreditAttribution: maulik.kamdar commentedI faced the same problem with Views integration. Developing a chart using Taxonomy Data also sends the 'tid' and not the value. I believe it is due to the use of $row->{$field->field_alias} which returns the value of the 'nid' or the 'tid' for the nodes and taxonomy terms respectively.
The only possible explanation I have arrived is views renames field aliases in $data field as it wants (applying filters, changing the exposed filter values etc.) , and should never be referred in the result directly. This should be changed.
There is a similar issue and ensuing solutions in Views (6.x) #361756: Updating views fields changes field alias names
Comment #2
johnvAnother question regarding this: is the Views-formatter applied before sending data to Google API (which is preferred), or after (in which case the formatter is effectively not used)?
Comment #3
wictdrup CreditAttribution: wictdrup commented+ 1. The same problem. There is a Pie but populated with NIDs instead of fields values.
Comment #4
Ranko CreditAttribution: Ranko commented+1 and in addition I am 100% sure I saw a case where (and am trying to replicate) the output were the labels. Then I did something and now I am getting only nid's.
Comment #5
johnv@Ranko, I'm eager to hear your working solution. The module system_charts gives correct pies, but they are programmed instead of created via the Views UI.
Comment #6
Ranko CreditAttribution: Ranko commented@johnv I wrote inaccurately, somehow I had them show labels only, not the values of them.
Comment #7
claudiu.cristeaThere's a patch. Testing needs.
Comment #8
wictdrup CreditAttribution: wictdrup commentedThe patch has not solved my problem, unfortunately:
Fatal error: Cannot access empty property in ...\www\sites\all\modules\chart\chart_views\views\chart_views_plugin_style_chart.inc on line $chart['#data'][$field->field_alias][] = (int) $row->{$object_key};
When I left for testing purpose only one string from patch $object_key = $field->aliases[$field->real_field]; (the other from patch I have commentar), I got following message:
Notice: Undefined index: ...
Comment #9
johnvComment #10
johnvPatch #7 didn't solve my problem. Attached patch does.
It does however use the new views_handler_field_field::get_value() function from Views, so a recent Views-version is required.
Comment #11
13rac1 CreditAttribution: 13rac1 commentedThanks! Do you know the specific Views version, so it can be documented?
Comment #12
johnvWell, my version stems from 2011-04-16, and it didn't exist in that version.
Comment #13
13rac1 CreditAttribution: 13rac1 commentedHmm... There isn't a 2011-04-16 release for Views: http://drupal.org/node/38878/release
I found it. Added ::get_value() method to all fields to make it easier for systems like services that need to access raw field data. It should now be much more consistent. - http://drupal.org/node/1192186 for Views 7.x-3.0-rc1
Comment #14
defconjuan CreditAttribution: defconjuan commentedPatch works for me.
Comment #15
paulfield05 CreditAttribution: paulfield05 commentedPatch is worked for me - thanks Johnv
Comment #16
ArchangelGuidz CreditAttribution: ArchangelGuidz commentedPatch works! Hope this gets integrated into the latest build. Thanks!
Comment #17
johnv3 positives ==> RTBC
Comment #18
kmare CreditAttribution: kmare commentedpatch worked for me as well.
Thanks!
Comment #19
13rac1 CreditAttribution: 13rac1 commentedPatch needs to run from module root, not sub-module root. Works correctly otherwise. Committed to 7.x-1.x-dev. Thanks!
Comment #21
mfoda CreditAttribution: mfoda commentedis patch in #10 supposed to work with views 7.x-3.3 and google charts 7.x-1.1?
I just ran the patch but I'm getting a blank page with only the title and no errors, whereas I had the correct pie chart with nid labels before.
Comment #22
mfoda CreditAttribution: mfoda commentedto clarify the charts are being generated as the space is being filled out and the chart title and labels are also showing. However the chart itself is not there. Maybe something went wrong with the color scheme? Just a guess.
Comment #23
mfoda CreditAttribution: mfoda commentedAny ideas? Anyone? I'm nearing launch date for my website and it would make a big difference if I had the charts included. Right now it's a no-go with the nid labels being shown instead of values.
Thanks in advance
Comment #24
johnvMfoda, this issue is closed for a long time, so noone will see this. You should try 1.x,, or choose any of the new chart modules that have been published lately. Good luck!
Comment #25
13rac1 CreditAttribution: 13rac1 commentedmfoda, please use the dev version for now. There are many changes to dev.
Comment #26
mfoda CreditAttribution: mfoda commentedI took your advice and installed the dev version. The new problem I have right now is that no matter what parameters I try with width and height the labels are cut off from the side and not showing completely. See attached picture.
Any ideas how to fix this?
Comment #27
mfoda CreditAttribution: mfoda commentedsorry double post
Comment #28
kimberlydb CreditAttribution: kimberlydb commentedI installed the dev version but I still get the same problem. The nid still appears for all the values in the chart.
Nevermind, was caching the old install, the dev version works.
Comment #28.0
kimberlydb CreditAttribution: kimberlydb commentedcorrecting special char's