Page 1 of 1
Histogram chart crashes when both X and Y has values
Posted: Wed Jan 04, 2012 9:31 am
by 16060157
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)
Re: Histogram chart crashes when both X and Y has values
Posted: Wed Jan 04, 2012 2:58 pm
by 10050769
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,
Re: Histogram chart crashes when both X and Y has values
Posted: Wed Jan 18, 2012 3:13 pm
by 16060157
You are testing this in the wrong Chart object. We experienced this issue in the WPF chart, not in the Pocket Chart
Re: Histogram chart crashes when both X and Y has values
Posted: Thu Jan 19, 2012 3:14 pm
by 10050769
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,
Re: Histogram chart crashes when both X and Y has values
Posted: Wed Feb 15, 2012 1:23 pm
by 16060157
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)
Re: Histogram chart crashes when both X and Y has values
Posted: Fri Feb 17, 2012 4:16 pm
by 10050769
Hello
Your project works fine for me using last version of TeeChart.Net and your code, please see next image:
- Histogram.jpg (78.78 KiB) Viewed 10058 times
Can you tell us which version of TeeChart.Net are you using?
Thanks,
Re: Histogram chart crashes when both X and Y has values
Posted: Mon Feb 20, 2012 1:50 pm
by 16060157
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
Re: Histogram chart crashes when both X and Y has values
Posted: Tue Feb 21, 2012 10:41 am
by 10050769
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,
Re: Histogram chart crashes when both X and Y has values
Posted: Tue Feb 21, 2012 1:38 pm
by 16060157
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.
Re: Histogram chart crashes when both X and Y has values
Posted: Tue Feb 21, 2012 3:29 pm
by 10050769
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,