Specifies the color for the trendline associated with a series defined by its index in a chart.
void object.SetSeriesTrendlineColor( int index, string color )
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 argument can be specified:
As a named color.
Example: "orange"
For a complete reference of predefined named colors, consult
the Predefined Colors Reference.
Named colors are always opaque.
As a hexadecimal value "#RRGGBB", where RR, GG and BB represent the
hexadecimal values of the red, green and blue components.
Example: "#FFA500" represents an orange color.
An optional alpha component can be added at the end of the string: "#RRGGBBAA".
Example: "#FFA50080" represents a semi-transparent orange color,
"#FFA500FF" represents an opaque orange color,
"#FFA50000" represents an fully transparent (invisible) orange color.
When generating several charts using a single chart object, the ClearAll method can be used between each generated charts.
The following JSP code illustrates use of the SetSeriesTrendlineColor method.
float[] values= new float[3]; // Define the series #0 values[0] = 10.5f; values[1] = 12.4f; values[2] = 15.9f; chart.SetSeriesValuesFromArray(0, values); // Define the series #1 values[0] = 13.1f; values[1] = 15.6f; values[2] = 19.2f; 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"); chart.ExportAsResponse();
SetSeriesColor Method | SetSeriesValueColor Method | ClearAll Method | Predefined Colors Reference
Applies To: Chart Object