Closed (outdated)
Project:
Google Chart Tools: Image Charts
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Aug 2008 at 01:12 UTC
Updated:
26 Dec 2019 at 12:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
decibel.places commentedoops, my bad, I meant "Khalid"!
Comment #2
tjholowaychuk commentedhello,
Another user had the same issue, I think the issue may have been closed though ( was quite old ). this was due to the data passed being a single dataset. I didnt have a look at your code but you may need to simply 'nest' the data arrays another level.
http://code.google.com/p/drupal-chart-api/wiki/Examples
in one of those examples I created you will see:
Comment #3
decibel.places commentedYeah I tried that - it will work for multiple data in each array but not for one data in each color... it will only show both bars in the first color
If more than one datapoint is in each array, then the colors sort - but I only want 2 bars (tried making the extra data 0 too...)
tried
CHART_TYPE_BAR_H_GROUPED, CHART_TYPE_BAR_H, $chart['#data_colors']['solo'] = 'ff0000';, $chart['#data_colors'][] = 'ff0000';http://chart.apis.google.com/chart?chd=t%3A55.8%2C28.9&cht=bhg&chs=500x2...
$solopts and $avgpoints are positive integers, in this case 558 and 289 respectively...
Comment #4
iLikeSunshine commentedI'm having the same issue described here - I want to draw a bar chart with the bars colored according to the value of a node property. But, the only color displayed is the first one that I assign to $chart['#data_colors'][X] , where X is any number, or a blank space.
Comment #5
foxtrotcharlie commentedI've figured out that for a normal (non-grouped) bar chart, if the chart colours that are passed in the url are separated by a pipe (|) and not a comma (,) then each bar gets a different colour.
On my site, because I'm only ever using a single bar chart, I hacked the chart.module function chart_build line 280 from:
to:
I haven't tested this code extensively to see if it affects the other graph types (it shouldn't), so take care when using it.
IF this looks like a good solution to the module maintainer(s), then I'm happy to create a patch - let me know, or let me know of a better way of doing this.
Comment #6
decibel.places commented@#5
you are absolutely correct!
replacing the comma in my previous chart url with a pipe produces different colors:
http://chart.apis.google.com/chart?chd=t%3A55.8%2C28.9&cht=bhg&chs=500x200&chtt=flyDollars&chts=6d769f%2C25&chg=10%2C10%2C1%2C1&chco=ff0000|00ff00&chf=bg%2Cs%2CFFFFFF&chxr=0%2C0%2C1000&chxl=1%3A%7C+%7C+%7C+%7C2%3A%7Caverage+%24%7Cmy+%24%7C+&chxt=x%2Cx%2Cy&chxp=&chxs=0%2C000000%2C12%7C1%2C6d769f%2C18%7C2%2C6d769f%2C18&chbh=30%2C5
Comment #7
boombatower commentedIs this still an issue?
Comment #8
decibel.places commented@boombatower
Drupal 5 has been retired; there are more options for creating charts now.
I think it's resolved :)
FWIW I have a Google chart with two bar colors in D6 at http://faiththedog.info/ (it's just Google Charts code in a block)
Comment #9
boombatower commentedI am aware Drupal 5 is retired, but the issue may still exist in this module in 6 or 7.
Thanks for the response.
Comment #10
amagdy commentedthis patch will color each column with different color
Comment #11
mstiThis issue has not been fixed in the latest dev.
The patch at #10 fixes the issue for 6.x-1.3
Comment #12
Pierre.Vriens commentedComment #13
avpadernoI am closing this issue, as Drupal 6 is no longer supported.