SciChart WPF Examples

repository·master·Indexed 42 days ago

https://github.com/abtsoftware/scichart.wpf.examples

A comprehensive suite of examples, tutorials, and sandboxes for the SciChart WPF high-performance real-time charting library. Includes implementation guides for 2D and 3D charts using code-behind and MVVM patterns, DirectX renderer deployment, and advanced customization via the Hit-Test API and ChartModifierBase.

Tokens
4.6K
Snippets
6
Records
25
Agent score
52%

What's inside SciChart

  1. Explore SciChart WPF Chart Types

    master

    The repository contains examples for a wide variety of 2D and 3D chart types. You can find source code and implementation details for these in the /Examples folder.

    2D Chart Types

    • Line, Band, Candlestick/OHLC, Column, Pie, Donut, Mountain/Area, Scatter, Impulse/Stem, Bubble, Error Bars, Stacked Mountain, Stacked Column, 100% Stacked Mountain, 100% Stacked Column, Radar, Heatmap, Spectrogram, and Polar charts.

    3D Chart Types (DirectX-powered)

    • 3D Bubble, 3D Point Cloud, 3D Scatter, 3D Column, 3D Surface Mesh, 3D Impulse, and 3D Waterfall charts.
  2. Understand the Benchmark Test Cases

    master

    The benchmark evaluates SciChart's drawing performance across four distinct scenarios:

    1. NxM series test: Tests performance under extremely high series counts (e.g., 100x100, 500x500, and 1000x1000 series).
    2. Scatter chart test: Tests the ability to display high point counts on scatter charts (from 1k up to 1 million points).
    3. FIFO chart test: Tests scrolling performance for a First-In-First-Out (FIFO) strip chart using 1k to 10M points.
    4. Append test: Tests big-data capabilities by appending data to a series in blocks (100, 1k, 10k, etc.) until millions of points are reached.
  3. Explore SciChart Sandbox Examples

    master

    The SciChart.Sandbox.sln contains a wide variety of implementation patterns for SciChart WPF. Key categories of examples include:

    • MVVM Integration: Applying styles to axes via StyleKey, adding scrollbars to axes, binding AnnotationViewModel to UI elements (like TextBox), and creating custom CompositeAnnotation or CustomRenderableSeries using the MVVM API.
    • 3D Charting: Dynamically changing 3D gridline/text colors, mimicking 2D charts on 3D axis walls using scatter series, and using the Hit-Test 3D API to retrieve points via mouse clicks.
    • Customization & Modifiers: Creating custom ChartModifierBase classes for zooming, panning, or selection, and implementing complex legends using LegendItemTemplate.
    • Data Handling: Animating DataSeries, using resampling (downsampling) for large GridDataSeries3D datasets, and implementing real-time scrolling strip charts or sweeping ECG traces.
    • Exporting & Printing: Exporting multiple charts to a single bitmap, printing to XPS, and performing off-screen exports to .png files.
    • Advanced Axis & Labeling: Using LabelProvider to format numbers as dates or strings on axes, and creating multi-row DateTimeAxis labels.
    • Specialized Chart Types: Market Profile (Histogram) overlays on candlestick charts, thresholded series (background shading), and column series without gaps.
  4. Correctly apply the SciChart Runtime Key in your application

    master

    To avoid licensing issues, follow these two rules when implementing the SciChart Runtime key in your WPF or WinForms application:

    1. Set it early: The Runtime Key must be set before any SciChartSurface instances are created.
    2. Set it once: Ensure the key is set exactly once in your application lifecycle.

    For complex scenarios, such as when SciChart is used within a DLL, refer to the Licensing in a DLL FAQ.

  5. Performance Optimizations in SciChart WPF v5.1+

    master

    To achieve high-performance rendering similar to the benchmark, the following optimizations can be enabled in your SciChart WPF application:

    • Direct3D11RenderSurface: Enables DirectX drawing for improved GPU-accelerated performance.
    • Extreme Drawing Manager: Optimized manager specifically for line series.
    • Extreme Resamplers: Used for handling and rendering extremely large datasets efficiently.
  6. Use the Sandbox for Customization and Licensing Tests

    master

    The /Sandbox folder contains specialized tools and examples:

    • Licensing Test App: Located in /Sandbox/LicensingTestApp, this app is used to help debug SciChart license issues.
    • Customer Examples: Located in /Sandbox/CustomerExamples, this directory contains various examples of advanced SciChart customization.
  7. Alternative ways to maintain chart aspect ratio

    master

    If you do not want to manually manipulate axis ranges, there are two other primary methods to maintain a constant aspect ratio in SciChart WPF:

    1. Uniform Container: Place the SciChartSurface inside a WPF container that enforces a constant aspect ratio (e.g., a container that maintains a 1:1 ratio).
    2. TickProvider API: Use the TickProvider API to maintain constant-sized gridlines, which helps keep the visual scale consistent.
  8. Understand Licensing and Repository Usage

    master

    SciChart WPF License

    SciChart WPF is commercial software. You can use a free 30-day trial, and academic/non-profit users may qualify for free educational licenses.

    Repository License

    While the SciChart library itself is commercial, all code within the abtsoftware/scichart.wpf.examples repository is covered by the MIT license. This means you are free to use the example, demo, and tutorial code within your own applications.

  9. Deploying applications with the SciChart DirectX renderer plugin

    master

    To use the DirectX renderer plugin in SciChart, you must explicitly enable it and manage its dependencies. The plugin is not enabled by default and requires the SharpDX library.

    Key Dependency Note: The plugin depends on a C++ library from SharpDX called sharpdx_direct3d11_1_effects_x64.dll. If you are using NuGet, these DLLs are typically handled automatically. However, if you are referencing SharpDX manually (without NuGet), you must manually include both sharpdx_direct3d11_1_effects_x64.dll and sharpdx_direct3d11_1_effects_x86.dll in your project. These files can be found in the SciChart Installer download.

  10. Setup the SciChart Bleeding-Edge NuGet feed

    master

    To build the Fifo 100 Million Points Demo, you must add the private SciChart NuGet feed for BETA packages to Visual Studio. This allows the IDE to automatically restore the required packages during compilation.

    1. Open Visual Studio.
    2. Navigate to Tools -> Options -> NuGet.
    3. Under Package Sources, add a new source named SciChart Bleeding-Edge.
    4. Use the following URL for the source: https://www.myget.org/F/abtsoftware-bleeding-edge/api/v3/index.json.
    https://www.myget.org/F/abtsoftware-bleeding-edge/api/v3/index.json
  11. Run the Fifo 100 Million Points Demo for optimal performance

    master

    To achieve the performance levels demonstrated in this sample (e.g., 30 FPS at 100,000,000 points), follow these execution guidelines:

    • Build Configuration: Use Release Mode.
    • Execution: Run the application without a debugger attached.

    Note: Running in Debug mode results in a ~50% performance slowdown, and the debugger increases CPU and memory overhead.