Page 1 of 1

Loading a template file creates problems for a tower series.

Posted: Mon Jan 23, 2006 5:36 pm
by 8125470
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

Posted: Tue Jan 24, 2006 9:11 am
by 8125470
I found a workaround for this, but dont understand why I have to do it?

The line...

((Steema.TeeChart.Styles.Series)this.tChart1[0]).ColorEach = false;

is required after loading the file which removes this annoying red tower.

Regards,

Vaughan

Posted: Tue Jan 24, 2006 9:32 am
by narcis
Hi Vaughan,

I've been able to reproduce this problem here. However, I've checked that this already works using our latest v1 and v2 sources so you can expect this to be fixed for the next maintenance release.