Histogram chart crashes when both X and Y has values

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
BeijerElectronics
Newbie
Newbie
Posts: 30
Joined: Tue Sep 13, 2011 12:00 am

Histogram chart crashes when both X and Y has values

Post by BeijerElectronics » Wed Jan 04, 2012 9:31 am

Hi,

We experience problem with histogram as series in the pocket chart, don't know if the same problem exist in the WPF chart.

The problem occurs when both X and Y for the histogram series have an array of double values and then changing the X values (new double array), we get an exception...

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.Line(Int32 x0, Int32 y0, Int32 x1, Int32 y1)
at Steema.TeeChart.Drawing.Graphics3DGdiPlus.HorizontalLine(Int32 left, Int32 right, Int32 y)
at Steema.TeeChart.Styles.Histogram.HorizLine(Int32 X0, Int32 X1, Int32 Y)
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.DrawAllSeries(Graphics3D g)
at Steema.TeeChart.Chart.InternalDraw(Graphics g, Boolean noTools)
at Steema.TeeChart.Chart.InternalDraw(Graphics g)
at Steema.TeeChart.Pocket.TChart.Draw(Graphics g)

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Histogram chart crashes when both X and Y has values

Post by Sandra » Wed Jan 04, 2012 2:58 pm

Hello BeijerElectronics,

I couldn't reproduce your problem using last version of TeeChartFor.Net 2011 and next code:

Code: Select all

 Steema.TeeChart.Pocket.TChart tChart1;
        Double[] x1, x;
        Double[] y;
        public Form1()
        {
            InitializeComponent();
           tChart1 = new Steema.TeeChart.Pocket.TChart();
            this.Controls.Add(tChart1);
            tChart1.Top = 50;
            tChart1.Left = 100;
            tChart1.Width = 200;
            tChart1.Height = 200;
            InitializeChart();
        }
 
        private void InitializeChart()
        {

            Steema.TeeChart.Styles.Histogram histogram = new Steema.TeeChart.Styles.Histogram(tChart1.Chart);
            Random rnd = new Random();
            tChart1.Aspect.View3D = false;
            x1 = new Double[100];
            x = new Double[100];
            y = new Double[100];
            for (int i = 0; i < 100; i++)
            {
                x[i] = i;
                y[i] = rnd.Next(1000);
            }
            histogram.Add(x, y);

        }

        private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < tChart1[0].Count; i++)
            {
                x1[i] = i + 2;
            }
            tChart1[0].Add(x1, y);
        }
Can you tell us if previous code appears the exception of throw your application?

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

BeijerElectronics
Newbie
Newbie
Posts: 30
Joined: Tue Sep 13, 2011 12:00 am

Re: Histogram chart crashes when both X and Y has values

Post by BeijerElectronics » Wed Jan 18, 2012 3:13 pm

You are testing this in the wrong Chart object. We experienced this issue in the WPF chart, not in the Pocket Chart

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Histogram chart crashes when both X and Y has values

Post by Sandra » Thu Jan 19, 2012 3:14 pm

Hello BeijerElectronics,

Ok. I couldn't reproduce your problem using last version of TeeChartFor.Net 2011 and next code in WPF:
XAML CODE:

Code: Select all

<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="465" Width="586"
        xmlns:my="clr-namespace:Steema.TeeChart.WPF;assembly=TeeChart.WPF">
    <Grid Height="346" Width="491">
        <my:TChart Name="tChart1" Margin="1,1,0,3" />
        <Button Content="Button" Height="25" HorizontalAlignment="Left" Margin="12,-39,0,0" Name="button1" VerticalAlignment="Top" Width="94" Click="button1_Click" />
    </Grid>
</Window>
C# CODE:

Code: Select all

  Double[] x1, x;
        Double[] y;
        public MainWindow()
        {
            InitializeComponent();
            InitializeComponent();
            tChart1.Width = 400;
            tChart1.Height = 300;
            InitializeChart();
        }      
        private void InitializeChart()
        {

            Steema.TeeChart.WPF.Styles.Histogram histogram = new Steema.TeeChart.WPF.Styles.Histogram(tChart1.Chart);
            Random rnd = new Random();
            tChart1.Aspect.View3D = false;
            x1 = new Double[100];
            x = new Double[100];
            y = new Double[100];
            for (int i = 0; i < 100; i++)
            {
                x[i] = i;
                y[i] = rnd.Next(1000);
            }
            histogram.Add(x, y);

        }

        private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < tChart1[0].Count; i++)
            {
                x1[i] = i + 2;
            }
            tChart1[0].Add(x1, y);
        }
