Namespace: GlobFX.SwiffChartGenerator
Assembly: GlobFX.SwiffChartGenerator (in GlobFX.SwiffChartGenerator.dll)

Specifies the color for the trendline associated with a series defined by its index in a chart.

Visual Basic
Public Sub SetSeriesTrendlineColor( index As Integer, color As String )
Public Sub SetSeriesTrendlineColor( index As Integer, color As System.Drawing.Color )
C#
public void SetSeriesTrendlineColor( int index, string color );
public void SetSeriesTrendlineColor( int index, System.Drawing.Color color );

Arguments

index
An integer value that specifies the zero-based index of the series in the chart object.
color
A string that specifies the color or a System.Drawing.Color structure.

Remarks

By default, a trendline takes its colors from the chart style.

This method does not add a trendline to a series. The trendline should have been previously added to the series with Swiff Chart.

If the index argument refers to a series that does not exist in the chart object, the series is created.


The color string argument can be specified:

If the color argument is an empty string, the default original color is restored.
If the color argument cannot be recognized, the black color is used.

When generating several charts using a single chart object, the ClearAll method can be used between each generated charts.

Sample Code

The following code illustrates use of the SetSeriesTrendlineColor method.

Visual Basic
Dim values As Double(2)

' Define the series #0
values(0) = 10.5
values(1) = 12.4
values(2) = 15.9
chart.SetSeriesValuesFromArray(0, values)

' Define the series #1
values(0) = 13.1
values(1) = 15.6
values(2) = 19.2
chart.SetSeriesValuesFromArray(1, values)

chart.LoadStyle("C:\\my-style-with-trendline.scs")

' Set the color of trendline associated to series #1
chart.SetSeriesTrendlineColor(1, "tomato")
C#
double[] values= new double[3];

// Define the series #0
values[0] = 10.5;
values[1] = 12.4;
values[2] = 15.9;
chart.SetSeriesValuesFromArray(0, values);

// Define the series #1
values[0] = 13.1;
values[1] = 15.6;
values[2] = 19.2;
chart.SetSeriesValuesFromArray(1, values);

chart.LoadStyle("C:\\my-style-with-trendline.scs");

// Set the color of trendline associated to series #1
chart.SetSeriesTrendlineColor(1, "tomato");

See Also

SetSeriesColor Method | SetSeriesValueColor Method | ClearAll Method | Predefined Colors Reference

Applies To: Chart Object