Page 1 of 1

GetAxisLabel with Priority ?

Posted: Tue Aug 08, 2006 2:27 pm
by 9333771
Hi,

Let’s start by explaining what I’m doing:

My chart got a variable number of points, the X axis represent the time. The compression factor change at run time. Some dates don’t have point. I can zoom from 30 years of view to 1 day.

So I need to customize the AxisLabel to have a nice display (Indicate New year, name of the month, don’t display the number of the day if I got a lot of points, …)

Then when I resize (make it smaller) the chart, some label disappear (to avoid over write).

My problem is:

The labels that get “erase” first are the more important ones.

How can I specified which label is “more important” so teeChart don’t erase them ?

Do you have a system with “Main label” and “Sec. label” ?

The workaround I’m using now is ugly: I don’t display 1-2 labels after and before the “important” one. Off course, when the chart is big you see the holes…

Also, I can try to make long calculation with the size of the chart, the position of the label on the axis and the label size. But I will like to avoid this.

I did look for a solution and didn’t found any.

Do you have an idea? Did I miss a magic function of TeeChart?

Thanks in advance,

Posted: Thu Aug 10, 2006 9:56 am
by Pep
Hi Mariano,

well, there's not an automatic way to do this. I'm thinking on two possible solutions :
1) Would be to add all the points setting the "label" parameter the same as the XValue (the datevalue as string), this will make that all the axis label appear (overlapping), and then you can use the OnGetAxisLabel event to hide or specify which labels you don't want o show.

2) Another solution could be to use the "custom axis labels" feature (included into the TeeChart Pri v6 and above) which allow you to add custom axis labels with arbitrary interval. Using this approach you can easily code any axis increment you want. Using this technique will have to add some lines of code but I think it's the better one.
There's an example of use in the Demo Features project.

Posted: Thu Aug 10, 2006 1:34 pm
by 9333771
Hi Pep,

1) Well, That's what i'm actualy doing. I will try to express better myself.
For example:
If the periode is 3 years.
I do have 3 label that indicate the begening of the year. and 3 other that indicate the month JUN. ( a lot of code in GetAxisLabel)
When you resize the chart (it's in a MDI windows), the label that disapear are the NewYear's ones. So i see only "JUN JUN JUN" not very nice...

2) if i understood correctly, the intervall will be a value axis (double). But I need to put a label at some precis point, not at precis interval. And that wont change my problem: The label will disapear the same...

thanks for your answer. But it don't help me. :-\

ba, I was hopping a magic solution. So, look like I will have to make more code lines...

thanks for your help.

Posted: Thu Aug 10, 2006 5:48 pm
by Marjan
Another solution might be to catch axis minimum and maximum value in one of the tChart events (OnZoom event might be a good choice) and use customi axis labels to put labels at specific axis coordinates. For this you can use code similar to custom axis label examples in TC demo (logarithmic labels and custom axis labels examples).