Back to Devexpress

Series3DDataSourceAdapter.ValueDataMember Property

wpf-devexpress-dot-xpf-dot-charts-dot-series3ddatasourceadapter-607ce460.md

latest9.4 KB
Original Source

Series3DDataSourceAdapter.ValueDataMember Property

Gets or sets the name of the data member whose values are used as values of generated series points.

Namespace : DevExpress.Xpf.Charts

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

NuGet Package : DevExpress.Wpf.Charts

Declaration

csharp
public string ValueDataMember { get; set; }
vb
Public Property ValueDataMember As String

Property Value

TypeDescription
String

The data member name.

|

Example

This example demonstrates how to automatically generate series. It visualizes the Iris Data Set obtained from the ics.uci.edu website.

This example uses the following classes and properties.

Class or PropertyDescription
Chart3DControl.SeriesSourceThe series source of the Chart3D control.
Series3DDataSourceAdapterConverts data objects to series.
Series3DDataSourceAdapter.SeriesTemplateThe template used to generate series.
Series3DTemplateThe series template.
Series3DBase.ViewThe view that will be used by all generated series.
Bubble3DSeriesViewThe 3D Bubbles series view.
vb
Imports System
Imports System.Collections.ObjectModel
Imports System.Windows
Imports System.Windows.Resources
Imports System.Xml.Linq

Namespace Bubbles
    Public Class IrisesViewModel
        Public Property Irises() As ObservableCollection(Of IrisData)
        Public Sub New()
            Me.Irises = DataLoader.GetIrises("/Data/IrisDataSet.xml")
        End Sub
    End Class
    Friend NotInheritable Class DataLoader

        Private Sub New()
        End Sub

        Public Shared Function GetIrises(ByVal filepath As String) As ObservableCollection(Of IrisData)
            Dim irisDataSet As New ObservableCollection(Of IrisData)()
            Dim uri As New Uri(filepath, UriKind.RelativeOrAbsolute)
            Dim info As StreamResourceInfo = Application.GetResourceStream(uri)
            Dim document As XDocument = XDocument.Load(info.Stream)
            If document Is Nothing Then
                Return irisDataSet
            End If
            For Each element As XElement In document.Element("IrisDataSet").Elements()
                Dim sepalLength As Double = Convert.ToDouble(element.Element("SepalLength").Value)
                Dim sepalWidth As Double = Convert.ToDouble(element.Element("SepalWidth").Value)
                Dim petalLength As Double = Convert.ToDouble(element.Element("PetalLength").Value)
                Dim petalWidth As Double = Convert.ToDouble(element.Element("PetalWidth").Value)
                Dim species As String = element.Element("Species").Value.ToString()
                irisDataSet.Add(New IrisData(species, sepalWidth, sepalLength, petalWidth, petalLength))
            Next element
            Return irisDataSet
        End Function
    End Class
End Namespace
vb
Namespace Bubbles
    Public Class IrisData

        Private species_Renamed As String

        Private sepalWidth_Renamed As Double

        Private sepalLength_Renamed As Double

        Private petalWidth_Renamed As Double

        Private petalLength_Renamed As Double

        Public ReadOnly Property Species() As String
            Get
                Return species_Renamed
            End Get
        End Property
        Public ReadOnly Property SepalWidth() As Double
            Get
                Return sepalWidth_Renamed
            End Get
        End Property
        Public ReadOnly Property SepalLength() As Double
            Get
                Return sepalLength_Renamed
            End Get
        End Property
        Public ReadOnly Property PetalWidth() As Double
            Get
                Return petalWidth_Renamed
            End Get
        End Property
        Public ReadOnly Property PetalLength() As Double
            Get
                Return petalLength_Renamed
            End Get
        End Property

        Public Sub New(ByVal species As String, ByVal sepalWidth As Double, ByVal sepalLength As Double, ByVal petalWidth As Double, ByVal petalLength As Double)
            Me.species_Renamed = species
            Me.sepalWidth_Renamed = sepalWidth
            Me.sepalLength_Renamed = sepalLength
            Me.petalWidth_Renamed = petalWidth
            Me.petalLength_Renamed = petalLength
        End Sub
    End Class
