Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 2081

Summary: Arrow and Historgram charts throw error on zooming
Product: .NET TeeChart Reporter: Sunil Ramesh <sunil.ramesh>
Component: ChartAssignee: Steema Issue Manager <issuemanager>
Status: RESOLVED FIXED    
Severity: critical CC: chris
Priority: Highest    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Chart Series: --- Delphi / C++ Builder RAD IDE Version:
Attachments: Sample application to simulate
Sample application to simulate
Workaround
I have attached a screen video

Description Sunil Ramesh 2018-08-28 02:29:03 EDT
Add Arrow or Histogram with sample values (FillSampleValues) and then keep on zooming in, you get overflow expectation.


         Arrow ax = new Arrow();
         ax.FillSampleValues();
         tChart1.Series.Add(ax);


System.OverflowException: Overflow error.
   at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
   at System.Drawing.Graphics.DrawLine(Pen pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2)
   at Steema.TeeChart.Drawing.Graphics3DGdiPlus.LineTo(Int32 x, Int32 y)
   at Steema.TeeChart.Drawing.Graphics3D.Arrow(Boolean Filled, Point FromPoint, Point ToPoint, Int32 ArrowWidth, Int32 ArrowHeight, Int32 Z, Double ArrowPercent)
   at Steema.TeeChart.Drawing.Graphics3D.Arrow(Boolean Filled, Point FromPoint, Point ToPoint, Int32 ArrowWidth, Int32 ArrowHeight, Int32 Z)
   at Steema.TeeChart.Styles.Arrow.DrawValue(Int32 valueIndex)
   at Steema.TeeChart.Styles.Series.DoDrawIndex(Int32 Index, Boolean CanID)
   at Steema.TeeChart.Styles.Series.Draw()
   at Steema.TeeChart.Styles.Series.DrawSeries()
   at Steema.TeeChart.Chart.DoDraw(Graphics3D g, Int32 First, Int32 Last, Int32 Inc)
   at Steema.TeeChart.Chart.DrawAllSeries(Graphics3D g)
   at Steema.TeeChart.Chart.InternalDraw(Graphics g, Boolean noTools)
   at Steema.TeeChart.TChart.Draw(Graphics g)
   at Steema.TeeChart.TChart.OnPaint(PaintEventArgs pe)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Comment 1 Sunil Ramesh 2018-08-28 02:29:49 EDT
The version I am using is TeeChartNET2018_4.1.2018.05040
Comment 2 christopher ireland 2018-08-28 10:46:28 EDT
I'm afraid I can't reproduce this issue here - I made a screenvideo of my attempt you can see here:

http://www.teechart.net/files/public/support/2018-08-28_16-43-06.gif

(the zoom rectangle issue is an artifact of the video-making process)
Comment 3 Sunil Ramesh 2018-08-29 01:18:29 EDT
I have attached a sample to simulate and a screenshot
Comment 4 Sunil Ramesh 2018-08-29 01:19:35 EDT
Created attachment 849 [details]
Sample application to simulate

Run the application and keep on zooming in where you have too many points
Comment 5 Sunil Ramesh 2018-08-29 01:20:54 EDT
Created attachment 850 [details]
Sample application to simulate
Comment 6 Sunil Ramesh 2018-08-29 01:25:15 EDT
here is a onedrive link to the video https://1drv.ms/u/s!Atm48KvNL-Bl6TzBSw105x0SJxbZ
Comment 7 christopher ireland 2018-08-29 06:18:35 EDT
Created attachment 851 [details]
Workaround

We have been able to reproduce this issue here. Attached is a Form1.cs in which a workaround to this issue can be found. The fix has already been added to the source code.
Comment 8 Sunil Ramesh 2018-08-29 06:26:46 EDT
Same happens with Historgram as well. Is this also fixed?
Comment 9 christopher ireland 2018-08-29 06:43:53 EDT
I can't reprodue this issue in the Histogram series - in fact a fix to it was made at the end of 2015: 

http://bugs.teechart.net/show_bug.cgi?id=1372
Comment 10 Sunil Ramesh 2018-08-29 06:50:50 EDT
I am able to same code, just change the type to Histogram and you will get the below exception

System.OverflowException: Negating the minimum value of a twos complement number is invalid.
   at System.Math.AbsHelper(Int32 value)
   at Steema.TeeChart.Styles.Histogram.CalcRectangle(Int32 valueIndex)
   at Steema.TeeChart.Styles.Histogram.DrawValue(Int32 valueIndex)
   at Steema.TeeChart.Styles.Series.DoDrawIndex(Int32 Index, Boolean CanID)
   at Steema.TeeChart.Styles.Series.Draw()
   at Steema.TeeChart.Styles.Series.DrawSeries()
   at Steema.TeeChart.Chart.DoDraw(Graphics3D g, Int32 First, Int32 Last, Int32 Inc)
   at Steema.TeeChart.Chart.DrawAllSeries(Graphics3D g)
   at Steema.TeeChart.Chart.InternalDraw(Graphics g, Boolean noTools)
   at Steema.TeeChart.Chart.InternalDraw(Graphics g)
   at Steema.TeeChart.TChart.Draw(Graphics g)
   at Steema.TeeChart.TChart.OnPaint(PaintEventArgs pe)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Comment 11 Sunil Ramesh 2018-08-29 06:53:08 EDT
Zoom at the peaks and then continue zooming in
Comment 12 Sunil Ramesh 2018-08-29 06:55:13 EDT
Zoom in at the peaks of the histogram and continue even if no points are visible.
Comment 13 christopher ireland 2018-08-30 06:33:45 EDT
I'm using this code:

		private void InitializeChart()
		{
			tChart1.Header.Text = Utils.Version;
			Histogram ax = new Histogram();
			ax.FillSampleValues(5000);
			tChart1.Series.Add(ax);
		}


and here I zoom in 20 times without being able to reproduce your issue:

http://www.teechart.net/files/public/support/2018-08-30_11-16-36.gif
Comment 14 Sunil Ramesh 2018-08-30 07:51:50 EDT
Created attachment 852 [details]
I have attached a screen video

I am using the code below. Replace the below in Arrow sample attached before (WindowsFormsApp1.zip Form1_Load)

         Histogram ax = new Histogram();
         ax.FillSampleValues(5000);
         tChart1.Series.Add(ax);
Comment 15 christopher ireland 2018-08-30 11:12:12 EDT
Okay. I'm afraid I still haven't been able to reproduce this here, but I think I understand what might be happening. The stack trace mentions Math.Abs(), and this method is only called three times in the Histogram class's code. I have made a small adjustment based on the information here:
https://stackoverflow.com/questions/16131544/cant-get-value-for-math-abs-2147483648

Unfortunately there's no workaround I can offer you, because the method involved is marked as internal, but I can offer you a TeeChart.dll you might like to try to see if the issue has been fixed:
http://www.teechart.net/files/public/support/TeeChart_4.2018.8.30.zip
Comment 16 Sunil Ramesh 2018-08-31 02:06:51 EDT
I have tested your updated dll and it works ok now, so the issue is fixed I guess.
When will you be releasing the update?
Comment 17 christopher ireland 2018-08-31 11:19:57 EDT
Okay, that's great.

I think the next release will be due out at the end of this third quarter or the beginning of the fourth.