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

Message ListMessage List     Post MessagePost Message

  Labels for waterfall chart
Posted by rahul on May-20-2011 22:54
Can we add two separate labels for top and bottom in waterfall chart?
I want to display top value and bottom value. Is this possible for waterfall and/or candle stick chart?

  Re: Labels for waterfall chart
Posted by Peter Kwan on May-21-2011 03:33
Hi Rahul,

The box-whisker layer (for the waterfall chart) can provide a label for a box. If you need more than 1 label, you can add a transparent layer and associate the label with that layer.

For example, in VB/VBScript:

' Add a multi-color box-whisker layer to represent the waterfall bars
Set layer = c.addBoxWhiskerLayer2(boxTop, boxBottom)

' Put the label on top of the box
Call layer.setDataLabelFormat("{top}")
Call layer.setDataLabelStyle("arialbd.ttf").setAlignment(cd.Bottom)

'Add a transparent layer with labels with the data being the bottom of the box
Set layer = c.addLineLayer(boxBottom, cd.Transparent)
Call layer.setDataLabelFormat("{value}")
Call layer.setDataLabelStyle("arialbd.ttf").setAlignment(cd.Top)

'If your bar starts at 0, the bottom label may go under the x-axis. To avoid this, you may
'set an axis margin, or use XYChart.setClipping to clip the label.
Call c.yAxis().setMargin(0, 15)

Hope this can help.

Regards
Peter Kwan

  Re: Labels for waterfall chart
Posted by Rahul on May-21-2011 03:41
Attachments:
hi Peter, check my attachment I want to display waterfall bars in that format. Is it possible?
Sample.png

  Re: Labels for waterfall chart
Posted by Peter Kwan on May-22-2011 12:33
Hi Rahul,

Yes. Just use the same method as mentioned in my previous message. You may use an extra transparent layer for each label. For the "percentage" label, I assume they are not in your data to be plotted. In this case, they may be added as extra fields.

The code in my previous message already dipslays 2 labels. For the percentage labels, it is like:

'Add a transparent layer with labels with the data being the bottom of the box
Set layer = c.addLineLayer(boxBottom, cd.Transparent)
Call layer.addExtraField(arrayOfValuesToBeDisplayed)
Call layer.setDataLabelFormat("{field0}"%)
Call layer.setDataLabelStyle("arialbd.ttf").setAlignment(cd.Bottom)

'Add a transparent layer with labels with the data being the top of the box
Set layer = c.addLineLayer(boxTop, cd.Transparent)
Call layer.addExtraField(arrayOfValuesToBeDisplayed2)
Call layer.setDataLabelFormat("{field0}"%)
Call layer.setDataLabelStyle("arialbd.ttf").setAlignment(cd.Top)

Hope this can help.

Regards
Peter Kwan