End Namespace
xaml
<dxc:Chart3DControl x:Name="chart"
                    AspectRatio="1,1,1"
                    Padding="0">
    <dxc:Chart3DControl.Legends>
        <dxc:Legend HorizontalPosition="Right"
                    VerticalPosition="Top">
            <dxc:Legend.Title>
                <dxc:LegendTitle Content="Iris Set"/>
            </dxc:Legend.Title>
        </dxc:Legend>
    </dxc:Chart3DControl.Legends>
    <dxc:Series3DDataSourceAdapter DataSource="{Binding Path=Irises}"
                                   SeriesDataMember="Species"
                                   XArgumentDataMember="SepalLength"
                                   YArgumentDataMember="PetalLength"
                                   ValueDataMember="SepalWidth"
                                   dxc:Bubble3DSeriesView.WeightDataMember="PetalWidth">
        <dxc:Series3DDataSourceAdapter.SeriesTemplate>
            <dxc:Series3DTemplate>
                <dxc:Series3DTemplate.View>
                    <dxc:Bubble3DSeriesView MinSize="0.1"
                                            MaxSize="0.5">
                        <dxc:Bubble3DSeriesView.MarkerModel>
                            <dxc:Marker3DSpherePointModel SphereDetalizationLevel="Low" />
                        </dxc:Bubble3DSeriesView.MarkerModel>
                    </dxc:Bubble3DSeriesView>
                </dxc:Series3DTemplate.View>
            </dxc:Series3DTemplate>
        </dxc:Series3DDataSourceAdapter.SeriesTemplate>
    </dxc:Series3DDataSourceAdapter>
</dxc:Chart3DControl>
csharp
namespace Bubbles {
    public class IrisData {
        string species;
        double sepalWidth;
        double sepalLength;
        double petalWidth;
        double petalLength;

        public string Species { get { return species; } }
        public double SepalWidth { get { return sepalWidth; } }
        public double SepalLength { get { return sepalLength; } }
        public double PetalWidth { get { return petalWidth; } }
        public double PetalLength { get { return petalLength; } }

        public IrisData(string species, double sepalWidth, double sepalLength, double petalWidth, double petalLength) {
            this.species = species;
            this.sepalWidth = sepalWidth;
            this.sepalLength = sepalLength;
            this.petalWidth = petalWidth;
            this.petalLength = petalLength;
        }
    }
}
csharp
using System;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Resources;
using System.Xml.Linq;

namespace Bubbles {
    public class IrisesViewModel {
        public ObservableCollection<IrisData> Irises { get; set; }
        public IrisesViewModel() {
            this.Irises = DataLoader.GetIrises("/Data/IrisDataSet.xml");
        }
    }
    static class DataLoader {
        public static ObservableCollection<IrisData> GetIrises(string filepath) {
            ObservableCollection<IrisData> irisDataSet = new ObservableCollection<IrisData>();
            Uri uri = new Uri(filepath, UriKind.RelativeOrAbsolute);
            StreamResourceInfo info = Application.GetResourceStream(uri);
            XDocument document = XDocument.Load(info.Stream);
            if (document == null) return irisDataSet;
            foreach (XElement element in document.Element("IrisDataSet").Elements()) {
                double sepalLength = Convert.ToDouble(element.Element("SepalLength").Value);
                double sepalWidth = Convert.ToDouble(element.Element("SepalWidth").Value);
                double petalLength = Convert.ToDouble(element.Element("PetalLength").Value);
                double petalWidth = Convert.ToDouble(element.Element("PetalWidth").Value);
                string species = element.Element("Species").Value.ToString();
                irisDataSet.Add(new IrisData(species, sepalWidth, sepalLength, petalWidth, petalLength));
            }
            return irisDataSet;
        }
    }
}

See Also

Series3DDataSourceAdapter Class

Series3DDataSourceAdapter Members

DevExpress.Xpf.Charts Namespace