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

Message ListMessage List     Post MessagePost Message

  Positioning datalabel on a line chart
Posted by Paul Finer on Sep-15-2011 17:21
I have a line chart showing 4 datasets and I want to show just the datalabel for the last
datapoint for each line.

I have managed to do this using:
layer.addCustomDataLabel(0,13,"{value}%","arialbd.ttf",9,&h3a9966)
layer.addCustomDataLabel(1,13,"{value}%","arialbd.ttf",9,&hfbff2a)

However I would like to position the labels more the right of the last datapoint and I think
I need to use the SetPos function but I cannot find out how to use it in combination with
addCustomDataLabel.

Is there another way to do this?

Cheers

Paul

  Re: Positioning datalabel on a line chart
Posted by Peter Kwan on Sep-15-2011 19:28
Hi Paul,

The addCustomDataLabel function returns a TextBox object, which you may use to further configure the text. For example:

Dim t As ChartDirector.TextBox = layer.addCustomDataLabel(0,13,"{value}%","arialbd.ttf",9,&h3a9966)

'shift 10 pixels to the right
t.setPos(10, 0)

or

'left-align the text to the data point (which means the left edge of the text is aligned
'with the data point, and therefore the text is to the right of the data point)
t.setAlignment(Chart.Left)

You may also combine the above into 1 line as per VB syntax:

layer.addCustomDataLabel(0,13,"{value}%","arialbd.ttf",9,&h3a9966).setPos(10, 0)

Hope this can help.

Regards
Peter Kwan

  Re: Positioning datalabel on a line chart
Posted by Paul Finer on Sep-15-2011 20:10
Hi Peter

Thanks for the quick reply, everything is working fine now.

Cheers

Paul