Bubble3DSeriesView Class
The 3D bubbles series view.
Namespace: DevExpress.Xpf.Charts
Assembly:
DevExpress.Xpf.Charts.v24.1.dll
NuGet Package:
DevExpress.Wpf.Charts
Declaration
public class Bubble3DSeriesView :
Marker3DSeriesView,
IXYWSeriesView,
IXYSeriesView,
ISeriesView
Public Class Bubble3DSeriesView
Inherits Marker3DSeriesView
Implements IXYWSeriesView,
IXYSeriesView,
ISeriesView
The following image demonstrates this view in action.
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.
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
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
<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>
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;
}
}
}
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;
}
}
}
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Bubble3DSeriesView class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
See Also