Back to Devexpress

SeriesPoint3DDataSourceAdapter Class

wpf-devexpress-dot-xpf-dot-charts-dot-seriespoint3ddatasourceadapter.md

latest8.4 KB
Original Source

SeriesPoint3DDataSourceAdapter Class

The source of series points bound to a data source.

Namespace : DevExpress.Xpf.Charts

Assembly : DevExpress.Xpf.Charts.v25.2.dll

NuGet Package : DevExpress.Wpf.Charts

Declaration

csharp
[SeriesPoint3DSourceCustomBindingProperties]
public class SeriesPoint3DDataSourceAdapter :
    SeriesPoint3DSourceBase,
    ISeriesDataAdapter,
    ISeriesBindingProvider,
    IBindingProvider,
    IFilteredComponent,
    IFilteredComponentBase
vb
<SeriesPoint3DSourceCustomBindingProperties>
Public Class SeriesPoint3DDataSourceAdapter
    Inherits SeriesPoint3DSourceBase
    Implements ISeriesDataAdapter,
               ISeriesBindingProvider,
               IBindingProvider,
               IFilteredComponent,
               IFilteredComponentBase

Example

In this example the manually created series will be populated with randomly generated points.

The following classes and properties are used in this example.

Class or PropertyDescription
Chart3DControl.SeriesSourceThe series source of the Chart3D control.
Series3DStorageThe storage of manually created series.
Series3DAn individual series.
Series3DBase.ViewThe view of the series.
Bar3DSeriesViewThe Bar series view.
Series3D.PointSourceThe source of series points.
SeriesPoint3DDataSourceAdapterConverts data objects to series points.
vb
Namespace Bar3DChart
   Public Class Point
        Private privateX As Double
        Public Property X() As Double
            Get
                Return privateX
            End Get
            Private Set(ByVal value As Double)
                privateX = value
            End Set
        End Property
        Private privateY As Double
        Public Property Y() As Double
            Get
                Return privateY
            End Get
            Private Set(ByVal value As Double)
                privateY = value
            End Set
        End Property
        Private privateZ As Double
        Public Property Z() As Double
            Get
                Return privateZ
            End Get
            Private Set(ByVal value As Double)
                privateZ = value
            End Set
        End Property

        Public Sub New(ByVal x As Double, ByVal y As Double, ByVal z As Double)
            Me.X = x
            Me.Y = y
            Me.Z = z
        End Sub
   End Class
End Namespace
xaml
<dxc:Series3DStorage>
    <dxc:Series3D DisplayName="Random Data"
                  CrosshairLabelPattern="({X:F2}; {Y:F2}): {V:F2}">
        <dxc:SeriesPoint3DDataSourceAdapter DataSource="{Binding Path=DataPoints}"
                                            XArgumentDataMember="X"
                                            YArgumentDataMember="Y"
                                            ValueDataMember="Z" />
        <dxc:Series3D.View>
            <dxc:Bar3DSeriesView BarSize="10, 10"
                                 EqualBarSize="True">
                <dxc:Bar3DSeriesView.BarModel>
                    <dxc:Bar3DBoxPointModel ShowFacets="False" />
                </dxc:Bar3DSeriesView.BarModel>
                <dxc:Bar3DSeriesView.Colorizer>
                    <dxc:RangeColorizer3D ApproximateColors="True" 
                                          RangeStops="0 50 100 150 200">
                        <dxc:RangeColorizer3D.Palette>
                            <dxc:CustomPalette>
                                <dxc:CustomPalette.Colors>
                                    <Color>#ff5a19</Color>
                                    <Color>#fead2d</Color>
                                    <Color>#e5e335</Color>
                                    <Color>#ace45c</Color>
                                    <Color>#6ec95c</Color>
                                </dxc:CustomPalette.Colors>
                            </dxc:CustomPalette>
                        </dxc:RangeColorizer3D.Palette>
                    </dxc:RangeColorizer3D>
                </dxc:Bar3DSeriesView.Colorizer>
            </dxc:Bar3DSeriesView>
        </dxc:Series3D.View>
    </dxc:Series3D>
</dxc:Series3DStorage>
vb
Imports System
Imports System.Collections.ObjectModel

Namespace Bar3DChart
    Public Class RandomDataViewModel
        Public Property DataPoints() As ObservableCollection(Of Point)
        Public Sub New()
            Dim barsCount As Integer = 200
            Dim maxValue As Integer = 200
            Me.DataPoints = DataGenerator.GenerateData(barsCount, maxValue)
        End Sub
    End Class
    Public NotInheritable Class DataGenerator

        Private Sub New()
        End Sub

        Public Shared Function GenerateData(ByVal pointCount As Integer, ByVal maxValue As Integer) As ObservableCollection(Of Point)
            Dim rand As New Random()
            Dim bars As New ObservableCollection(Of Point)()
            For i As Integer = 0 To pointCount - 1
                Dim bar As Point
                Dim x As Double = rand.NextDouble() * maxValue * 2
                Dim y As Double = rand.NextDouble() * maxValue * 2
                Dim z As Double = rand.NextDouble() * maxValue
                bar = New Point(x, y, z)
                bars.Add(bar)
            Next i
            Return bars
        End Function
    End Class
End Namespace
csharp
namespace Bar3DChart {
   public class Point {
        public double X { get; private set; }
        public double Y { get; private set; }
        public double Z { get; private set; }

        public Point(double x, double y, double z) {
            this.X = x;
            this.Y = y;
            this.Z = z;
        }
    }
}
csharp
using System;
using System.Collections.ObjectModel;

namespace Bar3DChart {
    public class RandomDataViewModel {
        public ObservableCollection<Point> DataPoints { get; set; }
        public RandomDataViewModel() {
            int barsCount = 200;
            int maxValue = 200;
            this.DataPoints = DataGenerator.GenerateData(barsCount, maxValue);
        }
    }
    public static class DataGenerator {
        public static ObservableCollection<Point> GenerateData(int pointCount, int maxValue) {
            Random rand = new Random();
            ObservableCollection<Point> bars = new ObservableCollection<Point>();
            for (int i = 0; i < pointCount; i++) {
                Point bar;
                double x = rand.NextDouble() * maxValue * 2;
                double y = rand.NextDouble() * maxValue * 2;
                double z = rand.NextDouble() * maxValue;
                bar = new Point(x, y, z);
                bars.Add(bar);
            }
            return bars;
        }
    }
}

Inheritance

Object DispatcherObject DependencyObject ContentElement FrameworkContentElement DXFrameworkContentElement DevExpress.Xpf.Charts.Chart3DNonVisualElement DevExpress.Xpf.Charts.Chart3DSourceBase SeriesPoint3DSourceBase SeriesPoint3DDataSourceAdapter

See Also

SeriesPoint3DDataSourceAdapter Members

DevExpress.Xpf.Charts Namespace