Chart.Bitmap threw an exception.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Chart.Bitmap threw an exception.

Post by Raavi » Thu Mar 03, 2016 11:39 am

I try to draw when ever there is change in the value of the textbox in C# application.

E.g., diameter=8.323232

If I change the above value slowly like 8.32323, 8.3232 and so on by pressing backspace I have no problems the charts renders the change in the value.

But if I change the values very fast by pressing backspace two or more times continuously I get an exception in Chart.Bitmap.

System.NullReferenceException was unhandled
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=TeeChart
StackTrace:
at Steema.TeeChart.Tools.SeriesBandTool.DrawBandTool()
at Steema.TeeChart.Tools.SeriesBandTool.BeforeDrawValues(Object sender, Graphics3D g)
at Steema.TeeChart.PaintChartEventHandler.Invoke(Object sender, Graphics3D g)
at Steema.TeeChart.Styles.Series.DoBeforeDrawValues()
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.Draw(Graphics g, Rectangle r, Boolean noTools)
at Steema.TeeChart.Chart.Draw(Graphics g)
at Steema.TeeChart.Chart.Bitmap(Int32 width, Int32 height, PixelFormat pixelformat)
at Steema.TeeChart.Chart.Bitmap(Int32 width, Int32 height)
at Steema.TeeChart.TChart.get_Bitmap()
at *some namespace*.AddChartView() in ..\Control.cs:line 805 *This line is edited by me*
at System.Windows.Forms.Control.OnTextChanged(EventArgs e)
at System.Windows.Forms.TextBoxBase.OnTextChanged(EventArgs e)
at System.Windows.Forms.TextBoxBase.WmReflectCommand(Message& m)
at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
at System.Windows.Forms.TextBox.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
InnerException:

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Chart.Bitmap threw an exception.

Post by Christopher » Fri Mar 04, 2016 1:24 pm

Raavi wrote: But if I change the values very fast by pressing backspace two or more times continuously I get an exception in Chart.Bitmap.
Would you please be so kind as to post here a Short, Self Contained, Correct (Compilable), Example with which we can reproduce your issue?
Best Regards,
Christopher Ireland / 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

Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Re: Chart.Bitmap threw an exception.

Post by Raavi » Fri Mar 11, 2016 4:05 pm

Hello,

I am trying to reproduce the problem with spike solution but I did not find much time to do that but,

the problem is when I try to add a line series to

var seriesBandTool = new SeriesBandTool();
seriesBandTool.Series = //line series
Chart.Tools.Add(seriesBandTool);

and change the //line series really fast with change in value of a textbox.

Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Re: Chart.Bitmap threw an exception.

Post by Raavi » Fri Mar 11, 2016 5:23 pm

StackTrace

"
at Steema.TeeChart.Tools.SeriesBandTool.DrawBandTool()\r\n
at Steema.TeeChart.Tools.SeriesBandTool.BeforeDrawValues(Object sender, Graphics3D g)\r\n
at Steema.TeeChart.PaintChartEventHandler.Invoke(Object sender, Graphics3D g)\r\n
at Steema.TeeChart.Styles.Series.DoBeforeDrawValues()\r\n
at Steema.TeeChart.Styles.Series.DrawSeries()\r\n
at Steema.TeeChart.Chart.DoDraw(Graphics3D g, Int32 First, Int32 Last, Int32 Inc)\r\n
at Steema.TeeChart.Chart.DrawAllSeries(Graphics3D g)\r\n
at Steema.TeeChart.Chart.InternalDraw(Graphics g, Boolean noTools)\r\n
at Steema.TeeChart.Chart.Draw(Graphics g, Rectangle r, Boolean noTools)\r\n
at Steema.TeeChart.Chart.Draw(Graphics g, Rectangle r)\r\n
at Steema.TeeChart.Chart.Metafile(Graphics gRef, Stream stream, Chart aChart, Int32 width, Int32 height, EmfType type)\r\n
at Steema.TeeChart.Chart.Metafile(Stream stream, Chart aChart, Int32 width, Int32 height, EmfType type)\r\n
at Steema.TeeChart.Chart.Metafile(Chart aChart, Int32 width, Int32 height)\r\n
at Steema.TeeChart.TChart.get_Metafile()"
Last edited by Raavi on Tue Mar 15, 2016 11:06 am, edited 1 time in total.

Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Re: Chart.Bitmap threw an exception.

Post by Raavi » Fri Mar 11, 2016 5:29 pm

Screen-shot of the exception.
Attachments
BitMapException.png
BitMapException.png (94.07 KiB) Viewed 16620 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Chart.Bitmap threw an exception.

