Page 1 of 1

How to draw title of a legend on the right (along a legend)

Posted: Wed Apr 26, 2006 5:18 am
by 9530613
and rotated on 90 degrees. To look like title of axis.

Best regards, Rustam

Posted: Wed Apr 26, 2006 7:44 am
by narcis
Hi Rustam,

To achieve that you'll need to custom draw on TChart's canvas in the OnAfterDraw event by doing something like this:

Code: Select all

Private Sub TChart1_OnAfterDraw()
    X = TChart1.Legend.ShapeBounds.Right + 5
    Y = TChart1.Legend.ShapeBounds.Top + (TChart1.Legend.ShapeBounds.Bottom - TChart1.Legend.ShapeBounds.Top) / 1.5
    TChart1.Canvas.RotateLabel X, Y, "Legend Title", 90
End Sub

Posted: Fri Apr 28, 2006 2:50 pm
by narcis
Hi Rustam,

Using the example I posted in the attachments newsgroup, you can see as the legend symbols change. The legend values doesn't change as they are based on the point labels.