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

Message ListMessage List     Post MessagePost Message

  Stacked BarLayer with alphabets as data symbol
Posted by Manoj Bhatti on May-14-2012 01:20
Attachments:
Hello Peter,

I need to create a chart that has a stacked bar layer. Instead of regular rectangular bar layer I need to display stacked Alphabets like A, B, C etc in the bar layer. The alphabets represent data in a dataset. What I'm trying to draw is called a 'MarketProfile' chart used in the financial markets. A sample diagram is attached.
It is horizontal bar chart.


Do you think it is possible to perform this stacked barlayer with alphabets in ChartDirector ?

Any comments or suggestions would be greatly appreciated.

Thank you.
Best Regards.

Manoj
mp1.jpg

  Re: Stacked BarLayer with alphabets as data symbol
Posted by Peter Kwan on May-15-2012 04:40
Hi Manoj,

If I were you, I would just plot it as a squence of text labels on the chart using some fixed width font (such as "Courier New").

ChartDirector allows you to use text of different colors in the same text string. For example:

<*color=FF0000*>ABC<*color=00FF00*>DEFG

In this way, you can construct all your bars as text strings.

The next step is to put them on the chart. To do this, simply add a scatter layer to insert transparent symbols at the "base" (the left end) of the bars. This would simply be a sequence of symbols arranged vertically. Then you can add the text strings as the data label of the symbols. In Java/C#, it is like (for a chart that is not XY swapped):

doube[] myDataY = {5, 6, 7, 8, 9, 10, ... };
double[] mydataX = {3, 3, 3, 3, 3, 3, .... };

ScatterLayer layer = c.addScatterLayer(dataX, dataY, "", Chart.SquareSymbol, 1,  Chart.Transparent, Chart.Transparent);
layer.addExtraField(myLabels)
layer.setDataLabelFormat("{field0}");
layer.setDataLabelStyle("Courier New", 10, 0x000000, 0).setAlignment(Chart.Left);

Hope this can help.

Regards
Peter Kwan