Zoom with mouse don'work properly with left and right axis
Zoom with mouse don'work properly with left and right axis
When a chart has a right and a left axis, if you get a zoom effect with the mouse the right scale is refreshed with the left scale values!!! in the new delphi 2010 version. This is fine in the version 8 and version 9. What's the matter?
Gerard Esposito
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Zoom with mouse don'work properly with left and right axis
Hi Gerard,
This works fine for me here using latest v2010.01.11004 and this code snippet:
Are you using latest v2010 release available? If so, can you please modify the code snippet above or send a simple example project we can run "as-is" so that we can reproduce the problem here?
Thanks in advance.
This works fine for me here using latest v2010.01.11004 and this code snippet:
Code: Select all
uses Series;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.AddSeries(TLineSeries.Create(Self));
Chart1[0].VertAxis:=aBothVertAxis;
Chart1[0].FillSampleValues;
end;
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Zoom with mouse don'work properly with left and right axis
Hi Narcis,
With this simple program
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TeEngine, Series, ExtCtrls, TeeProcs, Chart;
type
TForm1 = class(TForm)
Chart1: TChart;
Series1: TLineSeries;
Series2: TLineSeries;
procedure FormCreate(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(20);
Series2.FillSampleValues(20);
end;
end.
and this simple form:
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 243
ClientWidth = 472
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Chart1: TChart
Left = 0
Top = 0
Width = 472
Height = 243
BackWall.Brush.Gradient.Direction = gdBottomTop
BackWall.Brush.Gradient.EndColor = clWhite
BackWall.Brush.Gradient.StartColor = 15395562
BackWall.Brush.Gradient.Visible = True
BackWall.Transparent = False
Foot.Font.Name = 'Verdana'
Gradient.Direction = gdBottomTop
Gradient.EndColor = clWhite
Gradient.MidColor = 15395562
Gradient.StartColor = 15395562
Gradient.Visible = True
LeftWall.Color = 14745599
Legend.Font.Name = 'Verdana'
RightWall.Color = 14745599
SubFoot.Font.Name = 'Verdana'
SubTitle.Font.Name = 'Verdana'
Title.Font.Name = 'Verdana'
Title.Text.Strings = (
'TChart')
BottomAxis.Axis.Color = 4210752
BottomAxis.Grid.Color = 11119017
BottomAxis.LabelsFont.Name = 'Verdana'
BottomAxis.TicksInner.Color = 11119017
BottomAxis.Title.Font.Name = 'Verdana'
DepthAxis.Axis.Color = 4210752
DepthAxis.Grid.Color = 11119017
DepthAxis.LabelsFont.Name = 'Verdana'
DepthAxis.TicksInner.Color = 11119017
DepthAxis.Title.Font.Name = 'Verdana'
DepthTopAxis.Axis.Color = 4210752
DepthTopAxis.Grid.Color = 11119017
DepthTopAxis.LabelsFont.Name = 'Verdana'
DepthTopAxis.TicksInner.Color = 11119017
DepthTopAxis.Title.Font.Name = 'Verdana'
LeftAxis.Axis.Color = 4210752
LeftAxis.Grid.Color = 11119017
LeftAxis.LabelsFont.Name = 'Verdana'
LeftAxis.TicksInner.Color = 11119017
LeftAxis.Title.Font.Name = 'Verdana'
RightAxis.Axis.Color = 4210752
RightAxis.Grid.Color = 11119017
RightAxis.LabelsFont.Name = 'Verdana'
RightAxis.TicksInner.Color = 11119017
RightAxis.Title.Font.Name = 'Verdana'
TopAxis.Axis.Color = 4210752
TopAxis.Grid.Color = 11119017
TopAxis.LabelsFont.Name = 'Verdana'
TopAxis.TicksInner.Color = 11119017
TopAxis.Title.Font.Name = 'Verdana'
Align = alClient
TabOrder = 0
ColorPaletteIndex = 13
object Series1: TLineSeries
Marks.Arrow.Visible = True
Marks.Callout.Brush.Color = clBlack
Marks.Callout.Arrow.Visible = True
Marks.Visible = False
Pointer.InflateMargins = True
Pointer.Style = psRectangle
Pointer.Visible = False
XValues.Name = 'X'
XValues.Order = loAscending
YValues.Name = 'Y'
YValues.Order = loNone
end
object Series2: TLineSeries
Marks.Arrow.Visible = True
Marks.Callout.Brush.Color = clBlack
Marks.Callout.Arrow.Visible = True
Marks.Visible = False
VertAxis = aRightAxis
Pointer.InflateMargins = True
Pointer.Style = psRectangle
Pointer.Visible = False
XValues.Name = 'X'
XValues.Order = loAscending
YValues.Name = 'Y'
YValues.Order = loNone
end
end
end
the TChart version is v2010.01.11004 win32
Best regards
With this simple program
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TeEngine, Series, ExtCtrls, TeeProcs, Chart;
type
TForm1 = class(TForm)
Chart1: TChart;
Series1: TLineSeries;
Series2: TLineSeries;
procedure FormCreate(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(20);
Series2.FillSampleValues(20);
end;
end.
and this simple form:
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 243
ClientWidth = 472
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Chart1: TChart
Left = 0
Top = 0
Width = 472
Height = 243
BackWall.Brush.Gradient.Direction = gdBottomTop
BackWall.Brush.Gradient.EndColor = clWhite
BackWall.Brush.Gradient.StartColor = 15395562
BackWall.Brush.Gradient.Visible = True
BackWall.Transparent = False
Foot.Font.Name = 'Verdana'
Gradient.Direction = gdBottomTop
Gradient.EndColor = clWhite
Gradient.MidColor = 15395562
Gradient.StartColor = 15395562
Gradient.Visible = True
LeftWall.Color = 14745599
Legend.Font.Name = 'Verdana'
RightWall.Color = 14745599
SubFoot.Font.Name = 'Verdana'
SubTitle.Font.Name = 'Verdana'
Title.Font.Name = 'Verdana'
Title.Text.Strings = (
'TChart')
BottomAxis.Axis.Color = 4210752
BottomAxis.Grid.Color = 11119017
BottomAxis.LabelsFont.Name = 'Verdana'
BottomAxis.TicksInner.Color = 11119017
BottomAxis.Title.Font.Name = 'Verdana'
DepthAxis.Axis.Color = 4210752
DepthAxis.Grid.Color = 11119017
DepthAxis.LabelsFont.Name = 'Verdana'
DepthAxis.TicksInner.Color = 11119017
DepthAxis.Title.Font.Name = 'Verdana'
DepthTopAxis.Axis.Color = 4210752
DepthTopAxis.Grid.Color = 11119017
DepthTopAxis.LabelsFont.Name = 'Verdana'
DepthTopAxis.TicksInner.Color = 11119017
DepthTopAxis.Title.Font.Name = 'Verdana'
LeftAxis.Axis.Color = 4210752
LeftAxis.Grid.Color = 11119017
LeftAxis.LabelsFont.Name = 'Verdana'
LeftAxis.TicksInner.Color = 11119017
LeftAxis.Title.Font.Name = 'Verdana'
RightAxis.Axis.Color = 4210752
RightAxis.Grid.Color = 11119017
RightAxis.LabelsFont.Name = 'Verdana'
RightAxis.TicksInner.Color = 11119017
RightAxis.Title.Font.Name = 'Verdana'
TopAxis.Axis.Color = 4210752
TopAxis.Grid.Color = 11119017
TopAxis.LabelsFont.Name = 'Verdana'
TopAxis.TicksInner.Color = 11119017
TopAxis.Title.Font.Name = 'Verdana'
Align = alClient
TabOrder = 0
ColorPaletteIndex = 13
object Series1: TLineSeries
Marks.Arrow.Visible = True
Marks.Callout.Brush.Color = clBlack
Marks.Callout.Arrow.Visible = True
Marks.Visible = False
Pointer.InflateMargins = True
Pointer.Style = psRectangle
Pointer.Visible = False
XValues.Name = 'X'
XValues.Order = loAscending
YValues.Name = 'Y'
YValues.Order = loNone
end
object Series2: TLineSeries
Marks.Arrow.Visible = True
Marks.Callout.Brush.Color = clBlack
Marks.Callout.Arrow.Visible = True
Marks.Visible = False
VertAxis = aRightAxis
Pointer.InflateMargins = True
Pointer.Style = psRectangle
Pointer.Visible = False
XValues.Name = 'X'
XValues.Order = loAscending
YValues.Name = 'Y'
YValues.Order = loNone
end
end
end
the TChart version is v2010.01.11004 win32
Best regards
- Attachments
-
- TeechartZoom.zip
- Project zipped
- (9.15 KiB) Downloaded 544 times
Gerard Esposito
Re: Zoom with mouse don'work properly with left and right axis
Hi Gerard,
Thanks for the project and for reporting this. I've reproduced it with v2010.00 s I've added it to the defect list to be fixed in future releases (TV52015228).
In the meanwhile, you could correct it at OnZoom event:
Thanks for the project and for reporting this. I've reproduced it with v2010.00 s I've added it to the defect list to be fixed in future releases (TV52015228).
In the meanwhile, you could correct it at OnZoom event:
Code: Select all
procedure TForm1.Chart1Zoom(Sender: TObject);
begin
with Chart1.Axes.Left do SetMinMax(CalcPosPoint(Chart1.Zoom.Y1), CalcPosPoint(Chart1.Zoom.Y0));
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Zoom with mouse don'work properly with left and right axis
Hi Gerard,
As an update, I have a solution proposal for this bug. Since you are a source code customer you can try the fix doing a little modification at Chart.pas, implementing TCustomChart.CalcZoomPoints method as shown below. You can use TeeRecompile tool supplied with the source code installer to compile and install the packages at your IDEs.
As an update, I have a solution proposal for this bug. Since you are a source code customer you can try the fix doing a little modification at Chart.pas, implementing TCustomChart.CalcZoomPoints method as shown below. You can use TeeRecompile tool supplied with the source code installer to compile and install the packages at your IDEs.
Code: Select all
Procedure TCustomChart.CalcZoomPoints;
var Series : TChartSeries;
t : Integer;
Begin
Series:=nil;
With Zoom, Axes do
Begin
Check;
for t:=0 to SeriesCount-1 do
begin
if SeriesList[t].Active and SeriesList[t].CanZoomScroll then
Series:=SeriesList[t];
end;
if Assigned(Series) and
(Top.PosAxis = Bottom.PosAxis) and (Left.PosAxis = Right.PosAxis) then //TV52015228, keeps polar zoom support
begin
DoZoom(Series.XScreenToValue(X0),Series.XScreenToValue(X1),
Series.XScreenToValue(X0),Series.XScreenToValue(X1),
Series.YScreenToValue(Y1),Series.YScreenToValue(Y0),
Series.YScreenToValue(Y1),Series.YScreenToValue(Y0));
end
else
begin
DoZoom( Top.CalcPosPoint(X0),Top.CalcPosPoint(X1),
Bottom.CalcPosPoint(X0),Bottom.CalcPosPoint(X1),
Left.CalcPosPoint(Y1),Left.CalcPosPoint(Y0),
Right.CalcPosPoint(Y1),Right.CalcPosPoint(Y0));
end;
if History then
AddZoomSnapshot;
end;
End;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Zoom with mouse don'work properly with left and right axis
Hi Narcis and Yerai,
Thank you for your help.
Gérard.
Thank you for your help.
Gérard.
Gerard Esposito