.netCHARTING v10.3 Documentation
Creating And Using Templates

Introduction
The 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 template
To 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.

 

Chart.SaveState("style1.xml");
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 template
Every chart that will be using style1.xml can do so with a single line of code:

Chart.LoadState("style1.xml");
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.