Print Page | Close Window

Bug in Zooming

Printed From: TMS Software
Category: VCL Components
Forum Name: VCL Chart
Forum Discription:
URL: http://www.tmssoftware.com/site/forum/forum_posts.asp?TID=6814
Printed Date: 21 Feb 2020 at 1:45am


Topic: Bug in Zooming
Posted By: White Dave
Subject: Bug in Zooming
Date Posted: 08 Jul 2016 at 10:37pm
When doing the control/zoom on a chart, the result of the zoom differs depending on whether you zoom from bottom right to top left or vice/versa. Tracing through the code to TChartPane.DoZoomIn procedure, there appears to be an error in one of the else if statements (cut and paste error?).

if (CtrlZooming = czYAxis) or (CtrlZooming = czBoth) then
    begin
      if (FRy - FCy) > 0 then
      begin
        Series.ForceInit(true);
        Series.Mode := cmScaling;
        for I := 0 to Series.Count - 1 do
        begin
          Series.AutoRange := arDisabled;
          pmin := Series.YToValue(FRy, FSeriesRect);
          pmax := Series.YToValue(FCy, FSeriesRect);
          if pmax - pmin > ZOOMMIN then
          begin
            TCrackedChartSerie(Series).MinimumValue := pmin;
            TCrackedChartSerie(Series).MaximumValue := pmax;
          end;
        end;
        Chart.InitializeChart(ChartView.Canvas, FRect, 1, 1);
      end
      else if (FRy - FCy) > 0 then                    <= this branch will never get called!!
      begin
        Series.ForceInit(true);
        Series.Mode := cmScaling;
        for I := 0 to Series.Count - 1 do
        begin
          Series.AutoRange := arDisabled;
          pmin := Series.YToValue(FCy, FSeriesRect);
          pmax := Series.YToValue(FRy, FSeriesRect);
          if pmax - pmin > ZOOMMIN then
          begin
            TCrackedChartSerie(Series).MinimumValue := pmin;
            TCrackedChartSerie(Series).MaximumValue := pmax;
          end;
        end;
        Chart.InitializeChart(ChartView.Canvas, FRect, 1, 1);
      end;
    end;



Replies:
Posted By: Pieter Scheldeman
Date Posted: 08 Jul 2016 at 11:49pm
Hi, 

We have fixed this here, the next version will address this.



Print Page | Close Window