Back to Devexpress

How to: Create a 3D Stacked Area Chart

wpf-6900-controls-and-libraries-charts-suite-chart-control-examples-3d-chart-types-how-to-create-a-3d-stacked-area-chart.md

latest4.7 KB
Original Source

How to: Create a 3D Stacked Area Chart

  • Jun 07, 2019
  • 2 minutes to read

The following example demonstrates how to create a 3D Stacked Area chart. To do this, it is necessary to assign the ChartControl.Diagram property to XYDiagram3D, and then add two AreaStackedSeries3D objects with points to the diagram’s Diagram.Series collection.

vb
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes

Namespace StackedArea3DChart
    ''' <summary>
    ''' Interaction logic for Window1.xaml
    ''' </summary>
    Partial Public Class Window1
        Inherits Window
        Public Sub New()
            InitializeComponent()
        End Sub
    End Class
End Namespace
xaml
<Window x:Class="StackedArea3DChart.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts" Title="Window1" Height="350" Width="500">
    <Grid>
        <dxc:ChartControl Name="chartControl1">
            <dxc:ChartControl.Diagram>
                <dxc:XYDiagram3D>
                    <dxc:XYDiagram3D.Series>
                        <!--region #Series1-->
                        <dxc:AreaStackedSeries3D AreaWidth="0.7">
                            <dxc:AreaStackedSeries3D.Points>
                                <dxc:SeriesPoint Argument="A" Value="10" />
                                <dxc:SeriesPoint Argument="B" Value="12" />
                                <dxc:SeriesPoint Argument="C" Value="14" />
                                <dxc:SeriesPoint Argument="D" Value="17" />
                            </dxc:AreaStackedSeries3D.Points>
                        </dxc:AreaStackedSeries3D>
                        <!--endregion #Series1-->
                        <!--region #Series2-->
                        <dxc:AreaStackedSeries3D AreaWidth="0.7">
                            <dxc:AreaStackedSeries3D.Points>
                                <dxc:SeriesPoint Argument="A" Value="5" />
                                <dxc:SeriesPoint Argument="B" Value="4" />
                                <dxc:SeriesPoint Argument="C" Value="10" />
                                <dxc:SeriesPoint Argument="D" Value="12" />
                            </dxc:AreaStackedSeries3D.Points>
                        </dxc:AreaStackedSeries3D>
                        <!--endregion #Series2-->
                    </dxc:XYDiagram3D.Series>
                </dxc:XYDiagram3D>
            </dxc:ChartControl.Diagram>
        </dxc:ChartControl>
    </Grid>
</Window>
vb
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Configuration
Imports System.Data
Imports System.Linq
Imports System.Windows

Namespace StackedArea3DChart
    ''' <summary>
    ''' Interaction logic for App.xaml
    ''' </summary>
    Partial Public Class App
        Inherits Application
    End Class
End Namespace
xaml
<Application x:Class="StackedArea3DChart.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="Window1.xaml">
    <Application.Resources>

    </Application.Resources>
</Application>
csharp
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace StackedArea3DChart {
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window {
        public Window1() {
            InitializeComponent();
        }
    }
}