Back to Devexpress

Simple 2D Diagram

wpf-115309-controls-and-libraries-charts-suite-chart-control-diagram-simple-2d-diagram.md

latest4.5 KB
Original Source

Simple 2D Diagram

  • May 28, 2021
  • 2 minutes to read

The document highlights the Simple 2D Diagram’s specifics. This diagram displays series such as Pies and Donuts in a two-dimensional view.

This document consists of the following sections:

Compatible Series Types

The diagram can only contain series of compatible types. You can add the following series to the Simple 2D Diagram:

Series typeImage
Pie and Donut
Nested Donut
Funnel

Refer to the Series Type Compatibility document to learn more about series compatibility.

How to Create a Chart with a Simple Diagram

The markup below demonstrates how to design a chart with a simple diagram that contains two pie series.

xaml
<dxc:ChartControl>
    <!-- Simple diagram settings. -->
    <dxc:SimpleDiagram2D Dimension="2" 
                         LayoutDirection="Vertical">
        <!-- The first Pie series settings. -->
        <dxc:PieSeries2D>
            <dxc:SeriesPoint Argument="A" Value="6"/>
            <dxc:SeriesPoint Argument="B" Value="11"/>
            <dxc:SeriesPoint Argument="C" Value="15"/>
        </dxc:PieSeries2D>
        <!-- The second Pie series settings. -->
        <dxc:PieSeries2D>
            <dxc:SeriesPoint Argument="A" Value="10"/>
            <dxc:SeriesPoint Argument="B" Value="7"/>
            <dxc:SeriesPoint Argument="C" Value="12"/>
        </dxc:PieSeries2D>
    </dxc:SimpleDiagram2D>
</dxc:ChartControl>

The markup uses the following classes and properties:

Class or PropertyDescription
ChartControlThe Chart control.
SimpleDiagram2DThe 2D Simple diagram.
SimpleDiagram2D.DimensionSpecifies the number of pie charts that can be in one line (row or column).
SimpleDiagram2D.LayoutDirectionSpecifies how separate series are relative to each other (horizontally or vertically).
PieSeries2DA pie series.
SeriesPointA series point.
SeriesPoint.ArgumentA series point’s argument.
SeriesPoint.ValueA series point’s value.

You can also access a 2D Simple Diagram at runtime using the following code:

csharp
// Cast Diagram to the SimpleDiagram2D type. 
SimpleDiagram2D diagram = chart.Diagram as SimpleDiagram2D;
if (diagram != null) {
    // Access the diagram's options. 
    diagram.Dimension = 2;
    diagram.LayoutDirection = LayoutDirection.Vertical;
}
vb
' Cast Diagram to the SimpleDiagram2D type. 
Dim diagram As SimpleDiagram2D = TryCast(chart.Diagram, SimpleDiagram2D)
If diagram IsNot Nothing Then
    ' Access the diagram's options. 
    diagram.Dimension = 2
    diagram.LayoutDirection = LayoutDirection.Vertical
End If

See Also

Simple 3D Diagram

How to: Create a 2D Pie (Donut) Chart

How to: Create a 2D Nested Donut Chart

How to: Create a 2D Funnel Chart