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.
Demonstrates how ZoomExtentsModifier3D, OrbitModifier, MouseWheelModifier works and how to rotate camera.
Tip!
Click RV to rotate camera verticaly or click RH and rotate camera horizontaly.
The C#/WPF source code for the WPF Chart Gaps (Nulls) in Series 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.ZoomAndPanA3DChart.UseChartModifiers3D"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ext="http://schemas.abtsoftware.co.uk/scichart/exampleExternals"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:s3D="http://schemas.abtsoftware.co.uk/scichart3D"
d:DesignHeight="300"
d:DesignWidth="300"
mc:Ignorable="d">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ext:SciChart3DInteractionToolbar TargetSurface="{Binding Source={x:Reference Name=SciChart}}">
<Button HorizontalAlignment="Left"
Click="OnClickHorizontalRotate"
Content="RH"
Style="{StaticResource DefaultButtonStyle}"
ToolTipService.ToolTip="Rotate the Chart horizontal"/>
<Button HorizontalAlignment="Left"
Click="OnClickVerticalRotate"
Content="RV"
Style="{StaticResource DefaultButtonStyle}"
ToolTipService.ToolTip="Rotate the Chart vertical" />
</ext:SciChart3DInteractionToolbar>
<s3D:SciChart3DSurface x:Name="SciChart"
Grid.Column="1"
BorderThickness="0"
WorldDimensions="200,100,200">
<s3D:SciChart3DSurface.Camera>
<s3D:Camera3D x:Name="Camera3D" ZoomToFitOnAttach="True" />
</s3D:SciChart3DSurface.Camera>
<s3D:SciChart3DSurface.RenderableSeries>
<!-- To create a Scatter Chart, create a ScatterRenderableSeries3D and use a 3D point marker type -->
<s3D:ScatterRenderableSeries3D x:Name="ScatterSeries3D">
<s3D:ScatterRenderableSeries3D.PointMarker>
<s3D:SpherePointMarker3D Size="2.0" />
</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.ChartModifier>
<s3D:ModifierGroup3D>
<s3D:OrbitModifier3D ExecuteOn="MouseLeftButton" />
<s3D:MouseWheelZoomModifier3D />
<s3D:ZoomExtentsModifier3D AnimateDurationMs="500"
ResetPosition="200,200,200"
ResetTarget="0,0,0" />
</s3D:ModifierGroup3D>
</s3D:SciChart3DSurface.ChartModifier>
</s3D:SciChart3DSurface>
</Grid>
</UserControl>
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using SciChart.Charting3D.Model;
using SciChart.Core.Extensions;
namespace SciChart.Examples.Examples.Charts3D.ZoomAndPanA3DChart
{
/// <summary>
/// Interaction logic for UseChartModifiers3D.xaml
/// </summary>
public partial class UseChartModifiers3D : UserControl
{
public UseChartModifiers3D()
{
InitializeComponent();
Loaded += OnLoaded;
}
private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
{
var xyzDataSeries3D = new XyzDataSeries3D<double>();
const int count = 25;
double step = 0.3;
var random = new Random(0);
Color color;
for (int x = 0; x < count; x++)
{
// Color is applied to PointMetadata3D and overrides the default ScatterRenderableSeries.Stroke property
color = Color.FromArgb(0xFF, (byte)random.Next(50, 255), (byte)random.Next(50, 255), (byte)random.Next(50, 255));
for (int z = 1; z < count; z++)
{
var y = (z != 0) ? Math.Pow((double) z, step) : Math.Pow((double) z + 1, 0.3);
xyzDataSeries3D.Append(x, y, z, new PointMetadata3D(color, 2));
}
}
ScatterSeries3D.DataSeries = xyzDataSeries3D;
}
private void OnClickHorizontalRotate(object sender, RoutedEventArgs e)
{
Camera3D.OrbitalYaw = ((int) Camera3D.OrbitalYaw < 360) ? Camera3D.OrbitalYaw + 90 : (Camera3D.OrbitalYaw - 360) * (-1);
}
private void OnClickVerticalRotate(object sender, RoutedEventArgs e)
{
Camera3D.OrbitalPitch = ((int)Camera3D.OrbitalPitch < 89) ? Camera3D.OrbitalPitch + 90 : -90;
}
}
}