In the Chart data region, colors can be used in different ways to enhance the chart's appearance, distinguish different series, point out or draw attention to data information such as averages, and more.
The Chart data region includes several pre-defined color palettes that can be used to automatically set the colors for data values in a series. The pre-defined palettes are as follows.
These enumerated values are accessed through the Series class with code like the following.
To write code in Visual Basic.NET
Visual Basic |
Copy Code
|
---|---|
Me.ChartControl1.Series(0).ColorPalette = Chart.ColorPalette.Iceberg |
To write code in C#
C# |
Copy Code
|
---|---|
this.ChartControl1.Series[0].ColorPalette = GrapeCity.ActiveReports.Chart.ColorPalette.Iceberg; |
Gradients can be used in object backdrops to enhance the visual appearance of various chart items. Gradients can be used in the following chart sections:
You can set gradients for a backdrop at run time by creating a BackdropItem, setting its Style property to Gradient, setting the GradientType, and setting the two colors to use for the gradient as shown in the following example.
To write code in Visual Basic.NET
Visual Basic |
Copy Code
|
---|---|
Imports GrapeCity.ActiveReports.Chart.Graphics |
Visual Basic |
Copy Code
|
---|---|
Dim bItem As New GrapeCity.ActiveReports.Chart.BackdropItem bItem.Style = Chart.Graphics.BackdropStyle.Gradient bItem.Gradient = Chart.Graphics.GradientType.Vertical bItem.Color = Color.Purple bItem.Color2 = Color.White Me.ChartControl1.Backdrop = bItem |
To write code in C#
C# |
Copy Code
|
---|---|
using GrapeCity.ActiveReports.Chart.Graphics; |
C# |
Copy Code
|
---|---|
GrapeCity.ActiveReports.Chart.BackdropItem bItem = new GrapeCity.ActiveReports.Chart.BackdropItem(); bItem.Style = GrapeCity.ActiveReports.Chart.Graphics.BackdropStyle.Gradient; bItem.Gradient = GrapeCity.ActiveReports.Chart.Graphics.GradientType.Vertical; bItem.Color = System.Drawing.Color.Purple; bItem.Color2 = System.Drawing.Color.White; this.ChartControl1.Backdrop = bItem; |