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

Message ListMessage List     Post MessagePost Message

  Create an entry in the Legend that is text only
Posted by Mindee on Jul-25-2009 00:23
I have 3 different symbols on my XYChart and all are labeled as "Monthly Average" Something. Instead of this:

@ Monthly Average A Amount
# Monthly Average B Amount
* Monthly Average C Amount

I would like the legend to say:

Monthly Average:
@ A Amount
# B Amount
* C Amount

I have tried using the addKey Method, but it appears to enforce having a symbol associated with my text.

Any help would be appreciated.

Thank you!
Mindee

  Re: Create an entry in the Legend that is text only
Posted by Peter Kwan on Jul-25-2009 05:11
Hi Mindee,

May be you can consider to simply put a custom text box above the legend box. For example, in VB/VBScript, the code may be like:

'Add legend box at (300, 100)
Set legendBox = c.addLegend(300, 100)
Call legendBox.setBackground(cd.Transparent, cd.Transparent)
Call legendBox.setMargin(5)

'Put a custom text box above (300, 100)
Call c.addText(300, 100, "<*underline=2*>Moving Average", "arialbd.ttf", 10, &H000000, cd.BottomLeft)

Hope this can help.

Regards
Peter Kwan

  Re: Create an entry in the Legend that is text only
Posted by Mindee on Jul-25-2009 06:16
Peter,
This is very helpful and did just what I needed! However,  I have a key that needs to be before my text? i.e.:

^ Overall Score
Monthly Average for:
* Level 1
@ Level 2
# Level 3

Is this possible?

Thank you so much for your assistance!
Mindee

  Re: Create an entry in the Legend that is text only
Posted by Peter Kwan on Jul-27-2009 16:32
Hi Mindee,

One method you can try is:

Call c.addScatterLayer(Nothing, Nothing, "<*xoffset=-16*>Moving Average", cd.SquareShape, 1, cd.Transparent, cd.Transparent)

The above add a scatter layer with no data, so the only effect is to insert an entry in the legend box. The symbol is transparent, so you can only see the text. The text has a <*xoffset=-16*> CDML tag, so it is shift to the left to start at the position originally occupied by the transparent symbol.

Hope this can help.

Regards
Peter Kwan