Page 1 of 1

Chart.Bitmap threw an exception.

Posted: Thu Mar 03, 2016 11:39 am
by 15668832
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:

Re: Chart.Bitmap threw an exception.

Posted: Fri Mar 04, 2016 1:24 pm
by Christopher
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?

Re: Chart.Bitmap threw an exception.

Posted: Fri Mar 11, 2016 4:05 pm
by 15668832
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.

Re: Chart.Bitmap threw an exception.

Posted: Fri Mar 11, 2016 5:23 pm
by 15668832
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()"

Re: Chart.Bitmap threw an exception.

Posted: Fri Mar 11, 2016 5:29 pm
by 15668832
Screen-shot of the exception.

Re: Chart.Bitmap threw an exception.

Posted: Mon Mar 14, 2016 9:25 am
by Christopher
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?

Re: Chart.Bitmap threw an exception.

Posted: Mon Mar 14, 2016 2:11 pm
by 15668832
I am stilling try to reproduce this exception outside of my project but still no success.

Re: Chart.Bitmap threw an exception.

Posted: Tue Mar 15, 2016 11:10 am
by 15668832
"
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.

Re: Chart.Bitmap threw an exception.

Posted: Tue Mar 15, 2016 11:50 am
by Christopher
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.

Re: Chart.Bitmap threw an exception.

Posted: Tue Mar 15, 2016 12:19 pm
by 15668832
I do not call anything expect adding 'SeriesBandTool' to chart.

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