Canvas.Views.Web 1.2.4-prerelease

This is a prerelease version of Canvas.Views.Web.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Canvas.Views.Web --version 1.2.4-prerelease
                    
NuGet\Install-Package Canvas.Views.Web -Version 1.2.4-prerelease
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Canvas.Views.Web" Version="1.2.4-prerelease" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Canvas.Views.Web" Version="1.2.4-prerelease" />
                    
Directory.Packages.props
<PackageReference Include="Canvas.Views.Web" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Canvas.Views.Web --version 1.2.4-prerelease
                    
#r "nuget: Canvas.Views.Web, 1.2.4-prerelease"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Canvas.Views.Web@1.2.4-prerelease
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Canvas.Views.Web&version=1.2.4-prerelease&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Canvas.Views.Web&version=1.2.4-prerelease&prerelease
                    
Install as a Cake Tool

Canvas - Financial Charts

The fastest charting web control targeting primarily Blazor, both Server Side and Web Assembly, and even ASP.NET MVC. This charting library was designed for Web, but it can also be used in Desktop apps via Web View. The main purpose of this library is to be used as a charting tool for real-time financial applications, e.g. backtesters for trading strategies. Here is the most comprehensive guide dedicated to charting in .NET that I have seen so far. Nevertheless, trying various options from that guide I wasn't able to find anything fast and flexible enough for my needs, so created my own.

  • Examples can be found here
  • Possible application of this library is here

Nuget

Install-Package Canvas.Views.Web

Drawing Methods

Currently available controls.

  • Engine - abstract base Canvas control exposing drawing context of various frameworks, like GDI or SkiaSharp
  • CanvasEngine - a wrapper around SkiaSharp and Open GL

To add different view types, e.g. GDI+, Direct 2D, Win UI, Open GL, implement IEngine interface.

Chart Types

At the moment, there are four built-in chart types.

  • Line - line
  • Bar - polygon
  • Area - polygon
  • Arrow - polygon
  • Candle - OHLC box, a mix of a line and a rectangle polygon

To add new chart types, e.g. Error Bars or Bubbles, implement IGroupModel interface.

Pan and Zoom

The chart is data-centric, thus in order to scale the chart you need to change the data source. By default, the chart displays last 100 data points, as defined in IndexCount property.

MinIndex = Items.Count - IndexCount
MaxIndex = Items.Count

To pan the chart to the left, subtract arbitrary value from both MinIndex and MaxIndex.

MinIndex -= 1
MaxIndex -= 1

To pan the chart to the right, do the opposite.

MinIndex += 1
MaxIndex += 1

To zoom in, increase MinIndex and decrease MaxIndex to decrease number of visible points.

MinIndex += 1
MaxIndex -= 1

To zoom out, do the opposite.

MinIndex -= 1
MaxIndex += 1

Data source structure

The simplest format used by the library is a list of models with a single Point property.


<CanvasWebView @ref="ViewControl"></CanvasWebView>

@code
{
  public CanvasWebView ViewControl { get; set; }

  protected override async Task OnAfterRenderAsync(bool setup)
  {
    var points = Enumerable.Range(1, 100).Select(i => new BarGroupModel
    {
      Index = i,
      Value = new Model { ["Point"] = new Random().Next(-5000, 5000) }
    } as IPointModel);

    ViewControl.Composer = new Composer
    {
      Name = name,
      Points = points.ToList(),
      Engine = new CanvasEngine(1000, 500)
    };

    ViewControl.Create();
    ViewControl.Update();
  }
}

In case when charts have to be synchronized or overlapped within the same viewport, data source should have format of a list where each entry point has a time stamp and a set of Areas and Series that will be rendered in the relevant viewport.

[
  DateTime
  {
    Area A
    {
      Line Series => double,
      Candle Series => OHLC
    },
    Area B 
    {
      Line Series => double,
      Line Series => double
    },
    Area C 
    {
      Bar Series => double
    }
  }, 
  DateTime { ... },
  DateTime { ... },
  DateTime { ... }
]

  • Area is a viewport, an actual chart, each viewport can show several types of series, e.g. a mix of candles and lines.
  • Series is a single chart type to be displayed in the viewport, e.g. lines.
  • Model is a data point of dynamic type, can accept different type of inputs, e.g. double or OHLC box.

At this moment, Canvas supports only horizontal orientation, so the axis X is used as an index scale that picks data points from the source list and axis Y is a value scale that represents the actual value of each data point.

Roadmap

