TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
-
MMS
- Newbie
- Posts: 6
- Joined: Mon Mar 22, 2004 5:00 am
Post
by MMS » Mon May 10, 2004 9:50 am
Hi everybody,
I get a
System.NullReferenceException at Steema.TeeChart.Styles.Series.Delete(Int32 index)
nearly every time I call the Delete-Method on a Line.
The error occurs since I use the registered version of TeeChart, v1.1.1544.23908. With the trial version I had before, v1.0.1197.1065, I had no problems.
Can someone tell me if there's a fix for this problem?
I'm using VisualStudio .NET C++.
-
Christopher
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
-
Contact:
Post
by Christopher » Tue May 11, 2004 7:41 am
Hi --
The error occurs since I use the registered version of TeeChart, v1.1.1544.23908. With the trial version I had before, v1.0.1197.1065, I had no problems.
Can someone tell me if there's a fix for this problem?
I'm using TeeChart v1.1.1544.23908 and CLRv1.1.4322.573 and the following works as expected here:
Code: Select all
private: System::Void Form1_Load(System::Object * sender, System::EventArgs * e)
{
line1->FillSampleValues();
}
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{
line1->Delete(2);
}
Could you please send me a code snippet I can run "as-is" to reproduce your problem here?
Many thanks!
-
MMS
- Newbie
- Posts: 6
- Joined: Mon Mar 22, 2004 5:00 am
Post
by MMS » Wed May 12, 2004 8:23 am
Thank you so far! Here is the code where the error occurs:
#pragma once
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
#using <teechart.dll>
namespace Delete_test
{
public __gc class COtherLines
{
public:
COtherLines(void)
{
this->testLine = new Steema::TeeChart::Styles::Line();
this->timer1 = new System::Windows::Forms::Timer();
this->timer1->Enabled = true;
this->timer1->Interval = 1000;
this->timer1->Tick += new System::EventHandler(this, timer1_Tick);
}
// Line
private: Steema::TeeChart::Styles::Line * testLine;
// Timer
private: System::Windows::Forms::Timer * timer1;
private: void refresh()
{
while (this->testLine->Count>10)
{
//the error always occurs at this line:
this->testLine->Delete(0);
}
System::DateTime now = System::DateTime::Now;
this->testLine->Add(now,30);
}
private: System::Void timer1_Tick(System::Object * sender, System::EventArgs * e)
{
this->refresh();
}
};
}
First I included the teechart.dll of the version v1.1.1544.23908 and the error occured after ten seconds. I included the teechart.dll of the version 1.0.1197.1065 next and no error occured. I hope you can help me!
-
Christopher
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
-
Contact:
Post
by Christopher » Wed May 12, 2004 2:08 pm
Hi --
Using 1.1.1544.23908, the following works fine. Does it work at your end?
Code: Select all
#pragma once
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
namespace WindowsApplication3
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public __gc class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
this->timer1->Enabled = true;
this->timer1->Interval = 100;
}
protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}
private: Steema::TeeChart::TChart * tChart1;
private: Steema::TeeChart::Styles::Line * line1;
private: System::Windows::Forms::Button * button1;
private: System::Windows::Forms::Timer * timer1;
private: System::ComponentModel::IContainer * components;
private:
/// <summary>
/// Required designer variable.
/// </summary>
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->components = new System::ComponentModel::Container();
this->tChart1 = new Steema::TeeChart::TChart();
this->line1 = new Steema::TeeChart::Styles::Line();
this->button1 = new System::Windows::Forms::Button();
this->timer1 = new System::Windows::Forms::Timer(this->components);
this->SuspendLayout();
//
// tChart1
//
//
// tChart1.Header
//
System::String* __mcTemp__1[] = new System::String*[1];
__mcTemp__1[0] = S"TeeChart";
this->tChart1->Header->Lines = __mcTemp__1;
this->tChart1->Location = System::Drawing::Point(32, 24);
this->tChart1->Name = S"tChart1";
this->tChart1->Series->Add(this->line1);
this->tChart1->TabIndex = 0;
//
// line1
//
//
// line1.Brush
//
this->line1->Brush->Color = System::Drawing::Color::Red;
//
// line1.Pointer
//
//
// line1.Pointer.Brush
//
this->line1->Pointer->Brush->Color = System::Drawing::Color::Red;
this->line1->Pointer->Style = Steema::TeeChart::Styles::PointerStyles::Rectangle;
this->line1->Title = S"line1";
//
// line1.XValues
//
this->line1->XValues->Order = Steema::TeeChart::Styles::ValueListOrder::Ascending;
//
// button1
//
this->button1->Location = System::Drawing::Point(448, 272);
this->button1->Name = S"button1";
this->button1->TabIndex = 1;
this->button1->Text = S"button1";
this->button1->Click += new System::EventHandler(this, button1_Click);
//
// timer1
//
this->timer1->Tick += new System::EventHandler(this, timer1_Tick);
//
// Form1
//
this->AutoScaleBaseSize = System::Drawing::Size(5, 13);
this->ClientSize = System::Drawing::Size(544, 310);
this->Controls->Add(this->button1);
this->Controls->Add(this->tChart1);
this->Name = S"Form1";
this->Text = S"Form1";
this->Load += new System::EventHandler(this, Form1_Load);
this->ResumeLayout(false);
}
private: System::Void Form1_Load(System::Object * sender, System::EventArgs * e)
{
}
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{
line1->Delete(2);
}
private: System::Void timer1_Tick(System::Object * sender, System::EventArgs * e)
{
this->refresh();
}
private: void refresh()
{
while (this->line1->Count>10)
{
//the error always occurs at this line:
this->line1->Delete(0);
}
System::DateTime now = System::DateTime::Now;
this->line1->Add(now,30);
}
};
}
-
Marjan
- Site Admin
- Posts: 745
- Joined: Fri Nov 07, 2003 5:00 am
- Location: Slovenia
-
Contact:
Post
by Marjan » Wed May 12, 2004 2:56 pm
Hi.
Additionally, it's always good idea to stop the timer while you're adding/deleting series. So, in the Timer OnTick event implementation, do the following:
1) stop the timer,
2) delete series point,
3) restart the timer.
-
MMS
- Newbie
- Posts: 6
- Joined: Mon Mar 22, 2004 5:00 am
Post
by MMS » Fri May 14, 2004 7:01 am
Thank you very much for your advice! Unfortunately both proposals do not help us.
@Marjan: we tried it and it does not make any differences, the error still occurs.
@Christopher Ireland: the code works fine, but our problem is that we do not produce the lines in a ".net Form class" but in an autonomous class.
That means, I have to show the same lines in several charts that are located in different Forms. So I just wanted to have one class that produces all lines, but does not visualize them and to add the lines to the charts in the other classes then. Strange is that it works with the evaluation version (see above) but not with the licensed version. Perhaps you can trie to call the constructor of our class quoted above in another class to reproduce the error. I hope you understand my problem!
Best regards, MMS
-
Christopher
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
-
Contact:
Post
by Christopher » Fri May 14, 2004 8:03 am
Hi --
@Christopher Ireland: the code works fine, but our problem is that we do not produce the lines in a ".net Form class" but in an autonomous class.
That means, I have to show the same lines in several charts that are located in different Forms. So I just wanted to have one class that produces all lines, but does not visualize them and to add the lines to the charts in the other classes then. Strange is that it works with the evaluation version (see above) but not with the licensed version. Perhaps you can trie to call the constructor of our class quoted above in another class to reproduce the error. I hope you understand my problem!
Well, I think I'd understand it better if you could send me a simple VC++ .NET project that I can run "as-is" to reproduce the problem here. If you could, please post the project here:
news://
www.berneda.com/steema.public.attachments
Many thanks!
-
MMS
- Newbie
- Posts: 6
- Joined: Mon Mar 22, 2004 5:00 am
Post
by MMS » Tue Jun 08, 2004 7:00 am
Hi,
sorry for the delay. I have posted a simple project.
I hope it helps you finding the error.
Regards, MMS
-
Christopher
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
-
Contact:
Post
by Christopher » Wed Jun 09, 2004 2:11 pm
Hi --
sorry for the delay. I have posted a simple project.
I hope it helps you finding the error.
Many thanks for the project. I've found the error and corrected it; the fix will be included into the next maintenance release due out shortly.
If you are a holder of a licence for the TeeChart for .NET source code, I can pass you the fix now.