Axis Title overwritten by Axis Labels

TeeChart for ActiveX, COM and ASP
Post Reply
BWThorp
Newbie
Newbie
Posts: 8
Joined: Fri Apr 02, 2004 5:00 am

Axis Title overwritten by Axis Labels

Post by BWThorp » Tue Feb 01, 2005 7:09 pm

I have some data which just came into our software that happens to have 5 digits in the axis labels (it used to be no more than 4). Apparently, the axis labels are now being drawn over the axis title. Is there a way to increase the size of the margin area where the title is drawn so that this doesn't occur? I would really like this to be automatically calculated. I'm not using any custom axes or anything.

Here is the right side of my graph:

Image

Regards,

Brigg Thorp
Senior Software Engineer
Timex Corporation

Pep
Site Admin
Site Admin
Posts: 3298
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Feb 01, 2005 9:35 pm

Hi Brigg,

yes, you can increase the Axis label size using the following code :

Code: Select all

Private Sub TChart1_OnAfterDraw()
TChart1.Axis.Left.Labels.Size = TChart1.Axis.Left.Labels.MaxWidth
End Sub

BWThorp
Newbie
Newbie
Posts: 8
Joined: Fri Apr 02, 2004 5:00 am

Still having an issue

Post by BWThorp » Wed Feb 02, 2005 2:02 pm

I tried your solution and it only seems to work after I perform a zoom (using the mouse). The initial painting of the graph still has this problem. Is there a way to force the axes labels to update after I have added all the series data to the graph?

I'm also setting the labes.size as mentioned above in my code just after the series data is added. It doesn't seem to update from the OnAfterDraw event. Any additional information you could provide would be very helpful.

Regards,

Brigg Thorp
Senior Software Engineer
Timex Corporation

Pep
Site Admin
Site Admin
Posts: 3298
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Feb 02, 2005 3:43 pm

Hi,

have you tried adding tChart1.Environment.Internal repaint to force to repaint after the Chart has been populated ?

BWThorp
Newbie
Newbie
Posts: 8
Joined: Fri Apr 02, 2004 5:00 am

Works!

Post by BWThorp » Wed Feb 02, 2005 3:47 pm

That did it. Thanks!

Regards,

Brigg Thorp
Senior Software Engineer
Timex Corporation

BWThorp
Newbie
Newbie
Posts: 8
Joined: Fri Apr 02, 2004 5:00 am

Another problem with the axis labels

Post by BWThorp » Tue Feb 08, 2005 6:19 pm

One of our software testers just noticed another issue. If they resize my application, the axis labels change from integers (1,2, 3, etc.) to floating point numbers with one digit (1.5, 2, 2.5, 3, etc.) when there is enough space on the graph to draw them.

When the user resizes my app, I don't redraw the whole graph, because it's a lot of data coming from an Access database.

I tried adding your suggestion to the Form_resize event and it doesn't help. This is the code I used:

Code: Select all

With TChart3
   .Axis.Left.Labels.Size = TChart3.Axis.Left.Labels.MaxWidth
   .Axis.Right.Labels.Size = TChart3.Axis.Right.Labels.MaxWidth
   .Environment.InternalRepaint
   .Repaint
End With
This doesn't seem to help. Is there anything else I need to do to move the axis labels if the labels increase in width?

Pep
Site Admin
Site Admin
Posts: 3298
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Feb 16, 2005 12:58 pm

Hi Brigg,

placing the code in the OnBeforeDrawAxes should do the trick.

Post Reply