The attributes that define how a series of data looks in the scatter plot are called a Chart3DStyle. Each series has its own Chart3DStyle, which can be customized. The Chart3DStyle object allows the following properties of a series to be changed programmatically:
The Chart3DStylesCollection contains the Chart3DStyle objects defined for each series. The following methods are defined for the Chart3DStylesCollection:
Method | Description |
---|---|
AddNewStyle() | Add a new ChartStyle object to the collection. |
Remove(index) | Remove a ChartStyle object from the collection. |
Normally, manual adding or removing of Chart3DStyle objects from the collection is not needed. If a Chart3DStyle object already exists when its corresponding series is created, the previously created Chart3DStyle object is used to display the data in this series.
Looping through the Chart3DstylesCollection can quickly change the behavior of all of the lines or points in a chart. For example, the following code lightens all of the points in a chart whenever the mouse is clicked:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub C1Chart3D1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles C1Chart3D1.Click Dim Style As Chart3DStyle For Each Style in Chart3D1.ChartGroups.ChartStyles Style.SymbolStyle.Color = Color.White Next Style End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
private void c1Chart3D1_Click(object sender, System.EventArgs e) { foreach(Chart3DStyle sty in c1Chart3D1.ChartGroups.ChartStyles) sty.SymbolStyle.Color = Color.White; } |
The following sets the line pattern for the second series to a dotted line:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
C1Chart3D1.ChartGroups.ChartStyles(1).LineStyle.Pattern = LinePatternEnum.Dot |
To write code in C#
C# |
Copy Code
|
---|---|
C1Chart3D1.ChartGroups.ChartStyles[1].LineStyle.Pattern = LinePatternEnum.Dot; |
And the following statement sets the symbol style for the third series to an unfilled circle:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
C1Chart3D1.ChartGroups.ChartStyles(2).SymbolStyle.Shape = SymbolShapeEnum.Circle |
To write code in C#
C# |
Copy Code
|
---|---|
C1Chart3D1.ChartGroups.ChartStyles[2].SymbolStyle.Shape = SymbolShapeEnum.Circle; |
You can easily format the Scatter Plot's data point symbols shape, size, color, and width using the properties of the Chart3DSymbolStyle class.
Use the Symbol Shape property to set the symbol type, the Size property to set its size, and the Color properties to set the symbol color for a ChartStyle. The valid types of symbols are shown below:
Type | Image | Type | Image |
---|---|---|---|
None | Vertical Line | ||
Dot | Horizontal Line | ||
Box | Cross | ||
Triangle | Circle | ||
Diamond | Square | ||
Star | Inverted Triangle | ||
Diagonal Cross | Open Triangle | ||
Open Diamond | Open Inverted Triangle |
These properties are available at design time under the LineStyle node in the Chart3DStyle Collection Editor.