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 demo showcases the loading or startup time of SciChart by appending one million points to the chart and rendering in under 100ms!
Example Usage
Click ‘Create Data’ to create 1 million points instantly!
Then Zoom and Pan the chart to see the smoothness.
Documentation Links
– Performance Tips and Tricks
– How Fast is SciChart’s WPF Chart? DirectX vs. Software Comparison
The C#/WPF source code for the WPF Chart Load 1Million Points Instantly 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.PerformanceDemos2D.LoadMillions.LoadMillionsPageView"
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:s="http://schemas.abtsoftware.co.uk/scichart"
xmlns:s3D="http://schemas.abtsoftware.co.uk/scichart3D"
d:DesignHeight="400"
d:DesignWidth="600"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/SciChart.Examples.ExternalDependencies;component/Resources/Styles/ToolbarButtonsCommon.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ext:SciChartInteractionToolbar x:Name="UserToolbar" TargetSurface="{Binding Source={x:Reference Name=sciChart}}">
<Button Command="{Binding RunExampleCommand}"
Content="Load"
Padding="0"
FontSize="11"
Style="{StaticResource DefaultButtonStyle}" />
</ext:SciChartInteractionToolbar>
<s:SciChartSurface x:Name="sciChart"
Grid.Column="1"
ViewportManager="{Binding ViewportManager}">
<s:SciChartSurface.RenderableSeries>
<s:FastLineRenderableSeries DataSeries="{Binding DataSeries}" Stroke="DarkOrange" />
</s:SciChartSurface.RenderableSeries>
<s:SciChartSurface.XAxis>
<s:NumericAxis />
</s:SciChartSurface.XAxis>
<s:SciChartSurface.YAxis>
<s:NumericAxis />
</s:SciChartSurface.YAxis>
<s:SciChartSurface.ChartModifier>
<s:ModifierGroup>
<s:RubberBandXyZoomModifier IsAnimated="True" />
<s:CursorModifier ShowTooltip="True"/>
<s:ZoomPanModifier ClipModeX="None"
ExecuteOn="MouseLeftButton"
ReceiveHandledEvents="True" />
<s:ZoomExtentsModifier IsAnimated="True" />
</s:ModifierGroup>
</s:SciChartSurface.ChartModifier>
<!-- Some hints to the user -->
<s:SciChartSurface.Annotations>
<s:CustomAnnotation CoordinateMode="Relative"
HorizontalAnchorPoint="Left"
Margin="10,150,0,0"
VerticalAnchorPoint="Center"
X1="0"
Y1="0" >
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="20"
Opacity="0.7"
Background="#232323"
Text="Click "
Foreground="#FFF" />
<Image Width="32"
Height="32"
Source="/SciChart.Examples;component/Resources/Images/load_button.png"
Stretch="None" />
<TextBlock FontSize="20"
Opacity="0.7"
Background="#232323"
Text=" for loading one million points to the chart and rendering in under 100ms!"
Foreground="#FFF" />
</StackPanel>
</s:CustomAnnotation>
</s:SciChartSurface.Annotations>
</s:SciChartSurface>
<s:SciChartPerformanceOverlay Grid.Column="1"
Margin="0,0,50,0"
VerticalAlignment="Top"
Background="#33FFFFFF"
FontWeight="Bold"
Foreground="#FFF"
Padding="10"
IsHitTestVisible="False"
TargetSurface="{Binding Source={x:Reference Name=sciChart}}" />
</Grid>
</UserControl>
// *************************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2022. All rights reserved.
//
// Web: http://www.scichart.com
// Support: support@scichart.com
// Sales: sales@scichart.com
//
// LoadMillionsPageView.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;
namespace SciChart.Examples.Examples.PerformanceDemos2D.LoadMillions
{
public partial class LoadMillionsPageView : UserControl
{
public LoadMillionsPageView()
{
InitializeComponent();
}
}
}
// *************************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2022. All rights reserved.
//
// Web: http://www.scichart.com
// Support: support@scichart.com
// Sales: sales@scichart.com
//
// LoadMillionsPageViewModel.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;
using System.Diagnostics;
using System.Threading.Tasks;
using SciChart.Charting.Common.Helpers;
using SciChart.Charting.Model.DataSeries;
using SciChart.Charting.ViewportManagers;
using SciChart.Examples.ExternalDependencies.Common;
using SciChart.Examples.ExternalDependencies.Data;
namespace SciChart.Examples.Examples.PerformanceDemos2D.LoadMillions
{
public class LoadMillionsPageViewModel : BaseViewModel
{
private IUniformXyDataSeries<double> _dataSeries;
private const int Count = 1000000;
public LoadMillionsPageViewModel()
{
RunExampleCommand = new ActionCommand(OnRunExample);
}
public ActionCommand RunExampleCommand { get; private set; }
public IViewportManager ViewportManager { get; } = new DefaultViewportManager();
public IUniformXyDataSeries<double> DataSeries
{
get => _dataSeries;
set
{
if (_dataSeries != value)
{
_dataSeries = value;
OnPropertyChanged("DataSeries");
}
}
}
public void OnPageExit()
{
DataSeries = null;
}
private void OnRunExample()
{
Task.Factory.StartNew(() =>
{
DataSeries = null;
// Generate Data and mark time
var dataSeries = new UniformXyDataSeries<double>();
var stopwatch = Stopwatch.StartNew();
var yData = new RandomWalkGenerator(0d).GetRandomWalkYData(Count);
stopwatch.Stop();
// Append to SciChartSurface and mark time
stopwatch = Stopwatch.StartNew();
dataSeries.Append(yData);
DataSeries = dataSeries;
stopwatch.Stop();
// Zoom viewport to extents
ViewportManager.AnimateZoomExtents(TimeSpan.FromMilliseconds(500));
});
}
}
}