scale problem on bottom axis (overlap)

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Verane
Newbie
Newbie
Posts: 23
Joined: Thu Jan 09, 2003 5:00 am

scale problem on bottom axis (overlap)

Post by Verane » Mon Aug 30, 2004 9:57 am

Hi

What I want to do is to have accuracy on my bottom axis (a lot of ticks and labels), even when I zoom a lot, bot with no overlap.

My problem is the following: if I left bottomAxis.Automatic to true, the minimum increment that I will ever have (even when doing zoom) is 1. This is not accurate enough for me.

So I said to myself that I will put the increment to a value such as 0.00001 for example as I read the following thing in the online help :



“Axis Increment is the minimum step between axis labels. It must be a positive number or DateTime value. TChart will use this value as the starting axis labels step. If there is not enough space for all labels, TChart will calculate a bigger one. You can use the DateTimeStep constant array for DateTime increments.”



I thought this will take the minimum possible increment, in the limit of 0.00001.



This quite works instead in one case: when the minimum and maximum are ‘round numbers’ such a 0 and 5 for example.

I explain myself : If my scale goes from 0 to 5, the result of calcIncrement function is 0.2 (this causes axis overlap…)

But if my scale goes from 0.1 to 5.1, in that case calcIncrement returns 0.5, which is a good value (no overlap).

I see the same problem (axis overlap) if I go exactly from 0 to 3, 0 to 10…

The previous version of the TeeChart that we used before had not this strange behaviour.

Is this a bug or is there a way to have accuracy on the bottom axis even after a zoom, but without axis overlap??



I can send a sample project showing that if needed.


Thanks by advance for your help,

Regards,

Verane.

Verane
Newbie
Newbie
Posts: 23
Joined: Thu Jan 09, 2003 5:00 am

Post by Verane » Fri Sep 03, 2004 8:22 am

Hi all !

Has someone had a look at my problem ? Could you reproduce it ??
Do you need a sample code ??
Is there a work around for me ??

I really need to get rid of this problem very soon...
Thanks by advance for any help.

Verane.

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

Post by Pep » Fri Sep 03, 2004 10:19 am

Hi Verane,

yes, I can see what you refer. You can solve this by setting format for the Axis value, like :
Chart1.Axes.Bottom.AxisValuesFormat := '0.00'; { two digits }

Verane
Newbie
Newbie
Posts: 23
Joined: Thu Jan 09, 2003 5:00 am

Post by Verane » Fri Sep 03, 2004 11:53 am

Hi Pep,

In fact this solves not my problem, as I need a better accuracy than two digits when I zoom on my chart.
With this solution I quickly have only several '3.00' labels (for example) on all my axis.

Verane.

Verane
Newbie
Newbie
Posts: 23
Joined: Thu Jan 09, 2003 5:00 am

Post by Verane » Wed Sep 08, 2004 11:50 am

Hi again,

Do you have any other proposal ?
Do you think this will be corrected in a further version ?

Thanks,
Verane.

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

Post by Pep » Wed Sep 08, 2004 4:49 pm

Hi Verane,

yes, you're correct, the problem is in internal label calculating and drawing routines. Because of the rounding errors sometimes the labels are not setup correctly. We'll try to fix this for next release

Verane
Newbie
Newbie
Posts: 23
Joined: Thu Jan 09, 2003 5:00 am

Post by Verane » Fri Sep 10, 2004 9:18 am

Hi Pep,

Do you have an idea of when this issue will be corrected ? In fact it is very annoying for our customers and I don't see any good workaround for us...

Regards,
Verane.

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

Post by Pep » Fri Sep 10, 2004 11:10 am

Hi Verane,

I'm sorry, I cannot tell you for sure when will be fixed. We'll do all the possible efforts to be fixed for the next maintenance release.
If if find a workaround I'll let you know.

Leroy Casterline
Newbie
Newbie
Posts: 50
Joined: Wed Mar 10, 2004 5:00 am

Post by Leroy Casterline » Tue Feb 08, 2005 12:47 am

Pep wrote:Hi Verane,

I'm sorry, I cannot tell you for sure when will be fixed. We'll do all the possible efforts to be fixed for the next maintenance release.
If if find a workaround I'll let you know.
I'm running into this problem as well, and my customers are complaining. Has this been fixed yet? I've got 7.02 Pro, so it looks like the fix didn't make in into the maintenance release.

