ScottPlot 5 Demo (original) (raw)

The ScottPlot 5 Demo is a click-to-run application that demonstrates capabilities of ScottPlot. The demo application displays all ScottPlot 5 Cookbook recipes and demonstrates advanced user control features which are useful in GUI environments.

Notable Demos

These are some of the most useful demonstrations included in the ScottPlot Demo application:

Show Value Under Mouse

The show value under mouse demo uses the control’s MouseMove event to determine the position of the cursor using Plot.GetCoordinates(), determines if a data point is beneath the cursor, and if so places a circular Marker around it. Although this demo showcases data from scatter plots, the concept can be applied to any plot type.

Draggable Axis Lines

The draggable axis line demo shows how to use the user control’s MouseDown, MouseUp, and MouseMove events to check whether a plotted object is beneath the mouse, grab it when clicked, move it when dragged, and drop it. Although this demo only showcases dragging axis lines, this technique can be applied to add interactivity to any plot type.

Draggable Axis Spans

The draggable axis span demo shows how to use the user control’s MouseDown, MouseUp, and MouseMove events to check whether a plotted object is beneath the mouse, grab it when clicked, and move or resize it when dragged. Although this demo only showcases dragging axis spans, this technique can be applied to add interactivity to any plot type.

Draggable Data Points

The draggable points demo shows how to use the user control’s MouseDown, MouseUp, and MouseMove events to check whether a plotted object is beneath the mouse, grab it when clicked, move it when dragged, and drop it.

Selectable Data Points

The select points demo shows how to use the control’s MouseDown, MouseUp, and MouseMove events to track where the mouse was pressed, dragged, and released to determine which data points are within the mouse rectangle. It then places Marker objects over the selected data points. Notice that none of these plot types contain mouse-specific logic, but users can add their own without too much complexity.

Multiplot Layouts

The plot control’s Multiplot system may be used to add subplots and configure their placement in the figure as described on the Multiplot FAQ page and in this demo.

Multiplot with Shared Axes

The plot control’s Multiplot system may be used to add subplots and configure shared axis limits as described on the Multiplot and Shared Axes FAQ pages and in this demo.

Synchronizing Axes Across Multiple Plot Controls

The shared axes demo uses Plot.Axes.Link() to link axis limits between two separate plot controls so changes to the view of one plot are automatically applied to the other.

💡 Users may prefer the simplicity of the Multiplot system described above

Shared Axes

Axis limits may be shared across multiple plots using one of two strategies:

  1. Use the Multiplot system as demonstrated in the the multiplot with shared axes demo
  2. Place multiple controls and synchronize them as shown in multiple plot control demo

Resizable Multiplot

This window demonstrates how subplots can be given zero padding to achieve a collapsed effect, and a custom layout can be created which contains logic for interactivity to allow resizing using the mouse.

Axis Rules

The axis rules demo demonstrates how to add to the list of Plot.Axes.Rules which are applied before rendering each frame. This strategy can be used to set boundaries that limit how far the user can zoom in or out, lock the vertical or horizontal axis, or enforce equal axes scaling such that circles and squares cannot be stretched into rectangles and ellipses.

Continuously Autoscale

Custom logic may be applied to refine axis limits at the start of each render. A common use case, demonstrated here, is automatically scaling vertically to fit the range of data encompassed by the horizontal view. Implementation details may differ whether the data is displayed as a scatter plot, signal plot, or something else, but the underlying concept is the same.

Custom Plot Type

The custom plot type demo shows how to create a custom plot type that implements IPlottable to allow full customization over styling and behavior. Creating custom plot types is useful for experimenting with new types of plots and does not require editing ScottPlot’s source code.

The custom right-click menu shows how to customize the context menu that appears when users right-click the plot. Developers can call the control’s Menu.Clear() method to remove default menu items then call the control’s Menu.Add() method to add new items which call custom actions when clicked.

Custom Mouse Actions

The custom mouse actions demo shows how to customize which mouse actions perform various operations on the plot. This strategy can be used to enable alternative behaviors such as middle-click-drag panning, right-click autoscaling, and left-click launching a context menu.

Multi-Axis

The multi-axis demo plots data with largely different dimensions on multiple axes with different scales, then demonstrates how to interact with the multi-axis plot.

Plot Streaming Data

The data streamer demo displays live data using a fixed number of data points. The oldest data points are removed as new data points are shifted in. If the ManageAxisLimits property is enabled, the data streamer will automatically adjust the axis limits to keep the incoming data in view. The data streamer plot type has options for switching between a wipe view (like an ECG machine) and a scroll view (where the newest data is always on one side of the plot).

Plot Growing Data

The data logger demo displays live data in a List that grows as new data is added. If the ManageAxisLimits property is enabled, the data logger will automatically adjust the axis limits to keep the incoming data in view. The data logger plot type has options for switching between a full signal view or views that focus on the latest portion of the incoming signal.

Plot Live Financial Data

The Live Finance demo demonstrates how to display price OHLC data in real time, modifying the last bar for live updates and adding new bars as time progresses.

All WinForms Demo Windows

Download the WinForms demo at the top of the page to run these interactively

All WPF Demos

Download the ScottPlot repository on GitHub to run these interactively