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

Message ListMessage List     Post MessagePost Message

  How To add labels to AreaChart
Posted by soma on Sep-30-2011 09:08
Attachments:
Thank you for your supports.
I'd like to add the items and the values to the AreaChart.
Please see the attached file. Let me know how I can do it .
areaMap.png

  Re: How To add labels to AreaChart
Posted by Peter Kwan on Oct-01-2011 00:45
Hi soma,

I think the easiest method is to add a scatter layer in which the symbols are the position that you want the labels to appear. Then you can attach the labels to the scatter symbols.

For example, in the original "Variable Width Bar Chart" sample code, a bar is added using (in VB/VBScript);

    dataX = Array(currentX, currentX, nextX, nextX)
    dataY = Array(0, data(i), data(i), 0)

    Set layer = c.addAreaLayer(dataY, colors(i), labels(i))
    Call layer.setXData(dataX)

You can insert the following code "before" the above code (to ensure the symbol is on top of the bar):

    Call c.addScatterLayer(Array((currentX + nextX) / 2), Array(data(i) / 2), "", cd.SquareSymbol, 1, cd.Transparent, cd.Transparent).addCustomDataLabel(0, 0, labels(i) & vbLF & data(i), "arialbd.ttf", 8, &H000000).setAlignment(cd.Center)

Hope this can help.

Regards
Peter Kwan

  Re: How To add labels to AreaChart
Posted by soma on Oct-03-2011 11:32
Attachments:
I could create the chart with the labels on each area.
Thank you Mr. Kwan.
areatest.png