I write the save and load chart by myself. Because there is many more things to be saved in my application.
What property can be affected by allow zoom?
I want to save the things after user doing zooming in a chart.
But I don't know what property to be saved.
Thank you
Herman
TChart Allow zoom
Hi Herman,
it's saved in the Allow property, i.e :
Chart1.Zoom.Allow := true;
it's saved in the Allow property, i.e :
Chart1.Zoom.Allow := true;
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi.
You can use the chart OnZoom event to retrieve zoom rectangle start and end position:
Please note that startpoint and endpoint denote the zooming rectangle start and end point, expressed in screen pixels. If you want real axis values, use chart axis CalcPosPoint method for transformation.
You can use the chart OnZoom event to retrieve zoom rectangle start and end position:
Code: Select all
procedure TForm1.Chart1Zoom(Sender: TObject);
var startpoint, endpoint: TPoint;
begin
startpoint.X := Chart1.Zoom.X0;
startpoint.Y := Chart1.Zoom.Y0;
endpoint.X := Chart1.Zoom.X1;
endpoint.Y := Chart1.Zoom.Y1;
end;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
It still not working. I test like this.
Add samething to chart1 and chart2.
Chart1's allowzoom is set to true.
Then i zoom some part of chart1. Then click apply changes to chart2.
I want it to display the same thing.
Instead of using chart2->Assign(chart1).
I want to know exactly what property effected by allowzoom.
void __fastcall TForm1::Add(Tobject *Sender)
{
int i;
for(i = 0; i < 501; i++)
{
Chart1->Series[0]->AddY(i*10);
Chart2->Series[0]->AddY(i*10);
}
}
void __fastcall TForm1::Apply(TObject *Sender)
{
Chart2->Zoom->X0 = Chart1->Zoom->X0;
Chart2->Zoom->X1 = Chart1->Zoom->X1;
Chart2->Zoom->Y0 = Chart1->Zoom->Y0;
Chart2->Zoom->Y1 = Chart1->Zoom->Y1;
}
Add samething to chart1 and chart2.
Chart1's allowzoom is set to true.
Then i zoom some part of chart1. Then click apply changes to chart2.
I want it to display the same thing.
Instead of using chart2->Assign(chart1).
I want to know exactly what property effected by allowzoom.
void __fastcall TForm1::Add(Tobject *Sender)
{
int i;
for(i = 0; i < 501; i++)
{
Chart1->Series[0]->AddY(i*10);
Chart2->Series[0]->AddY(i*10);
}
}
void __fastcall TForm1::Apply(TObject *Sender)
{
Chart2->Zoom->X0 = Chart1->Zoom->X0;
Chart2->Zoom->X1 = Chart1->Zoom->X1;
Chart2->Zoom->Y0 = Chart1->Zoom->Y0;
Chart2->Zoom->Y1 = Chart1->Zoom->Y1;
}
I have found the property that could possibly affect by allowzoom.
Not so sure...but it does show the things i want.
My sample code is like this:
Chart2->LeftAxis->Automatic = false;
Chart2->LeftAxis->AutomaticMinimum = false;
Chart2->LeftAxis->AutomaticMaximum = false;
Chart2->LeftAxis->Minimum = Chart1->LeftAxis->Minimum;
Chart2->LeftAxis->MinimumOffset = Chart1->LeftAxis->MinimumOffset;
Chart2->LeftAxis->Maximum = Chart1->LeftAxis->Maximum;
Chart2->LeftAxis->MaximumOffset = Chart1->LeftAxis->MaximumOffset;
Chart2->BottomAxis->Automatic = false;
Chart2->BottomAxis->AutomaticMinimum = false;
Chart2->BottomAxis->AutomaticMaximum = false;
Chart2->BottomAxis->Minimum = Chart1->BottomAxis->Minimum;
Chart2->BottomAxis->MinimumOffset = Chart1->BottomAxis->MinimumOffset;
Chart2->BottomAxis->Maximum = Chart1->BottomAxis->Maximum;
Chart2->BottomAxis->MaximumOffset = Chart1->BottomAxis->MaximumOffset;
Not so sure...but it does show the things i want.
My sample code is like this:
Chart2->LeftAxis->Automatic = false;
Chart2->LeftAxis->AutomaticMinimum = false;
Chart2->LeftAxis->AutomaticMaximum = false;
Chart2->LeftAxis->Minimum = Chart1->LeftAxis->Minimum;
Chart2->LeftAxis->MinimumOffset = Chart1->LeftAxis->MinimumOffset;
Chart2->LeftAxis->Maximum = Chart1->LeftAxis->Maximum;
Chart2->LeftAxis->MaximumOffset = Chart1->LeftAxis->MaximumOffset;
Chart2->BottomAxis->Automatic = false;
Chart2->BottomAxis->AutomaticMinimum = false;
Chart2->BottomAxis->AutomaticMaximum = false;
Chart2->BottomAxis->Minimum = Chart1->BottomAxis->Minimum;
Chart2->BottomAxis->MinimumOffset = Chart1->BottomAxis->MinimumOffset;
Chart2->BottomAxis->Maximum = Chart1->BottomAxis->Maximum;
Chart2->BottomAxis->MaximumOffset = Chart1->BottomAxis->MaximumOffset;
Hi, Herman.
Yes. Zooming and scrolling ulitmately only changes axis scales (explained in TeeChart VCL FAQ, see this link).
When you're zooming or scrolling chart the end result is chart axis minimum and maximum values will change. So, if you know axis ranges (minimum and maximum values), you can copy these properties to second chart and you'll get a synchronized zoom.
Yes. Zooming and scrolling ulitmately only changes axis scales (explained in TeeChart VCL FAQ, see this link).
When you're zooming or scrolling chart the end result is chart axis minimum and maximum values will change. So, if you know axis ranges (minimum and maximum values), you can copy these properties to second chart and you'll get a synchronized zoom.
Marjan Slatinek,
http://www.steema.com
http://www.steema.com