The current version is already the fastest .NET charting library, but it can be even faster if instead of rerendering HTML elements Blazor will simply show or hide them using CSS.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.6.9 216 5/8/2025
5.6.8 163 5/7/2025
5.6.7 170 5/7/2025
5.6.6 171 5/7/2025
5.6.5 154 2/4/2025
5.6.3 146 1/28/2025
5.6.2 140 1/20/2025
5.6.1 123 1/17/2025
5.6.0 114 1/17/2025
5.5.0 124 1/8/2025
5.0.0 148 12/27/2024
4.5.6 140 12/10/2024
4.5.5 241 10/26/2024
4.5.4 123 10/26/2024
4.5.3 151 10/25/2024
4.5.2 123 10/24/2024
4.5.1 136 10/24/2024
4.5.0 127 10/24/2024
4.0.0 150 10/9/2024
3.3.0 140 10/6/2024
3.2.9 148 9/28/2024
3.2.8 140 9/25/2024
3.2.7 130 9/25/2024
3.2.6 134 9/25/2024
3.2.5 137 9/24/2024
3.2.4 183 8/27/2024
3.2.3 155 8/24/2024
3.2.2 162 8/19/2024
3.2.1 165 8/18/2024
3.2.0 159 8/16/2024
3.1.5 162 6/24/2024
3.1.4 182 6/2/2024
3.1.3 155 5/29/2024
3.1.2 155 5/26/2024
3.1.1 144 5/23/2024
3.1.0 179 5/21/2024
3.0.9 148 5/21/2024
3.0.8 183 3/25/2024
3.0.7 164 3/24/2024
3.0.6 150 3/20/2024
3.0.5 173 3/18/2024
3.0.4 148 3/18/2024
3.0.3 158 3/18/2024
3.0.1 156 3/17/2024
3.0.0 158 3/15/2024
2.0.7 160 3/14/2024
2.0.6 165 3/14/2024
2.0.5 139 3/7/2024
2.0.3 175 3/3/2024
2.0.2 153 3/3/2024
2.0.1 154 3/1/2024
2.0.0 151 2/26/2024
1.9.9 137 2/25/2024
1.9.8 150 2/24/2024
1.9.6 159 2/17/2024
1.9.5 151 2/17/2024
1.9.4 159 2/15/2024
1.9.3 185 2/11/2024
1.9.2 155 2/11/2024
1.9.1 140 2/11/2024
1.9.0 153 2/9/2024
1.8.9 175 2/8/2024
1.8.8 171 2/8/2024
1.8.7 151 2/5/2024
1.8.6 162 2/5/2024
1.8.5 171 1/28/2024
1.8.4 166 1/26/2024
1.8.3 144 1/26/2024
1.8.2 145 1/25/2024
1.8.1 177 1/18/2024
1.8.0 308 5/29/2023
1.7.9-prerelease 206 3/12/2023
1.7.8-prerelease 220 3/5/2023
1.7.7-prerelease 209 2/24/2023
1.7.6-prerelease 223 2/20/2023
1.7.5-prerelease 204 2/14/2023
1.7.1-prerelease 220 2/9/2023
1.7.0-prerelease 208 2/5/2023
1.6.7-prerelease 221 2/4/2023
1.6.6-prerelease 240 2/1/2023
1.6.5-prerelease 285 1/12/2023
1.6.4-prerelease 216 1/8/2023
1.6.3-prerelease 237 12/18/2022
1.6.2-prerelease 219 12/4/2022
1.6.1-prerelease 242 11/24/2022
1.6.0-prerelease 231 11/19/2022
1.5.9-prerelease 234 11/6/2022
1.5.6-prerelease 241 11/3/2022
1.5.5-prerelease 214 11/2/2022
1.5.3-prerelease 220 10/29/2022
1.5.2-prerelease 234 10/2/2022
1.5.1-prerelease 243 10/2/2022
1.5.0-prerelease 236 9/21/2022
1.4.0-prerelease 243 8/7/2022
1.3.9-prerelease 266 8/7/2022
1.3.8-prerelease 273 8/7/2022
1.3.7-prerelease 241 8/2/2022
1.3.6-prerelease 225 8/1/2022
1.3.5-prerelease 233 8/1/2022
1.3.4-prerelease 234 8/1/2022
1.3.3-prerelease 230 8/1/2022
1.3.2-prerelease 246 7/29/2022
1.3.1-prerelease 265 7/21/2022
1.3.0-prerelease 256 7/13/2022
1.2.9-prerelease 268 7/11/2022
1.2.8-prerelease 243 7/9/2022
1.2.7-prerelease 247 7/9/2022
1.2.6-prerelease 265 7/7/2022
1.2.5-prerelease 254 7/1/2022
1.2.4-prerelease 282 5/8/2022
1.2.3-prerelease 266 4/18/2022
1.2.2-prerelease 260 4/17/2022
1.2.1-prerelease 277 4/16/2022
1.2.0-prerelease 263 4/16/2022
1.1.9-prerelease 276 4/15/2022
1.1.8-prerelease 261 4/15/2022
1.1.7-prerelease 265 4/14/2022
1.1.6-prerelease 276 4/12/2022
1.1.5-prerelease 268 4/9/2022
1.1.4-prerelease 258 4/7/2022
1.1.3-prerelease 289 4/6/2022
1.1.2-prerelease 235 4/5/2022
1.1.1-prerelease 247 4/4/2022
1.1.0-prerelease 264 4/3/2022
1.0.9-prerelease 264 4/3/2022
1.0.8-prerelease 273 4/3/2022
1.0.7-prerelease 258 4/3/2022
1.0.6-prerelease 270 4/3/2022
1.0.5-prerelease 273 3/26/2022
1.0.0-prerelease 269 3/24/2022