ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  How can I design a Multi-Color-Bar Chart?
Posted by Tony on Jun-25-2015 14:44
Attachments:
Hi,


I want to design a Multi-Bar Chart,
But every bar group are displayed in the different color.(3 data in per item are same
color)
How can I set it that like the example picture?
___ -1.jpg

  Re: How can I design a Multi-Color-Bar Chart?
Posted by Tony on Jun-25-2015 14:49
Programming language: C++(MFC)
Operating system: Win7

  Re: How can I design a Multi-Color-Bar Chart?
Posted by Peter Kwan on Jun-26-2015 03:09
Hi Tony,

May be you can try to use multiple bar layers, with each bar layer handling one color. For
example:

// 3 data sets for the 3 bars in a group
double dataSet0[9];
double dataSet1[9];
double dataSet2[9];

for (int i = 0; i < 9; ++i)
{
   // Prepare the data for the 3 bars at position i
   for (int j = 0; j < 9; ++i)
       dataSet0[j] = dataSet1[j] = dataSet2[j] = Chart::NoValue;

   dataSet0[i] = ... data_value_for_bar0_at_position_i ...;
   dataSet1[i] = ... data_value_for_bar1_at_position_i ...;
   dataSet2[i] = ... data_value_for_bar1_at_position_i ...;

   // Add the 3 bars as a bar layer with color[i]
   BarLayer *layer = c->addBarLayer(Chart::Side);
   layer->addDataSet(DoubleArray(dataSet0, 9), color[i]);
   layer->addDataSet(DoubleArray(dataSet1, 9), color[i]);
   layer->addDataSet(DoubleArray(dataSet2, 9), color[i]);
}

Hope this can help.

Regards
PeteR Kwan