IntroductionThe chart component is capable of saving its state including all property settings, elements, etc. to an XML file. This functionality provides the ability to save a chart template consisting of any color, styling, and label related properties and load it onto charts so that their styles match.

Make a templateTo make a template, start with a simple chart with some elements and apply any settings necessary to establish the chart styling. When this is complete, the following code will save the property settings to an xml file called style1.xml.

[C#]
Chart.SaveState("style1.xml");

[Visual Basic]
Chart.SaveState("style1.xml")

Make sure to save the state before any elements are added to the chart so that other charts that consume this style dont get the elements along with it.

Loading a templateEvery chart that will be using style1.xml can do so with a single line of code:

[C#]
Chart.LoadState("style1.xml");

[Visual Basic]
Chart.LoadState("style1.xml")

SmartPalettes provide Element Colors & Palettes, however, if they are included in the chart before it's saved, they will be used when loaded as well.