Loading a template file creates problems for a tower series.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
VH1
Advanced
Posts: 105
Joined: Thu May 13, 2004 4:00 am
Location: UK

Loading a template file creates problems for a tower series.

Post by VH1 » Mon Jan 23, 2006 5:22 pm

1.1.2179.21092

This article relates to
http://www.teechart.net/support/viewtopic.php?t=2961
and
http://www.teechart.net/support/viewtopic.php?t=3376

To recreate...

In designer...

Add a teechart to a form.
Add a commander bar and set the chart property.

Run...

Add a tower series
Add a random data source (just select random and apply)

Click a button which does the following operation...

private void button1_Click(object sender, System.EventArgs e)
{

string path = string.Format("{0}\\Charts", Application.StartupPath);

// Determine whether the directory exists.
if(!System.IO.Directory.Exists(path))
{
// Try to create the directory.
System.IO.DirectoryInfo di = System.IO.Directory.CreateDirectory(path);
}


string strChartTemplatePath = Application.StartupPath + @"\Charts\01.Ten";

// Store the existing chart.
System.IO.FileStream fsCreate = null;

if(strChartTemplatePath != null)
{
// Overwrite the existing file
fsCreate = new System.IO.FileStream(strChartTemplatePath,System.IO.FileMode.Create);

this.tChart1.Export.Template.Save(fsCreate);
}

if(fsCreate != null)
{
fsCreate.Close();
}

FileStream fsOpen = null;

if(strChartTemplatePath != null)
{
fsOpen = new System.IO.FileStream(strChartTemplatePath, System.IO.FileMode.Open);

this.tChart1.Import.Template.Load(fsOpen);
}

if(fsOpen != null)
{
fsOpen.Close();
}


this.commander1.Chart = this.tChart1;
}




Conclusion....

A red bar appears as the first XYZ value oon the chart.

Regards,

Vaughan

Post Reply