I've got source code, so if you have a fix you can send me I can build the libraries here.

Jon Engelbert
Newbie
Newbie
Posts: 3
Joined: Fri Nov 15, 2002 12:00 am
Location: Ann Arbor, MI
Contact:

bad axis label choice...

Post by Jon Engelbert » Wed Feb 09, 2005 10:13 pm

Here is a routine that should help with the axis values (C++ code)...
ChartCartesianAfterDraw is the Event Handler function for OnChartAfterDraw.

void __fastcall TGraphForm::ChartCartesianAfterDraw(TObject *Sender)
{
CheckAxis(Chart1->BottomAxis);
CheckAxis(Chart1->LeftAxis);
}
void TGraphForm::CheckAxis(TChartAxis* Axis)
{
double Max, Min;
double logInc;
int iLogInc;
double Inc;
if (Axis->Increment == 0) {
Inc = Axis->CalcIncrement();
Max = Axis->Maximum;
Min = Axis->Minimum;
if (Inc > (Max - Min)) {
Inc = (Max - Min)/ 5.0;
logInc = log10(Inc);
iLogInc = (int) logInc;
Inc = 1;
if (iLogInc < 0) {
for (int i = iLogInc; i <= 0; i++)
Inc = Inc / 10;
} else if (iLogInc > 0) {
for (int i = 0; i < iLogInc; i++)
Inc = Inc * 10;
}
Axis->Increment = Inc;
Chart1->Repaint();
}
}
}

Leroy Casterline
Newbie
Newbie
Posts: 50
Joined: Wed Mar 10, 2004 5:00 am

Re: bad axis label choice...

Post by Leroy Casterline » Sun Feb 20, 2005 11:00 pm

8576762 wrote:Here is a routine that should help with the axis values (C++ code)...
ChartCartesianAfterDraw is the Event Handler function for OnChartAfterDraw.
Thanks, Jon, but this doesn't fix my problem. Perhaps I haven't described it well.

As I drag-scroll through my chart, periodically the number of vertical grid lines (and thus the number of lavels) doubles. This seems to occur when certain x-axis values fall at the left edge of the chart. Visually, this appears as a flashing while dragging the chart, so most of the time the chart x-axis is displayed 'normally', but the x-axis briefly flashes to twice the normal number of labels while I drag. If I stop dragging at the 'proper' place, the x-axis remains displayed with 'doubled' labels.

When I have the chart set for an appropriate number of vertical labels, the doubling effect causes the labels to overwrite their neighbors. To work around this, I have to display half the number of vertical labels as I'd like so they don't overwrite each other during the time when the labels are doubled.

Here's how my chart displays 'normally':

Image

And with 'doubled' labels:

Image

I hope someone from Steema will address this problem.

Leroy Casterline
Newbie
Newbie
Posts: 50
Joined: Wed Mar 10, 2004 5:00 am

Post by Leroy Casterline » Thu Feb 24, 2005 10:08 pm

Marjan, have you had a chance to look at this?

Leroy Casterline
Newbie
Newbie
Posts: 50
Joined: Wed Mar 10, 2004 5:00 am

Post by Leroy Casterline » Sun Mar 06, 2005 8:14 pm

Please?

Leroy Casterline
Newbie
Newbie
Posts: 50
Joined: Wed Mar 10, 2004 5:00 am

Post by Leroy Casterline » Thu Mar 10, 2005 10:44 pm

Anyone?

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Fri Mar 11, 2005 8:20 am

Hi, Leroy.

Using the latest TeeChart version (7.04) and the code bellow axis label increment value was not changed even when chart was scrolled. The trick is to set LabelsSeparation to 0 and force, regardless of possible overlaps, display of all labels.

Code: Select all

  Series1->FillSampleValues(5000);

  Series1->GetHorizAxis->LabelsSeparation = 0;
  Series1->GetHorizAxis->Increment = 200.0;
  Series1->GetHorizAxis->LabelsOnAxis := true;
  Series1->GetHorizAxis->RoundFirstLabel = true;
Marjan Slatinek,
http://www.steema.com

Post Reply