From 3fb76f8c86e8794d68dfd5ec7934fb1a6b4a792b Mon Sep 17 00:00:00 2001 From: ask Date: Sun, 6 Jun 2010 06:02:04 +0000 Subject: [PATCH] TAChart: Fix SIGFPE after changing scale to logarithmic on zoomed-in chart git-svn-id: trunk@25941 - --- components/tachart/tachartaxis.pas | 9 +++++++-- components/tachart/tagraph.pas | 2 +- components/tachart/tatypes.pas | 5 ++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/components/tachart/tachartaxis.pas b/components/tachart/tachartaxis.pas index 2c32cc0386..a38707821a 100644 --- a/components/tachart/tachartaxis.pas +++ b/components/tachart/tachartaxis.pas @@ -652,8 +652,13 @@ end; procedure TChartAxis.StyleChanged(ASender: TObject); begin - Unused(ASender); - (Collection.Owner as TCustomChart).Invalidate; + with Collection.Owner as TCustomChart do begin + // Transformation change could have invalidated the current extent, + // so revert to full extent for now. + if ASender is TAxisTransform then + ZoomFull; + Invalidate; + end; end; const diff --git a/components/tachart/tagraph.pas b/components/tachart/tagraph.pas index f7e51016c0..fc4ae56b55 100644 --- a/components/tachart/tagraph.pas +++ b/components/tachart/tagraph.pas @@ -236,7 +236,7 @@ type procedure SaveToBitmapFile(const AFileName: String); inline; procedure SaveToFile(AClass: TRasterImageClass; const AFileName: String); function SaveToImage(AClass: TRasterImageClass): TRasterImage; - procedure ZoomFull; + procedure ZoomFull; override; public // Coordinate conversion function GraphToImage(const AGraphPoint: TDoublePoint): TPoint; function ImageToGraph(const APoint: TPoint): TDoublePoint; diff --git a/components/tachart/tatypes.pas b/components/tachart/tatypes.pas index f7fe974e4a..57ae37c91c 100644 --- a/components/tachart/tatypes.pas +++ b/components/tachart/tatypes.pas @@ -41,7 +41,10 @@ const DEF_TITLE_DISTANCE = 4; type - TCustomChart = class(TCustomControl); + TCustomChart = class(TCustomControl) + public + procedure ZoomFull; virtual; abstract; + end; { TChartPen }