After doing log the Left Axis value is overlappping

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Herman
Newbie
Newbie
Posts: 56
Joined: Tue Dec 07, 2004 5:00 am

After doing log the Left Axis value is overlappping

Post by Herman » Wed Feb 08, 2006 2:33 am

I add one fast line series to the chart.
The data for the fast line series is like this:
x[0] = 0; Y[0] = 1500
x[1] = 5; Y[0] = 2000
x[2] = 6; Y[0] = 2500
x[3] = 23; Y[0] = 3000
x[4] = 24; Y[0] = 3500
x[5] = 25; Y[0] = 4000
x[6] = 26; Y[0] = 4500
x[7] = 27; Y[0] = 5000
x[8] = 28; Y[0] = 5500

then set the Left Axis Logartihmic to true. The left axis value is then
overlapping.

In application, i will draw the chart based from the received data.
And user can set logarithmic function true or false.

How to solve?

Thank you

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

Post by Pep » Sun Feb 12, 2006 5:23 pm

Hi Herman,

if you're source code customer you could use a solution one customer send to us :

Code: Select all

I have designed a solution to overcome the overlap of logarithmic axis
labels.
It's far from being perfect but may be useful.

All changes made in teeengine unit


Added a tlist to tchartaxis object in teeengine unit

    FLogLabelPosList : TList;

in create axis
    FLogLabelPosList :=TList.create;

in destroy
    FLogLabelPosList.free;

in Tchartaxis.draw
    FLogLabelPosList.clear; (must be the first line)

in InternalDrawLabel

original line was
    if FLabels then DrawThisLabel(tmp,LabelValue(tmpValue))

I changed it to
    if FLabels then
      Begin
        if Flogarithmic then {check if axis is logarithmic)
        Begin
                drawit:=true;
                for i:=1 to FLogLabelPosList.count do {check if label
overlaps with previous drawn labels}
                Begin
                        if
(tmp<=Integer(FLogLabelPosList[i-1])+Fparentchart.canvas.textheight('1'))
and
                        (tmp>=Integer(FLogLabelPosList[i-1])) then
                        Begin
                                Drawit:=false; {if overlaps do not draw the
label}
                                break;
                        ENd;
                End;
                if drawit then
                Begin
                        FLogLabelPosList.Add(Pointer(tmp)); {add the label
to drawn label list}
                        DrawThisLabel(tmp,LabelValue(tmpValue));
                ENd;
        End
        else
                DrawThisLabel(tmp,LabelValue(tmpValue))
     End;
If not, then a solution will be to use custom labels when the user sets logarithmic to true, displaying only the desired labels.

Post Reply