scale problem on bottom axis (overlap)
scale problem on bottom axis (overlap)
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.
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.
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 }
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 }
Pep Jorge
http://support.steema.com
http://support.steema.com
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
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
Pep Jorge
http://support.steema.com
http://support.steema.com
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 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.
Pep Jorge
http://support.steema.com
http://support.steema.com
-
- Newbie
- Posts: 50
- Joined: Wed Mar 10, 2004 5:00 am
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.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've got source code, so if you have a fix you can send me I can build the libraries here.
-
- Newbie
- Posts: 3
- Joined: Fri Nov 15, 2002 12:00 am
- Location: Ann Arbor, MI
- Contact:
bad axis label choice...
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();
}
}
}
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();
}
}
}
-
- Newbie
- Posts: 50
- Joined: Wed Mar 10, 2004 5:00 am
Re: bad axis label choice...
Thanks, Jon, but this doesn't fix my problem. Perhaps I haven't described it well.8576762 wrote:Here is a routine that should help with the axis values (C++ code)...
ChartCartesianAfterDraw is the Event Handler function for OnChartAfterDraw.
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':
And with 'doubled' labels:
I hope someone from Steema will address this problem.
-
- Newbie
- Posts: 50
- Joined: Wed Mar 10, 2004 5:00 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.
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
http://www.steema.com