In This Topic
The chart walls are one of the important chart components, which contribute for the realistic 3D look of the scene and improve the readability of the presented data. Each NChart object has a collection of NChartWall objects, which contains exactly five instances: left wall, back wall, right wall, front wall and floor. The walls collection can be accessed with the help of the Walls property of the NChart object. To access a particular wall you can use the GetWall method of the NChartWallCollection. It takes a parameter of type ChartWallType which indicates the desired wall.
C# |
Copy Code
|
NChartWall backWall = chart.Walls.GetWall(ChartWallType.Back);
|
Visual Basic |
Copy Code
|
Dim backWall As NChartWall = chart.Walls.GetWall(ChartWallType.Back)
|
A shorter way to gain access to a wall is the Wall method of the NChart object:
C# |
Copy Code
|
NChartWall backWall = chart.Wall(ChartWallType.Back);
|
Visual Basic |
Copy Code
|
Dim backWall As NChartWall = chart.Wall(ChartWallType.Back)
|
With the help of the NChartWall object you are able to control various aspects of the chart walls including their visibility, width, fill style, border style and interactivity features. The code below changes some properties of the back chart wall.
C# |
Copy Code
|
backWall.Visible = true;
backWall.Width = 4;
backWall.FillStyle = new NColorFillStyle(Color.Green);
|
Visual Basic |
Copy Code
|
backWall.Visible = True
backWall.Width = 4
backWall.FillStyle = New NColorFillStyle(Color.Green)
|
In 3D mode Cartesian charts have six walls (one wall for each side of the chart box). In 2D mode Cartesian charts can display only the back wall (ChartWallType.Back). Polar and Radar charts have only one chart wall, while Pie, Funnel and Venn don't have walls at all.
Automatic walls for 3D Cartesian charts
The walls of 3D Cartesian charts can be adjusted to hide and show automatically according to the position of the camera. To enable this feature you have to set the VisibilityMode property of each chart wall to WallVisibilityMode.Auto.
C# |
Copy Code
|
foreach (NChartWall wall in chart.Walls)
{
wall.VisibilityMode = WallVisibilityMode.Auto;
}
|
Visual Basic |
Copy Code
|
For Each wall As NChartWall In chart.Walls
wall.VisibilityMode = WallVisibilityMode.Auto
Next
|
When the chart is rotated (for example with the mouse trackball tool) the walls are displayed only if they don't obstruct the chart contents. This feature, along with automatic axis anchors and projection dependent lighting allows you to create 3D charts that are fully rotatable and can be viewed from all sides.
Related Examples
Windows forms: Panels\Chart\Walls\General
Windows forms: Panels\Chart\Walls\Auto Walls and Axes Visibility
See Also