Can you tell us if previous code appears the exception? If exception doesn't appear, please send us a simple project where we can reproduce your exception.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

BeijerElectronics
Newbie
Newbie
Posts: 30
Joined: Tue Sep 13, 2011 12:00 am

Re: Histogram chart crashes when both X and Y has values

Post by BeijerElectronics » Wed Feb 15, 2012 1:23 pm

Hello Sandra,

We were able to reproduce the issue in the Steema Pocket TChart.
Attached is a sample project. Note that there are two variables causing the exception - the size of the chart and the value of the XSerie[0].


See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
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.Line(Int32 x0, Int32 y0, Int32 x1, Int32 y1)
at Steema.TeeChart.Drawing.Graphics3DGdiPlus.VerticalLine(Int32 x, Int32 top, Int32 bottom)
at Steema.TeeChart.Styles.Histogram.VerticalLine(Int32 X, Int32 Y0, Int32 Y1)
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.DrawAllSeries(Graphics3D g)
at Steema.TeeChart.Chart.InternalDraw(Graphics g, Boolean noTools)
at Steema.TeeChart.Pocket.TChart.Draw(Graphics g)
at ChartTestApp.Form1.OnPaint(PaintEventArgs e) in C:\Users\michael\Documents\Visual Studio 2008\Projects\ChartTestApp\ChartTestApp\Form1.cs:line 52
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(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)
Attachments
ChartTestApp.zip
(26.83 KiB) Downloaded 409 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Histogram chart crashes when both X and Y has values

Post by Sandra » Fri Feb 17, 2012 4:16 pm

Hello

Your project works fine for me using last version of TeeChart.Net and your code, please see next image:
Histogram.jpg
Histogram.jpg (78.78 KiB) Viewed 10096 times
Can you tell us which version of TeeChart.Net are you using?

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

BeijerElectronics
Newbie
Newbie
Posts: 30
Joined: Tue Sep 13, 2011 12:00 am

Re: Histogram chart crashes when both X and Y has values

Post by BeijerElectronics » Mon Feb 20, 2012 1:50 pm

Hello Sandra,

For this project we used version 4.1.2012.1032.
If that is your version as well, could you try to increase the value of the xSeries[0]? The exception is triggered on my machine for 3, 4, 5, 10 and 100 alike.

Thanks in advance

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Histogram chart crashes when both X and Y has values

Post by Sandra » Tue Feb 21, 2012 10:41 am

Hello BeijerElectronics,

Can you confirm us if you change the Width and Height of TeeChart to:

Code: Select all

   m_Chart.Width = 200;
            m_Chart.Height = 300;
The problem doesn't appear for you?On the other hand, can you tell us if you use PocketPC (device o emulador) your application works without errors?

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

BeijerElectronics
Newbie
Newbie
Posts: 30
Joined: Tue Sep 13, 2011 12:00 am

Re: Histogram chart crashes when both X and Y has values

Post by BeijerElectronics » Tue Feb 21, 2012 1:38 pm

Hello Sandra,

The width and height must be possible for our customer to set to whatever value they want and since we use this control also on PC in a design time environment it must also work on PC.
It is not as easy to reproduce on CE device but on PC it is very easy. Just run the sample outside of an emulator.
It is crucial that this bug is solved ASAP. Please confirm that this is possible.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Histogram chart crashes when both X and Y has values

Post by Sandra » Tue Feb 21, 2012 3:29 pm

Hello BeijerElectronics,

Ok. Thanks for your information. You need know that the assembly of TeeChartPocket.dll is designed to applications of PocketPC(device or emulator) and not for PC. If you want your application works in PC, you need create an appliaction with WinForms and use TeeChart.dll assembly. So, I will be very grateful if you can check the problem appears in the emulator of PocketPC that you find in the VS2008 and tell us your results.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply