Closed (outdated)
Project:
Google Chart Tools: Image Charts
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Mar 2008 at 08:44 UTC
Updated:
26 Dec 2019 at 12:57 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mstef commentedMight as well just add to this thread..
Why aren't three different colors showing up...??
Comment #2
mstef commentedTwo more problems..i think these might be on your end..
'#adjust_resolution' => FALSE, (still adjusts resolution)
I noticed line 254 had a problem if ($chart['#adjust_resolution'] === TRUE){
i fixed that and the problem still exists. obviously if i didn't want to adjust resolution i'd leave that out but the chart data is dynamic so i was trying to use...
'#adjust_resolution' => $stats['comments'] != '0' ? TRUE : FALSE,
The problem seems to be in the statement below
elseif ($chart['#adjust_resolution']['#adjust'] = TRUE){
_chart_adjust_resolution($chart['#chart_id'], $chart['#data'], $chart['#adjust_resolution']['#max']);
}
I removed it.
Comment #3
tjholowaychuk commentedHello,
The bar graphs are a little misleading due to Googles different bar graph types. CHART_TYPE_BAR_V and CHART_TYPE_BAR_H both assume that the data sets are being repeated which is why the colors are the same throughout. You will want to use CHART_TYPE_BAR_V_GROUPED or CHART_TYPE_BAR_H_GROUPED.
I will try and document on this issue soon so it is less confusing ( it confuses myself sometimes too haha ).
As for negative numbers many of the chart types do not support displaying negative numbers.
Also in this case you would probably want to use #legends instead of #labels
And your right about the resolution adjustment, I had a typo there, I fix that right away.
Here is my code which is similar to yours there, hopefully this will help a bit, let me know if/when it is working correctly I will document some more examples on the wiki.
Comment #4
mstef commentedThank you for the response. The different colors work now. Using -1, 1 as the range label doesn't work though, as suspected. If you look at the code I pasted, i use a few max()'s to determine the largest value of the three, and then make the range from zero to that. As for negative numbers, I figured the best solution would be to use a handful of if's and make the color red if its negative and green if its positive. If its negative i'd use absolute value to the numbers stay positive. Makes sense I think...
Comment #5
tjholowaychuk commentedHmm the negative range worked for me in the example I posted, displaying -75 -50 - 25 0 25 50 75 etc. Its to bad Google does not support negative values on the bar charts I am surprised they dont yet. Let me know how it goes, open another issue if you need.
Comment #6
iLikeSunshine commentedI have the same issue with the colors. I tried using the V_GROUPED graph type, but then instead of colors malfunctioning, the labels malfunction. I wonder how I can get both labels and colors correctly working on my bar graph...
Comment #7
boombatower commentedIs this still an issue?
Comment #8
boombatower commentedSeems to support this in 6.x and 7.x (which are all that is supported). Please reopen if not the case and change the version.
Comment #9
laken commentedI'm using 6.x-1.3 and found problems in the module regarding negative values. I found several places in _chart_adjust_resolution which assume the values are all positive – in particular, negative values were not getting adjusted at all.
This patch finds the entire range of values in the input data, then adjusts and maps it to the positive range 0 - 100.
I'd appreciate some reviews as I'm new to Chart API and I'm only using a line & bar graph - definitely have not tested extensively but this works well for my case.
N.B. This patch also adds support for bar chart group spacing & margins, unrelated to negative values.
Comment #10
mstef commentedHa it's been three years and there's like 6 patches, and still no commit.
Comment #11
boombatower commentedI'll see if I can get some time to review this and commit.
@mikestefff: feel free to help things along by reviewing. this module just doesn't have a full time maintainer. I volunteered because I wanted to get it caught up, but I don't have the time to maintain long term.
Comment #12
mstef commentedI wasn't pointing fingers out or anything..just saying.. it's funny how people keep submitting variations of the same patch. And I actually just noticed that this isn't the issue that I thought it was.. I thought it was #594202: Division by zero error.
Comment #13
13rac1 commentedCode in #1213796: _chart_adjust_resolution calculation could be used instead of above patch. TBD
Comment #14
Pierre.Vriens commented+1 for #10 ... which is like 4 years ago again. So is it now 7 years?
+1 for #11 ... and thanks for "approving" a few days ago to give me an opportunity to "try" to work on what I suggested in #2368793: Chart 2.0.
+1 for #12 ... note the parent link I added here ...
About #13: can anybody help me on the TBD there?
I want to get "this" issue in status fixed. And for that I first need to figure out which of the about 6 patches (as in #10, haven't counted them) "we" want to continue moving forward with. Any help or suggestions about that might speed up things to reach my goal. While waiting for that: where is George? ... the one from the keynote from Dries at DrupalCon Amsterdam 2014
Comment #15
avpadernoI am closing this issue, as Drupal 6 is no longer supported.