Page 1 of 1

Themes and XML

Posted: Thu Sep 27, 2007 4:51 pm
by 9792387
TeeChart .NET v3.2.2796.22187
Visual Basic 2005 Express
Windows XP Pro SP2

Hi,

Can anyone give me info on how to use the custom themes? I want to save a custom theme based on the current chart. Later, I want to read that theme back in and apply it to a different chart. I do this:

Code: Select all

ATheme = New Steema.TeeChart.Themes.CustomTheme(TChart1.Chart)
ATheme.WriteToXML("C:\temp\atheme.xml")
The XML file is created. However, I can't figure out how to load that theme back in and apply it to a chart. I tried this:

Code: Select all

ATheme.ReadFromXML("C:\temp\atheme.xml")
Visual Basic tells me "Access of a shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated."

Jay

Posted: Fri Sep 28, 2007 8:16 am
by narcis
Hi Jay,

You'll find an example on how to save and load custom themes at What's New?\Welcome !\New in Chart Themes\Custom Themes in the features demo, available at TeeChart's program group.

Themes and XML

Posted: Fri Sep 28, 2007 6:35 pm
by 9792387
Thanks,

I was looking under "Al Features" because I thought that would include the new stuff.

Jay

Themes and XML

Posted: Fri Sep 28, 2007 8:15 pm
by 9792387
It appears that Axis.Title.Font.Size and Axis.Title.Font.Bold are not saved as part of the theme.

Is there a way I can add these two properties (or others) to a theme?

Jay

Posted: Mon Oct 01, 2007 8:13 am
by narcis
Hi Jay,

This works fine for me here using this code:

Code: Select all

		private void Form1_Load(object sender, EventArgs e)
		{
			line1.FillSampleValues();
			bar1.FillSampleValues();

			tChart1.Axes.Bottom.Title.Text = "hello!";
			tChart1.Axes.Bottom.Title.Font.Size = 16;
			tChart1.Axes.Bottom.Title.Font.Bold = true;

			SaveCustomTheme();
			tChart2.Clear();
			tChart2.Import.Theme.Load(themeDirectory + "\\My Theme.xml");			
		}

		private string themeDirectory;

		private void SaveCustomTheme()
		{
			themeDirectory = Steema.TeeChart.Utils.ThemeFolder();
			tChart1.Export.Theme.SaveWithBase64 = true;
			tChart1.Export.Theme.Save(themeDirectory + "\\My Theme.xml");
		}
Could you please try if it works fine at your end?

Thanks in advance!