AltColorSetID: String;
AltColorSetID: String;
The AltColorSetID property determines identifier of alternative color palette for a chart series.
An alternative color palette is set using an XML file. Colors from the alternative palette are taken one by one.
If the property is not set or contains identifier of non-existing set, the default palette is used.
To execute the example, on the form place the Button, ChartBox and UiChart components (in the Fore.NET example use the ChartBoxNet and UiChartNet components) named BUTTON1, CHARTBOX1/CHARTBOXNET1 and UICHART1/UICHARTNET1 respectively. Set the number of points and series in the properties for the UiChart/UiChartNet component. The UICHART1/UICHARTNET1 component is a data source for CHARTBOX1/CHARTBOXNET1. To plot a chart, create the event handlers OnGetDataValue and OnGetSerieName.
Add links to the Chart, Forms, Xml, Forms.NET and MsXml2 (for Fore.NET example) system assemblies.
The current chart formatting style is saved in the Test.xml document to the C drive. A new custom palette with the EXAMPLE identifier with set colors is created in the document in the <SeriePalette> subsection of the <DefaultSerieDecoration> section. For example:
...
<DefaultSerieDecoration>
...
<SeriePalette version="1" count="1" id="EXAMPLE">
<COLOR0>#ff000000</COLOR0>
</SeriePalette>
...
</DefaultSerieDecoration>
...
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
chart: IChart;
serie: IChartSerie;
res: boolean;
doc: IXmlDomDocument;
element: IXmlDomElement;
Begin
chart := UiChart1.Chart;
doc := New DOMDocument60.Create;
res := doc.load("C:\Test.xml");
element := doc.documentElement;
Chart.LoadDecoration(element);
serie := chart.Series.Item(0);
serie.AltColorSetID := "EXAMPLE";
End Sub Button1OnClick;
Imports Prognoz.Platform.Interop.Chart;
Imports Prognoz.Platform.Interop.Forms;
Imports Prognoz.Platform.Forms.Net;
Imports Prognoz.Platform.Interop.MsXml2;
…
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
chart: IChart;
serie: IChartSerie;
res: boolean;
doc: IXmlDomDocument;
element: IXmlDomElement;
Begin
chart := UiChart1.Chart;
doc := New DOMDocument60.Create;
res := doc.load("C:\Test.xml");
element := doc.documentElement;
Chart.LoadDecoration(element);
serie := chart.Series.Item[0];
serie.AltColorSetID := "EXAMPLE";
End Sub;
After executing the example the first chart series changes its color to the first color specified in the custom palette.
See also: