How to set the Interior color for the Chart and the Chart series?
The WinForms Chart control, to set the interior color of a chart, use the ChartInterior property. This property allows you to specify the interior of the chart, including the chart background and the chart area background. For a series, use its Interior property to set the solid back color, gradient, or pattern style, including both the back and forecolor of a chart point’s background.
You can set the interior color for:
- Entire Chart using ChartInterior property
- Chart Background using BackInterior property
- Chart Area using ChartArea.BackInterior property
- Individual Series using Interior property
For more details on customizing chart appearance, refer to the Winforms Chart documentation.
this.chartControl1 = new ChartControl();
. . .
//Specifies Chart Interior
this.chartControl1.ChartInterior = new BrushInfo(GradientStyle.Vertical, Color.AntiqueWhite, Color.LightYellow);
//Chart Background Interior
this.chartControl1.BackInterior = new BrushInfo(GradientStyle.PathEllipse, Color.MistyRose, Color.LightYellow);
// Chart Area Interior
this.chartControl1.ChartArea.BackInterior = new BrushInfo(GradientStyle.ForwardDiagonal, Color.MistyRose, Color.LightYellow);
//Specifies Series Interior Color
this.chartControl1.Series[0].Style.Interior = new BrushInfo(175, new BrushInfo(GradientStyle.BackwardDiagonal, new BrushInfoColorArrayList(new Color[] { Color.SaddleBrown, Color.Salmon })));
Me.ChartControl1 = New ChartControl()
. . .
'Specifies Chart Interior
Me.ChartControl1.ChartInterior = New BrushInfo(GradientStyle.Vertical, Color.AntiqueWhite, Color.LightYellow)
'Chart Background Interior
Me.ChartControl1.BackInterior = New BrushInfo(GradientStyle.PathEllipse, Color.MistyRose, Color.LightYellow)
' Chart Area Interior
Me.ChartControl1.ChartArea.BackInterior = New BrushInfo(GradientStyle.ForwardDiagonal, Color.MistyRose, Color.LightYellow)
'Specifies Series Interior Color
Me.ChartControl1.Series(0).Style.Interior = New BrushInfo(175, New BrushInfo(GradientStyle.BackwardDiagonal, New BrushInfoColorArrayList(New Color() {Color.SaddleBrown, Color.Salmon})))
Conclusion
I hope you enjoyed learning how to set the Interior color for the Chart and the Chart series.
You can refer to our WinForms Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. You can also explore our WinForms Chart examples to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!