The DefaultLabelStyle property of the ChartLabels object sets a default style for all current and future ChartLabels. This property can be useful in many ways, but two are outlined here.
First, this property sets default style properties that all future Labels will inherit. Secondly, since all labels inherit this default style, if a default style property is changed, all of the ChartLabels will then take on this attribute. For instance, suppose 100 ChartLabels created at design time should have had green as the BackColor, the following code could be inserted into the application:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
C1Chart1.ChartLabels.DefaultLabelStyle.BackColor = Color.Green |
To write code in C#
C# |
Copy Code
|
---|---|
c1Chart1.ChartLabels.DefaultLabelStyle.BackColor = Color.Green; |
If style attributes for individual ChartLabels have to be changed, then these attributes can be set on the specific ChartLabel object manually.