Examples for the Scatter 3D Chart can be found in the SciChart WPF Examples Suite which can be downloaded from the SciChart Website or our SciChart.WPF.Examples Github Repository.
3D Scatter Charts are provided by the ScatterRenderableSeries3D type, which requires a PointMarker.
The ScatterRenderableSeries3D supports multiple pointmarkers, including:
3D Marker Types
- SpherePointMarker3D - a 3D Sphere at each point
- CubePointMarker3D - 3D Cube at each point
- PyramidPointMarker3D - a 3D Pyramid at each point
- CylinderPointMarker3D - a 3D Cylinder at each point
Fast 2D Marker types
- PixelPointMarker3D - a single pixel at each point
- QuadPointMarker3D - a Quad (flat square) facing the camera at each point
- EllipsePointMarker3D - a flat ellipse facing the camera at each point
- TrianglePointMarker3D - a flat triangle facing the camera at each point
- CustomPointMarker3D - custom flat textured markers facing the camera at each point
Declaring a 3D Scatter Series
To declare a 3D Scatter Series with PointMarker use the following code:
View |
Copy Code
|
---|---|
<s3D:SciChart3DSurface x:Name="SciChart" Grid.Column="1" BorderThickness="0" WorldDimensions="200,100,200"> <s3D:SciChart3DSurface.Camera> <s3D:Camera3D ZoomToFitOnAttach="True" /> </s3D:SciChart3DSurface.Camera> <s3D:SciChart3DSurface.RenderableSeries> <s3D:ScatterRenderableSeries3D x:Name="ScatterSeries3D"> <s3D:ScatterRenderableSeries3D.PointMarker> <s3D:EllipsePointMarker3D Fill="LimeGreen" Size="2.0" Opacity="1"/> </s3D:ScatterRenderableSeries3D.PointMarker> </s3D:ScatterRenderableSeries3D> </s3D:SciChart3DSurface.RenderableSeries> <s3D:SciChart3DSurface.XAxis> <s3D:NumericAxis3D GrowBy="0.1,0.1" /> </s3D:SciChart3DSurface.XAxis> <s3D:SciChart3DSurface.YAxis> <s3D:NumericAxis3D GrowBy="0.1,0.1" /> </s3D:SciChart3DSurface.YAxis> <s3D:SciChart3DSurface.ZAxis> <s3D:NumericAxis3D GrowBy="0.1,0.1" /> </s3D:SciChart3DSurface.ZAxis> </s3D:SciChart3DSurface> |
Code Behind |
Copy Code
|
---|---|
private void OnLoaded(object sender, RoutedEventArgs routedEventArgs) { var xyzDataSeries3D = new XyzDataSeries3D<double>(); for (var i = 0; i < Count; i++) { var x = DataManager.Instance.GetGaussianRandomNumber(5, 1.5); var y = DataManager.Instance.GetGaussianRandomNumber(5, 1.5); var z = DataManager.Instance.GetGaussianRandomNumber(5, 1.5); xyzDataSeries3D.Append(x, y, z); } ScatterSeries3D.DataSeries = xyzDataSeries3D; PointMarkerCombo.SelectedIndex = 0; } |
NOTE: You can also declare RenderableSeries using full MVVM (series ViewModels) using the SeriesBinding MarkupExtension. Please see MVVM DataSeries / RenderableSeries API for more details.
Coloring Individual Scatter Points
Scatter points may be colored or scaled individually using the PointMetada3D API. To do this, set a PointMetada3D instance at the data-point as follows:
Example Title |
Copy Code
|
---|---|
xyzDataSeries3D.Append(x, y, z, new PointMetadata3D(Colors.Blue, 1.0d));
|