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

Message ListMessage List     Post MessagePost Message

  How to style a single bar in a stacked bar chart
Posted by Line Wolff on Jul-03-2014 18:27
Attachments:
Hi Peter,

I've been looking all around in the docs and forum for this. Hope you can shed some light on
it.

I'm trying to style a single bar in a stacked bar chart. See attached file for an example (I've
based it on the standard example "Stacked Bar Chart" from the documentation).

What I'd like to achieve is to "highlight" a single stacked bar with either a lower opacity or
an alternate color.

Is this possible, and if so, how?

Thanks, in advance.
chartdir.png

  Re: How to style a single bar in a stacked bar chart
Posted by Peter Kwan on Jul-04-2014 01:08
Hi Line,

You have to use 6 data series for the effect. For example, in C#/Java, it would be like:

double[] data0 = {100, 125, 245, 147, Chart.NoValue};
double[] data1 = {85, 156, 179, 211, Chart.NoValue};
double[] data2 = {97, 87, 56, 267, Chart.NoValue};

double[] lastData0 = {Chart.NoValue, Chart.NoValue, Chart.NoValue, Chart.NoValue, 67};
double[] lastData1 = {Chart.NoValue, Chart.NoValue, Chart.NoValue, Chart.NoValue, 123};
double[] lastData2 = {Chart.NoValue, Chart.NoValue, Chart.NoValue, Chart.NoValue, 157};

BarLayer b = c.addBarLayer2(Chart.Stack);
b.addDataSet(data0, 0xff0000, "AAA");
b.addDataSet(data1, 0xff0000, "NNN");
b.addDataSet(data2, 0xff0000, "QQQ");
b.addDataSet(lastData0, 0xffff00, "Last AAA");
b.addDataSet(lastData1, 0xff00ff, "Last NNN");
b.addDataSet(lastData2, 0x00ffff, "Last QQQ");

Hope this can help.

Regards
Peter Kwan

  Re: How to style a single bar in a stacked bar chart
Posted by Line Wolff on Jul-05-2014 18:43
Thanks, it worked like a charm!