Consider the following code as an example:

$chart = array(
      '#chart_id' => 'test_chart',
      '#title' => chart_title(t('Bar Chart'), '0000ee', 15),
      '#type' => CHART_TYPE_BAR_V,
      '#size' => chart_size(400, 200),
      '#grid_lines' => chart_grid_lines(30, 15),
      '#bar_size' => chart_bar_size(15, 5), 
    );
    
  $chart['#data'][] = 40;
  $chart['#data'][] = 60;
  $chart['#data'][] = 20;
  
  $chart['#data_colors'][] = chart_unique_color('test_a');
  $chart['#data_colors'][] = chart_unique_color('test_b');
  $chart['#data_colors'][] = chart_unique_color('test_c');

I expected Three different colors, as in this example.

But the result I got was Only one color for all bars, as in this example.

CommentFileSizeAuthor
#1 chart.module-1169430.patch568 bytestoleillo
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

toleillo’s picture

FileSize
568 bytes

I attached one patch for this issue.

juhaniemi’s picture

Status: Active » Reviewed & tested by the community

#1 fixes the problem, thanks for the patch!

13rac1’s picture

Status: Reviewed & tested by the community » Needs work

Bar charts support both | and , depending on how the colors should be applied. See: http://code.google.com/apis/chart/image/docs/gallery/bar_charts.html#ser...

AccessiveApps’s picture

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

sorry guys ... having the same prob but just wanted to search in 7 dev not 6 dev ... my bad :)

AccessiveApps’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Pierre.Vriens’s picture

Issue summary: View changes
Parent issue: » #2371567: Chart 6.x-2.x Release
Pierre.Vriens’s picture

Pierre.Vriens’s picture

Title: Bar colors don't works in some chart types » Bar colors don't work for some chart types in D6
Issue summary: View changes

I've slightly reformatted the issue description (didn't change the issue details), since I want to start using this issue as a sample issue of how to effectively report issues related to the Chart API, i.e.:

  • Include a code sample.
  • Add an hyperlink with the expected results, and with the returned results.

50% of solving a problem is to understanding the problem, right?

Anyway, thank you Juan (sorry it took 4 years ...) for such a detailed issue (I just slightly reformatted it now).

apaderno’s picture

Status: Needs work » Closed (outdated)
Issue tags: -Google Chart API, -color bars

I am closing this issue, as Drupal 6 is no longer supported.