wpf-117340-controls-and-libraries-charts-suite-chart3d-control-series-provide-series-data.md
The Chart3DControl can display multiple series against three-dimensional data. At least three values are required to create a point in the 3D Chart. To visualize data, the chart uses three axes: x-axis, y-axis, and z-axis.
This help topic contains the following sections:
You can use the following data types for X and Y arguments:
The Chart3DControl determines the type of arguments based on underlying data. You can explicitly specify the Series3DBase.XArgumentScaleType and Series3DBase.YArgumentScaleType properties to prevent the chart from automatic type detection.
The 3D Chart only supports numeric values that are plotted on the value axis (z-axis).
Use the following XAML to create several series from a data source:
<dxc:Chart3DControl>
<dxc:Series3DDataSourceAdapter DataSource="{Binding Irises}"
SeriesDataMember="Species"
XArgumentDataMember="SepalLength"
YArgumentDataMember="PetalLength"
ValueDataMember="SepalWidth">
<dxc:Series3DDataSourceAdapter.SeriesTemplate>
<dxc:Series3DTemplate>
<dxc:Series3DTemplate.View>
<dxc:Point3DSeriesView/>
</dxc:Series3DTemplate.View>
</dxc:Series3DTemplate>
</dxc:Series3DDataSourceAdapter.SeriesTemplate>
</dxc:Series3DDataSourceAdapter>
</dxc:Chart3DControl>
Related API members:
| Member | Description |
|---|---|
| Chart3DControl.SeriesSource | The Chart3D control’s series source. (Content property) |
| Series3DDataSourceAdapter | Generates series from a data source based on a SeriesDataMember‘s values. |
| Series3DDataSourceAdapter.SeriesTemplate | The series template. |
To fine-tune specific generated series, use the Series3DDataSourceAdapter.CustomizeSeries event.
Use the following XAML to create series and add them to a series storage:
<dxc:Chart3DControl>
<dxc:Series3DStorage>
<dxc:Series3D/>
<dxc:Series3D/>
<!--...-->
</dxc:Series3DStorage>
</dxc:Chart3DControl>
Related API members:
| Member | Description |
|---|---|
| Chart3DControl.SeriesSource | The Chart3D control’s series source. (Content property) |
| Series3DStorage | The storage of manually created series. |
| Series3D | An individual series. |
The series storage allows you to create and configure series points manually if you do not have a data source of arguments and values. The following XAML demonstrates this approach:
<dxc:Series3D DisplayName="GDP by Year">
<dxc:SeriesPoint3DStorage>
<dxc:SeriesPoint3D XArgument="USA" YArgument="1/1/2014" Value="17348"/>
<!--Other points.-->
</dxc:SeriesPoint3DStorage >
</dxc:Series3D >
Related API members:
| Member | Description |
|---|---|
| Series3D.PointSource | The source of series’ points. (Content property) |
| SeriesPoint3DStorage | The storage of manually created points. |
| SeriesPoint3DStorage.Points | The collection of manually created points. (Content property) |
| SeriesPoint3D | An individual series point. |
| SeriesPoint3D.XArgument | Specifies the series point’s x-argument. |
| SeriesPoint3D.YArgument | Specifies the series point’s y-argument. |
| SeriesPoint3D.Value | Specifies the series point’s value. |
Use the following XAML to populate a series with points generated from an external source:
<dxc:Series3D DisplayName="Population Statistics">
<dxc:SeriesPoint3DDataSourceAdapter DataSource="{Binding Countries}"
XArgumentDataMember="Name"
YArgumentDataMember="Year"
ValueDataMember="Population"/>
</dxc:Series3D >
Related API members:
| Member | Description |
|---|---|
| Series3D.PointSource | The source of series’ points. (Content property) |
| SeriesPoint3DDataSourceAdapter | Generates series points based on the specified data source’s values. |
| SeriesPoint3DDataSourceAdapter.DataSource | The source whose values are used to generate series points. |
| SeriesPoint3DDataSourceAdapter.XArgumentDataMember | The name of the data member whose values are used as point x-arguments. |
| SeriesPoint3DDataSourceAdapter.YArgumentDataMember | The name of the data member whose values are used as point y-arguments. |
| SeriesPoint3DDataSourceAdapter.ValueDataMember | The name of the data member whose values are used as point values. |
You can use separate data arrays or collections as a source of arguments and values:
<dxc:Series3D DisplayName="Population Statistics">
<dxc:SeriesPoint3DMatrixAdapter XArguments="{Binding CountryNames}"
YArguments="{Binding Years}"
Values="{Binding Populations}"/>
</dxc:Series3D >
Related API members:
| Member | Description |
|---|---|
| Series3D.PointSource | The source of series’ points. (Content property) |
| SeriesPoint3DMatrixAdapter | Creates series points by the specified arguments and values. |
| SeriesPoint3DMatrixAdapter.XArguments | Specifies a source of x-arguments. |
| SeriesPoint3DMatrixAdapter.YArguments | Specifies a source of y-arguments. |
| SeriesPoint3DMatrixAdapter.Values | Specifies a source of values. |
The following example creates a series in code-behind:
private void Window_Loaded(object sender, RoutedEventArgs e) {
Chart3DControl chart = new Chart3DControl();
this.Content = chart;
Series3DStorage storage = new Series3DStorage();
chart.SeriesSource = storage;
Series3D series = new Series3D() { DisplayName = "Series 1" };
storage.Series.Add(series);
series.View = new Bubble3DSeriesView() { MarkerModel = new Marker3DSpherePointModel() };
SeriesPoint3DStorage pointstorage = new SeriesPoint3DStorage();
series.PointSource = pointstorage;
List<DataPoint> BubblePoints = new List<DataPoint>();
BubblePoints.Add(new DataPoint() { XArgument = "2", YArgument = "USA", Value = 10, Weight = 10 });
BubblePoints.Add(new DataPoint() { XArgument = "8", YArgument = "Canada", Value = 12, Weight = 15 });
BubblePoints.Add(new DataPoint() { XArgument = "6", YArgument = "France", Value = 15, Weight = 25 });
BubblePoints.Add(new DataPoint() { XArgument = "10", YArgument = "Italy", Value = 5, Weight = 5 });
BubblePoints.Add(new DataPoint() { XArgument = "7", YArgument = "Greece", Value = 13, Weight = 17 });
foreach (DataPoint dataPoint in BubblePoints) {
SeriesPoint3D seriesPoint = new SeriesPoint3D(dataPoint.XArgument, dataPoint.YArgument, dataPoint.Value);
Bubble3DSeriesView.SetWeight(seriesPoint, dataPoint.Weight);
pointstorage.Points.Add(seriesPoint);
}
}
public class DataPoint {
public string XArgument { get; set; }
public string YArgument { get; set; }
public double Value { get; set; }
public double Weight { get; set; }
}
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim chart As Chart3DControl = New Chart3DControl()
Me.Content = chart
Dim storage As Series3DStorage = New Series3DStorage()
chart.SeriesSource = storage
Dim series As Series3D = New Series3D() With {
.DisplayName = "Series 1"
}
storage.Series.Add(series)
series.View = New Bubble3DSeriesView() With {
.MarkerModel = New Marker3DSpherePointModel()
}
Dim pointstorage As SeriesPoint3DStorage = New SeriesPoint3DStorage()
series.PointSource = pointstorage
Dim BubblePoints As List(Of DataPoint) = New List(Of DataPoint)()
BubblePoints.Add(New DataPoint() With {
.XArgument = "2",
.YArgument = "USA",
.Value = 10,
.Weight = 10
})
BubblePoints.Add(New DataPoint() With {
.XArgument = "8",
.YArgument = "Canada",
.Value = 12,
.Weight = 15
})
BubblePoints.Add(New DataPoint() With {
.XArgument = "6",
.YArgument = "France",
.Value = 15,
.Weight = 25
})
BubblePoints.Add(New DataPoint() With {
.XArgument = "10",
.YArgument = "Italy",
.Value = 5,
.Weight = 5
})
BubblePoints.Add(New DataPoint() With {
.XArgument = "7",
.YArgument = "Greece",
.Value = 13,
.Weight = 17
})
For Each dataPoint As DataPoint In BubblePoints
Dim seriesPoint As SeriesPoint3D = New SeriesPoint3D(dataPoint.XArgument, dataPoint.YArgument, dataPoint.Value)
Bubble3DSeriesView.SetWeight(seriesPoint, dataPoint.Weight)
pointstorage.Points.Add(seriesPoint)
Next
End Sub
Public Class DataPoint
Public Property XArgument As String
Public Property YArgument As String
Public Property Value As Double
Public Property Weight As Double
End Class
Related API members:
| Member | Description |
|---|---|
| Series3DStorage | The storage of manually created series. |
| Chart3DControl.SeriesSource | The Chart3D control’s series source. |
| SeriesPoint3DStorage | The storage of manually created points. |
| Series3D.PointSource | The source of series points. |
The Chart3DControl uses the following principle to create points: for each x-argument, all y-arguments and values (the number of required values is equal to the number of y-arguments) are fetched from collections. Use the SeriesPoint3DMatrixAdapter.IsCorrectDimension property to check whether the value collection contains the required number of values to plot the chart.