Floating point overflow zooming in
Floating point overflow zooming in
Hi,
I have a chart comprising a TAreaSeries and some TLineSeries. After a number of successful zoom-in operations without unzooming, I get 'floating point overflow'. Is this something to do with the chart being unable to calculate a tick increment? Is there a way to anticipate the error?
Thanks
Trevor Cooper
I have a chart comprising a TAreaSeries and some TLineSeries. After a number of successful zoom-in operations without unzooming, I get 'floating point overflow'. Is this something to do with the chart being unable to calculate a tick increment? Is there a way to anticipate the error?
Thanks
Trevor Cooper
Re: Floating point overflow zooming in
Hi Trevor,
Can you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Can you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Floating point overflow zooming in
Hi,
I've attached a an example project. If you keep zooming then the error will occur sooner or later, usually somewhere between the 3rd and 15th zoom. Sometimes zooming where there's no data seems to produce the error sooner. I know it seems unlikely that a user would usefully zoom in 15 times, but sometimes they do when they're looking for miniscule changes of data.
This is running TeeChart Pro v2012.06.120613 32-bit VCL in Delphi 2007.
Hope you can repdocue the error.
Regards
Trevor Cooper
I've attached a an example project. If you keep zooming then the error will occur sooner or later, usually somewhere between the 3rd and 15th zoom. Sometimes zooming where there's no data seems to produce the error sooner. I know it seems unlikely that a user would usefully zoom in 15 times, but sometimes they do when they're looking for miniscule changes of data.
This is running TeeChart Pro v2012.06.120613 32-bit VCL in Delphi 2007.
Hope you can repdocue the error.
Regards
Trevor Cooper
- Attachments
-
- FloatingPointOverflowOnZoom.zip
- (2.91 KiB) Downloaded 871 times
Re: Floating point overflow zooming in
Hi Trevor,
Thanks for the project. I could reproduce the problem with it. I simplified it to the minimum so the smallest code I found that still reproduces the problem is this:
It seems the combination of 2D, an inverted bottom axis and a TLineSeries with XValues.Order set to loNone gives this problem.
I've added it to the defect list to be further investigated (TV52016351).
Thanks for the project. I could reproduce the problem with it. I simplified it to the minimum so the smallest code I found that still reproduces the problem is this:
Code: Select all
uses Series;
procedure TForm1.FormCreate(Sender: TObject);
begin
with Chart1 do
begin
View3D:=False;
Axes.Bottom.Inverted:=True;
end;
with Chart1.AddSeries(TLineSeries) as TLineSeries do
begin
XValues.Order := loNone;
FillSampleValues;
end;
end;
I've added it to the defect list to be further investigated (TV52016351).
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Floating point overflow zooming in
Hi Trevor,
We've just reviewed and fixed it for the next maintenance release (TV52016351).
We've just reviewed and fixed it for the next maintenance release (TV52016351).
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Floating point overflow zooming in
Thanks Yeray.
When's the next maintenance release?
In the meantime, it doesn't seem possible to trap the error, and when it occurs the default unzoom behaviour no longer works, so users have to rebuild the chart. If you know the fix, then do you also know whether there is an obvious way of predicting when the problem will occur so we can anticipate it by preventing 'too many' zooms?
Thanks
Trevor Cooper
When's the next maintenance release?
In the meantime, it doesn't seem possible to trap the error, and when it occurs the default unzoom behaviour no longer works, so users have to rebuild the chart. If you know the fix, then do you also know whether there is an obvious way of predicting when the problem will occur so we can anticipate it by preventing 'too many' zooms?
Thanks
Trevor Cooper
Re: Floating point overflow zooming in
Hi Trevor,
I'm afraid I can't tell you when the next maintenance release will be published. You can see the release notes to have an idea on how often we use to do it.Toreba wrote:When's the next maintenance release?
The easier workaround I see right now would be to create a custom series inheriting from TLineSeries and overriding the DrawValue method to prevent it:Toreba wrote:In the meantime, it doesn't seem possible to trap the error, and when it occurs the default unzoom behaviour no longer works, so users have to rebuild the chart. If you know the fix, then do you also know whether there is an obvious way of predicting when the problem will occur so we can anticipate it by preventing 'too many' zooms?
Code: Select all
uses Series;
{ MySeries }
type
MySeries = class(TLineSeries)
protected
procedure DrawValue(ValueIndex:Integer); override;
end;
procedure MySeries.DrawValue(ValueIndex: Integer);
var XPos: Integer;
begin
XPos:=CalcXPos(ValueIndex);
if (XPos<$7FFF) and (XPos>-$7FFF) then
inherited;
end;
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
with Chart1 do
begin
View3D:=False;
Axes.Bottom.Inverted:=True;
end;
with Chart1.AddSeries(MySeries) as MySeries do
begin
XValues.Order := loNone;
FillSampleValues;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Floating point overflow zooming in
Yeray,
Yes, that works, thank you very much. The software now doesn't crash, but at one point during the sequence of zooms the chart plot area fills with grey and no series are visible, but we can zoom or unzoom out of that and continue working with the chart as normal. I think we can live with that quite happily until the next maintenance release.
Thanks for your help.
Trevor Cooper
Yes, that works, thank you very much. The software now doesn't crash, but at one point during the sequence of zooms the chart plot area fills with grey and no series are visible, but we can zoom or unzoom out of that and continue working with the chart as normal. I think we can live with that quite happily until the next maintenance release.
Thanks for your help.
Trevor Cooper
Re: Floating point overflow zooming in
Hi Trevor,
I zoom several times and there's no error message and I can't see this effect. Could you please send us some screenshot so we can see where are you exactly zooming in?
I'm not sure to be able to reproduce this. I've taken your project, removed the 3 TLineSeries and added the same code, but at runtime, to be able to substitute them for MySeries type. Here is the code:Toreba wrote:The software now doesn't crash, but at one point during the sequence of zooms the chart plot area fills with grey and no series are visible, but we can zoom or unzoom out of that and continue working with the chart as normal. I think we can live with that quite happily until the next maintenance release.
Code: Select all
{ MySeries }
MySeries = class(TLineSeries)
protected
procedure DrawValue(ValueIndex:Integer); override;
end;
TForm1 = class(TForm)
ChartEditor1: TChartEditor;
Chart1: TChart;
procedure Chart1DblClick(Sender: TObject);
procedure FormShow(Sender: TObject);
private
public
end;
var
Form1: TForm1;
Series3: TAreaSeries;
Series2: MySeries;
Series1: MySeries;
Series4: MySeries;
implementation
{$R *.dfm}
procedure TForm1.Chart1DblClick(Sender: TObject);
begin
Self.ChartEditor1.Execute;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Series3:=Chart1.AddSeries(TAreaSeries) as TAreaSeries;
with Series3 as TAreaSeries do
begin
Marks.Arrow.Visible := True;
Marks.Callout.Brush.Color := clBlack;
Marks.Callout.Arrow.Visible := True;
Marks.Visible := False;
SeriesColor := clSilver;
Title := 'Invert Level';
AreaLinesPen.Color := clGray;
AreaLinesPen.Style := psDashDot;
DrawArea := True;
Pointer.InflateMargins := True;
Pointer.Style := psRectangle;
Pointer.Visible := False;
XValues.Name := 'X';
XValues.Order := loAscending;
YValues.Name := 'Y';
YValues.Order := loNone;
end;
Series2:=Chart1.AddSeries(MySeries) as MySeries;
with Series2 as MySeries do
begin
Marks.Arrow.Visible := True;
Marks.Callout.Brush.Color := clBlack;
Marks.Callout.Arrow.Visible := True;
Marks.Visible := False;
SeriesColor := clBlue;
Title := 'Hydraulic Level';
LinePen.Color := clBlue;
LinePen.Width := 2;
Pointer.InflateMargins := True;
Pointer.Style := psRectangle;
Pointer.Visible := False;
XValues.Name := 'X';
XValues.Order := loNone;
YValues.Name := 'Y';
YValues.Order := loNone;
end;
Series1:=Chart1.AddSeries(MySeries) as MySeries;
with Series1 as MySeries do
begin
Marks.Arrow.Visible := True;
Marks.Callout.Brush.Color := clBlack;
Marks.Callout.Arrow.Visible := True;
Marks.Visible := False;
Title := 'Energy Level';
LinePen.Color := clRed;
LinePen.Width := 2;
Pointer.InflateMargins := True;
Pointer.Style := psRectangle;
Pointer.Visible := False;
XValues.Name := 'X';
XValues.Order := loNone;
YValues.Name := 'Y';
YValues.Order := loNone;
end;
Series4:=Chart1.AddSeries(MySeries) as MySeries;
with Series4 as MySeries do
begin
Marks.Arrow.Visible := True;
Marks.Callout.Brush.Color := clBlack;
Marks.Callout.Arrow.Visible := True;
Marks.Visible := False;
Title := 'Soffit Level';
LinePen.Color := clGreen;
Pointer.InflateMargins := True;
Pointer.Style := psRectangle;
Pointer.Visible := False;
XValues.Name := 'X';
XValues.Order := loAscending;
YValues.Name := 'Y';
YValues.Order := loNone;
end;
Series1.FillSampleValues(10);
Series2.FillSampleValues(10);
Series3.FillSampleValues(10);
Series4.FillSampleValues(10);
end;
procedure MySeries.DrawValue(ValueIndex: Integer);
var XPos: Integer;
begin
XPos:=CalcXPos(ValueIndex);
if (XPos<$7FFF) and (XPos>-$7FFF) then
inherited;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Floating point overflow zooming in
Yeray,
I modified my oroginal project accroding to your suggested workround, as attached. If you maximise the form, zoom in far enough, say somewhere between the 10th and 25th zooms, then the plot area goes grey as in the attached image, but there's no error and you can still zoom in and out at this stage.
But, the greying out only occurs if the form is maximised. Otherwise all is fine.
I hope that makes sense to you.
Regards
Trevor Cooper
I modified my oroginal project accroding to your suggested workround, as attached. If you maximise the form, zoom in far enough, say somewhere between the 10th and 25th zooms, then the plot area goes grey as in the attached image, but there's no error and you can still zoom in and out at this stage.
But, the greying out only occurs if the form is maximised. Otherwise all is fine.
I hope that makes sense to you.
Regards
Trevor Cooper
- Attachments
-
- FloatingPointOverflowOnZoom.zip
- (23.92 KiB) Downloaded 892 times
Re: Floating point overflow zooming in
Hi,
But I'm not sure where are you exactly zooming. Note there are zones where you will see everything on gray in just one zoom (if you zoom into the area series).
Please, show us a video, or post an example with hardcoded values and hardcoded zoom rectangles to be sure we are doing exactly the same.
But I'm not sure where are you exactly zooming. Note there are zones where you will see everything on gray in just one zoom (if you zoom into the area series).
Please, show us a video, or post an example with hardcoded values and hardcoded zoom rectangles to be sure we are doing exactly the same.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Floating point overflow zooming in
Yeray,
I've slightly expanded my example project with a hard-coded set-up of series values, and a memo showing the last zoomed coordinates. If I had more time today I'd hard code these zoom coordinates for you. If I concentrate on zooming in the top left part of the chart, and keep going,I get a greying out of the plot area after about eight zooms. I attach the project with screen captures of start and end of the process.
Hope that helps.
Trevor Cooper
I've slightly expanded my example project with a hard-coded set-up of series values, and a memo showing the last zoomed coordinates. If I had more time today I'd hard code these zoom coordinates for you. If I concentrate on zooming in the top left part of the chart, and keep going,I get a greying out of the plot area after about eight zooms. I attach the project with screen captures of start and end of the process.
Hope that helps.
Trevor Cooper
- Attachments
-
- FloatingPointOverflowOnZoom.zip
- (80.97 KiB) Downloaded 910 times
Re: Floating point overflow zooming in
Hi,
I could reproduce the issue now thanks to your project.
Simplifying it to the minimum, indeed, it seems to be completely different issue:
I've observed it seems to depend on the height the chart actually has. The problem is reproducible when the window is maximized, but also if you don't maximize the window and you resize it to have big height.
I've added it to the wish list to be investigated (TV52016366).
I could reproduce the issue now thanks to your project.
Simplifying it to the minimum, indeed, it seems to be completely different issue:
Code: Select all
uses Series;
procedure TForm1.FormCreate(Sender: TObject);
var i: integer;
begin
Chart1.Align:=alClient;
Chart1.View3D:=false;
with Chart1.AddSeries(TAreaSeries) do
for i:=1 to 10 do
AddXY(i, 15-i);
Chart1.Axes.Bottom.SetMinMax(9.105085051, 9.105129839);
Chart1.Axes.Left.SetMinMax(17.090535587, 17.090594192);
Self.WindowState:=wsMaximized;
end;
I've added it to the wish list to be investigated (TV52016366).
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Floating point overflow zooming in
Okay, thanks for your help Yeray!