Post by Christopher » Mon Mar 14, 2016 9:25 am

Raavi wrote:and change the //line series really fast with change in value of a textbox.
When you say, "change the line series", what do you mean exactly? Using the following code I cannot reproduce the issue here:

Code: Select all

    System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
    Line line1;

    private void InitializeChart()
    {
      timer.Tick += Timer_Tick;    

      tChart1.Aspect.View3D = false;
      line1 = new Line(tChart1.Chart);
      line1.FillSampleValues();

      SeriesBandTool tool = new SeriesBandTool(tChart1.Chart);
      tool.Series = line1;

      timer.Interval = 1;
      timer.Start();
    }

    private void Timer_Tick(object sender, EventArgs e)
    {
      line1.FillSampleValues();
    }
could you please modify the example above so I can see the exception being thrown?
Best Regards,
Christopher Ireland / 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

Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Re: Chart.Bitmap threw an exception.

Post by Raavi » Mon Mar 14, 2016 2:11 pm

I am stilling try to reproduce this exception outside of my project but still no success.

Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Re: Chart.Bitmap threw an exception.

Post by Raavi » Tue Mar 15, 2016 11:10 am

"
at Steema.TeeChart.Tools.SeriesBandTool.DrawBandTool()\r\n
at Steema.TeeChart.Tools.SeriesBandTool.BeforeDrawValues(Object sender, Graphics3D g)\r\n
at Steema.TeeChart.PaintChartEventHandler.Invoke(Object sender, Graphics3D g)\r\n
at Steema.TeeChart.Styles.Series.DoBeforeDrawValues()\r\n
at Steema.TeeChart.Styles.Series.DrawSeries()\r\n
at Steema.TeeChart.Chart.DoDraw(Graphics3D g, Int32 First, Int32 Last, Int32 Inc)\r\n
at Steema.TeeChart.Chart.DrawAllSeries(Graphics3D g)\r\n
at Steema.TeeChart.Chart.InternalDraw(Graphics g, Boolean noTools)\r\n
at Steema.TeeChart.Chart.Draw(Graphics g, Rectangle r, Boolean noTools)\r\n
at Steema.TeeChart.Chart.Draw(Graphics g, Rectangle r)\r\n
at Steema.TeeChart.Chart.Metafile(Graphics gRef, Stream stream, Chart aChart, Int32 width, Int32 height, EmfType type)\r\n
at Steema.TeeChart.Chart.Metafile(Stream stream, Chart aChart, Int32 width, Int32 height, EmfType type)\r\n
at Steema.TeeChart.Chart.Metafile(Chart aChart, Int32 width, Int32 height)\r\n
at Steema.TeeChart.TChart.get_Metafile()"


"
at Steema.TeeChart.Tools.SeriesBandTool.DrawBandTool()\r\n
at Steema.TeeChart.Tools.SeriesBandTool.BeforeDrawValues(Object sender, Graphics3D g)\r\n
at Steema.TeeChart.Styles.Series.DoBeforeDrawValues()\r\n
at Steema.TeeChart.Styles.Series.DrawSeries()\r\n
at Steema.TeeChart.Chart.DoDraw(Graphics3D g, Int32 First, Int32 Last, Int32 Inc)\r\n
at Steema.TeeChart.Chart.DrawAllSeries(Graphics3D g)\r\n
at Steema.TeeChart.Chart.InternalDraw(Graphics g, Boolean noTools)\r\n
at Steema.TeeChart.Chart.Draw(Graphics g, Rectangle r, Boolean noTools)\r\n
at Steema.TeeChart.Chart.Draw(Graphics g)\r\n
at Steema.TeeChart.Chart.Bitmap(Int32 width, Int32 height, PixelFormat pixelformat)\r\n
at Steema.TeeChart.Chart.Bitmap(Int32 width, Int32 height)\r\n
at Steema.TeeChart.TChart.get_Bitmap()"


These are from stack trace. I am still trying to reproduce the bug outside of my project.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Chart.Bitmap threw an exception.

Post by Christopher » Tue Mar 15, 2016 11:50 am

Raavi wrote:"
These are from stack trace. I am still trying to reproduce the bug outside of my project.
Why have you got calls to get_Bitmap() and get_Metafile()? These should not be in any normal stacktrace, as they are not called unless done so specifically in user code.
Best Regards,
Christopher Ireland / 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

Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Re: Chart.Bitmap threw an exception.

Post by Raavi » Tue Mar 15, 2016 12:19 pm

I do not call anything expect adding 'SeriesBandTool' to chart.

I hope, I can succeed in reproducing this exception in spike solution.

Post Reply