Closed rubymaniac closed 12 years ago
I am closing this pull request because I have to investigate further and (as you've said) write some tests. I wasn't talking about changing the colors in same stacked bars (this works as you've pointed out) but changing the colors in different bars does not work. For example check this out
Gchart.bar(data: [100,200], horizontal: true, bar_colors: ['cccccc','b3e092'], title: "test", title_size: "12", legend: ['first','second'], size: '260x100', encoding: 'text')
This does not produce two different colors. Try this now
Gchart.bar(data: [100,200], horizontal: true, bar_colors: ['cccccc','b3e092'].join("|"), title: "test", title_size: "12", legend: ['first','second'], size: '260x100', encoding: 'text')
and see that it does produces different colors in different bars. To sum up what we need here is to check if the data is a 2D array and keep the current format of the bar colors else if data is an 1D array join the colors with |
I didn't find this change in documentation. Please add test(s) for your commit.
Also this code
Gchart.bar( :data => [[-10], [100]], :encoding => 'text', :horizontal => true, :min_value => -20, :max_value => 100, :axis_with_labels => 'x', :bar_colors =>['FD9A3B', '4BC7DC'])
generates bars with different colors