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

Message ListMessage List     Post MessagePost Message

  value inside the bar(90degres), not on the top
Posted by Tony on Feb-02-2009 01:42
Have tried Call layer.setAggregateLabelStyle().setFontAngle(90) but that put the value on top og the bar.

Thanks

  Re: value inside the bar(90degres), not on the top
Posted by Peter Kwan on Feb-02-2009 22:04
Hi Tony,

To put the label inside the bar, please use setDataLabelStyle instead of setAggregateLabelStyle. For example:

Call layer.setDataLabelStyle().setFontAngle(90)

Note that by default, if the length of the bar is too short to display the label, the label will not be displayed. If you want to force the label to display, please use BarLayer.setMinLabelSize. For example:

Call layer.setMinLabelSize(0)

Hope this can help.

Regards
Peter Kwan

  Re: value inside the bar(90degres), not on the top
Posted by Tony on Feb-03-2009 06:51
Thanks Peter, It's worked when I remove some other code before this line.

I also tried to center the text and put a unit after the value.
Call layer.setDataLabelStyle("{label} kwh" ).setFontAngle(90)) (Can't see the value + kwh)
I tried to implement setAlignment(cd.Center) without any success.

Thanks
Tony

  Re: value inside the bar(90degres), not on the top
Posted by Peter Kwan on Feb-03-2009 23:45
Hi Tony,

The setDataLabelStyle method, when called without all 4 arguments, sets the font angle to 0. (See the ChartDirector documentation on Layer.setDataLabelStyle for details.) The setFontAngle method then sets the font angle to 90.

The setDataLabelStyle method accepts a font name as the first argument. Since "{label} kwh" is probably not a font name, so its effect is to cause the data label to be drawn using the default font.

To set the label to be like "value + kwh", use:

Call layer.setDataLabelFormat("{value} kwh")

To change the text style (including alignment), please use setDataLabelStyle. For example:

Call layer.setDataLabelStyle("arial.ttf", 8, &H000000, 90).setAlignment(cd.Center)

or

Set t = layer.setDataLabelStyle()
Call t.setFontAngle(90)
Call t.setAlignment(cd.Center)

Hope this can help.

Regards
Peter Kwan