SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
SciChart WPF ships with hundreds of WPF Chart Examples which you can browse, play with, view the source-code and even export each WPF Chart Example to a stand-alone Visual Studio solution. All of this is possible with the new and improved SciChart WPF Examples Suite, which ships as part of the SciChart WPF SDK.
This 3D Chart demo shows how to add Wavefront *.obj files to the SciChart3DSurface using our BaseSceneEntity type
Entities may be added to the SciChart3DSurface.Viewport3D.RootEntity, which is a type of BaseSceneEntity. Several objects are created and added to the scene. Some are transparent, some are opaque. Internally SciChart uses order-independent transparency algorithm to draw entities back to front so that transparency appears correctly to the user.
The C#/WPF source code for the WPF Add Objects To a 3D Chart example is included below (Scroll down!).
Did you know you can also view the source code from one of the following sources as well?
<UserControl x:Class="SciChart.Examples.Examples.Charts3D.Customize3DChart.AddObjectsToA3DChart"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:object="clr-namespace:SciChart.Charting3D.Visuals.Object;assembly=SciChart.Charting3D"
xmlns:s3D="http://schemas.abtsoftware.co.uk/scichart3D"
xmlns:ext="http://schemas.abtsoftware.co.uk/scichart/exampleExternals"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="300">
<UserControl.Resources>
<!-- The 3D chess objects models which are used in this example were created by Fabio Valle, objects are used for -->
<!-- demonstrating purposes only to show possibility how to load and manipulate the 3D objects on 3D scene. Fabio's email: fabiovalle3d@gmail.com -->
<object:ObjectModelSource x:Key="PawnLowObj3DSource" Source="pack://application:,,,/SciChart.Examples.ExternalDependencies;component/Resources/Objects/Pawn_Low.obj"/>
<object:ObjectModelSource x:Key="BishopLowObj3DSource" Source="pack://application:,,,/SciChart.Examples.ExternalDependencies;component/Resources/Objects/Bishop_Low.obj"/>
<object:ObjectModelSource x:Key="KingLowObj3DSource" Source="pack://application:,,,/SciChart.Examples.ExternalDependencies;component/Resources/Objects/King_Low.obj"/>
<object:ObjectModelSource x:Key="KnightLowObj3DSource" Source="pack://application:,,,/SciChart.Examples.ExternalDependencies;component/Resources/Objects/Knight_Low.obj"/>
<object:ObjectModelSource x:Key="QueenLowObj3DSource" Source="pack://application:,,,/SciChart.Examples.ExternalDependencies;component/Resources/Objects/Queen_Low.obj"/>
<object:ObjectModelSource x:Key="RookLowObj3DSource" Source="pack://application:,,,/SciChart.Examples.ExternalDependencies;component/Resources/Objects/Rook_Low.obj"/>
<object:Rotation3D x:Key="ObjRotationState" Axis="YAxis" Angle="180" />
<object:TextureSource x:Key="BlackTexture" Source="pack://application:,,,/SciChart.Examples.ExternalDependencies;component/Resources/Objects/BlackWoodTexture.jpg" />
<object:TextureSource x:Key="WhiteTexture" Source="pack://application:,,,/SciChart.Examples.ExternalDependencies;component/Resources/Objects/WhiteWoodTexture.jpg" />
<s3D:GradientColorPalette x:Key="HeightColorMap">
<s3D:GradientColorPalette.GradientStops>
<GradientStop Offset="1" Color="Black" />
<GradientStop Offset="0" Color="White" />
</s3D:GradientColorPalette.GradientStops>
</s3D:GradientColorPalette>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- The SciChart3DInteractionToolbar adds rotate, orbit, zoom, pan, zoom extents functionality -->
<!-- to the chart and is included for example purposes. -->
<!-- If you wish to know how to zoom and pan a 3D chart then do a search for Zoom Pan in the Examples suite! -->
<ext:SciChart3DInteractionToolbar TargetSurface="{Binding Source={x:Reference sciChart3DSurface}}" />
<s3D:SciChart3DSurface Name="sciChart3DSurface"
Grid.Column="1"
WorldDimensions="250,1,250">
<s3D:SciChart3DSurface.Camera>
<s3D:Camera3D Position="-400,200,400" Target="0,50,0" />
</s3D:SciChart3DSurface.Camera>
<s3D:SciChart3DSurface.RenderableSeries>
<s3D:SurfaceMeshRenderableSeries3D x:Name="surfaceMeshRenderableSeries"
DrawMeshAs="SolidMesh"
HeightScaleFactor="0.0"
Maximum="4"
MeshColorPalette="{StaticResource HeightColorMap}"
MeshPaletteMode="HeightMapSolidCells" />
</s3D:SciChart3DSurface.RenderableSeries>
<s3D:SciChart3DSurface.XAxis>
<s3D:NumericAxis3D DrawLabels="False"
DrawMajorTicks="False"
DrawMinorGridLines="False"
DrawMinorTicks="False"
PlaneBorderThickness="0.0"/>
</s3D:SciChart3DSurface.XAxis>
<s3D:SciChart3DSurface.YAxis>
<s3D:NumericAxis3D DrawLabels="False"
DrawMajorTicks="False"
DrawMinorGridLines="False"
DrawMinorTicks="False"
PlaneBorderThickness="0.0"/>
</s3D:SciChart3DSurface.YAxis>
<s3D:SciChart3DSurface.ZAxis>
<s3D:NumericAxis3D DrawLabels="False"
DrawMajorTicks="False"
DrawMinorGridLines="False"
DrawMinorTicks="False"
PlaneBorderThickness="0.0"/>
</s3D:SciChart3DSurface.ZAxis>
<s3D:SciChart3DSurface.ChartModifier>
<s3D:ModifierGroup3D>
<s3D:ZoomExtentsModifier3D AnimateDurationMs="500"
ResetPosition="-400,200,400"
ResetTarget="0,50,0" />
</s3D:ModifierGroup3D>
</s3D:SciChart3DSurface.ChartModifier>
<s3D:SciChart3DSurface.SceneObjects>
<!-- The 3D chess objects models which are used in this example were created by Fabio Valle, objects are used for -->
<!-- demonstrating purposes only to show possibility how to load and manipulate the 3D objects on 3D scene. Fabio's email: fabiovalle3d@gmail.com -->
<object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource PawnLowObj3DSource}" Position="0.1875, 0.6, 0.8125" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource PawnLowObj3DSource}" Position="2.5, 2, 107.5" CoordinateMode="DataCoordinates" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource PawnLowObj3DSource}" Position="0.1875, 0.6, 0.6875" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource PawnLowObj3DSource}" Position="0.4375, 0.6, 0.5625" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource PawnLowObj3DSource}" Position="0.1875, 0.6, 0.4375" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource PawnLowObj3DSource}" Position="0.1875, 0.6, 0.3125" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource PawnLowObj3DSource}" Position="0.1875, 0.6, 0.1875" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource PawnLowObj3DSource}" Position="0.1875, 0.6, 0.0625" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource RookLowObj3DSource}" Position="0.0625, 0.6, 0.9375" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource KnightLowObj3DSource}" Position="0.0625, 0.6, 0.8125" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2" Rotation="{StaticResource ObjRotationState}"/>
<object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource BishopLowObj3DSource}" Position="0.4375, 0.6, 0.3125" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2" Rotation="{StaticResource ObjRotationState}"/>
<object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource KingLowObj3DSource}" Position="0.0625, 0.6, 0.5625" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource QueenLowObj3DSource}" Position="0.0625, 0.6, 0.4375" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2" Rotation="{StaticResource ObjRotationState}"/>
<object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource BishopLowObj3DSource}" Position="0.0625, 0.6, 0.3125" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2" Rotation="{StaticResource ObjRotationState}"/>
<object:ObjectModel3D DrawBoundingBox="True" BoundingBoxStroke="White" TextureSource="{StaticResource BlackTexture}" Source="{StaticResource KnightLowObj3DSource}" Position="0.3125, 0.6, 0.3125" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2" Rotation="{StaticResource ObjRotationState}"/>
<object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource RookLowObj3DSource}" Position="0.0625, 0.6, 0.0625" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource WhiteTexture}" Source="{StaticResource PawnLowObj3DSource}" Position="0.8125, 0.6, 0.9375" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource WhiteTexture}" Source="{StaticResource PawnLowObj3DSource}" Position="0.8125, 0.6, 0.8125" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource WhiteTexture}" Source="{StaticResource PawnLowObj3DSource}" Position="0.8125, 0.6, 0.6875" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource WhiteTexture}" Source="{StaticResource PawnLowObj3DSource}" Position="0.5625, 0.6, 0.5625" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource WhiteTexture}" Source="{StaticResource PawnLowObj3DSource}" Position="0.8125, 0.6, 0.4375" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource WhiteTexture}" Source="{StaticResource PawnLowObj3DSource}" Position="0.8125, 0.6, 0.3125" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource WhiteTexture}" Source="{StaticResource PawnLowObj3DSource}" Position="0.8125, 0.6, 0.1875" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource WhiteTexture}" Source="{StaticResource PawnLowObj3DSource}" Position="0.8125, 0.6, 0.0625" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource WhiteTexture}" Source="{StaticResource RookLowObj3DSource}" Position="109.375, 0.1, 109.375" CoordinateMode="WorldCoordinates" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource WhiteTexture}" Source="{StaticResource KnightLowObj3DSource}" Position="109.375, 0.1, 78.125" CoordinateMode="WorldCoordinates" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource WhiteTexture}" Source="{StaticResource BishopLowObj3DSource}" Position="109.375, 0.1, -46.875" CoordinateMode="WorldCoordinates" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource WhiteTexture}" Source="{StaticResource KingLowObj3DSource}" Position="109.375, 0.1, 15.625" CoordinateMode="WorldCoordinates" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource WhiteTexture}" Source="{StaticResource QueenLowObj3DSource}" Position=" 46.875, 0.1, 46.875" CoordinateMode="WorldCoordinates" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource WhiteTexture}" Source="{StaticResource BishopLowObj3DSource}" Position="109.375, 0.1, -49.875" CoordinateMode="WorldCoordinates" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource WhiteTexture}" Source="{StaticResource KnightLowObj3DSource}" Position="109.375, 0.1, -78.125" CoordinateMode="WorldCoordinates" Scale="0.2, 0.2, 0.2"/>
<object:ObjectModel3D TextureSource="{StaticResource WhiteTexture}" Source="{StaticResource RookLowObj3DSource}" Position="109.375, 0.1, -109.375" CoordinateMode="WorldCoordinates" Scale="0.2, 0.2, 0.2"/>
</s3D:SciChart3DSurface.SceneObjects>
</s3D:SciChart3DSurface>
</Grid>
</UserControl>
// *************************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2021. All rights reserved.
//
// Web: http://www.scichart.com
// Support: support@scichart.com
// Sales: sales@scichart.com
//
// AddObjectsToA3DChart.xaml.cs is part of the SCICHART® Examples. Permission is hereby granted
// to modify, create derivative works, distribute and publish any part of this source
// code whether for commercial, private or personal use.
//
// The SCICHART® examples are distributed in the hope that they will be useful, but
// without any warranty. It is provided "AS IS" without warranty of any kind, either
// expressed or implied.
// *************************************************************************************
using System.Windows.Controls;
using SciChart.Charting3D.Model;
namespace SciChart.Examples.Examples.Charts3D.Customize3DChart
{
public partial class AddObjectsToA3DChart : UserControl
{
public AddObjectsToA3DChart()
{
InitializeComponent();
var dataSeries = new UniformGridDataSeries3D<double>(9, 9)
{
StartX = 1,
StepX = 1,
StartZ = 100,
StepZ = 1
};
for (int x = 0; x < 9; x++)
{
for (int z = 0; z < 9; z++)
{
if (z % 2 == 0)
{
dataSeries[z, x] = (x % 2 == 0 ? 1 : 4);
}
else
{
dataSeries[z, x] = (x % 2 == 0 ? 4 : 1);
}
}
}
surfaceMeshRenderableSeries.DataSeries = dataSeries;
}
}
}