Page 1 of 1

TeeChart - Legend Location and Size

Posted: Fri Sep 22, 2006 11:00 am
by 9788742
Hi

In our application we are dependent on the legend location and size to position certain things on the graph.

We find that the legend location / size is not consitent. Sometimes we get correct values, sometimes its incorrect.

we use the following call :

chart.Legend.Left
chart.Legend.Top

To compute the
width = chart.Legend.Right - chart.Legend.Left
height = chart.Legend.Bottom - chart.Legend.Top

Please advise on how to ensure that the legend location/size is correct with tee chart.

Thanks

Posted: Fri Sep 22, 2006 11:58 am
by narcis
Hi Lakshmi,

It could be that some of the times when you use this calls legend hasn't been painted yet and thus those properties don't have valid values. To solve that you can try a couple of options:

1. Making those calls in TeeChart's AfterDraw event.
2. Before making those calls make the one below to force the chart being internally painted.

Code: Select all

Bitmap bmp = tChart1.Bitmap;
You can also combine both options setting everything you want, calling Bitmap and putting the legend related code in the AfterDraw event.