Canvas.Views.Web
1.3.9-prerelease
See the version list below for details.
dotnet add package Canvas.Views.Web --version 1.3.9-prerelease
NuGet\Install-Package Canvas.Views.Web -Version 1.3.9-prerelease
<PackageReference Include="Canvas.Views.Web" Version="1.3.9-prerelease" />
paket add Canvas.Views.Web --version 1.3.9-prerelease
#r "nuget: Canvas.Views.Web, 1.3.9-prerelease"
// Install Canvas.Views.Web as a Cake Addin #addin nuget:?package=Canvas.Views.Web&version=1.3.9-prerelease&prerelease // Install Canvas.Views.Web as a Cake Tool #tool nuget:?package=Canvas.Views.Web&version=1.3.9-prerelease&prerelease
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.
Nuget
Install-Package Canvas.Views.Web
Drawing Methods
Currently available controls.
- Engine - abstract base
Canvas
control exposing drawing context of various frameworks, likeGDI
orSkiaSharp
- 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 polygon
- HeatMap - 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)
{
if (setup)
{
var generator = new Random();
var points = Enumerable.Range(1, 100).Select(i => new BarItemModel
{
X = i,
Y = generator.Next(-5000, 5000)
} as IPointModel).ToList();
await ViewControl.Create(dimensions => ViewControl.Composer = new Composer
{
Name = "Demo",
Items = points,
Engine = new CanvasEngine(dimensions.X, dimensions.Y)
});
}
await base.OnAfterRenderAsync(setup);
}
}
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 | Versions 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. |
-
net7.0
- Canvas.Core (>= 1.3.1-prerelease)
- ScriptContainer (>= 1.1.2-prerelease)
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.0.0 | 43 | 12/27/2024 |
4.5.6 | 88 | 12/10/2024 |
4.5.5 | 190 | 10/26/2024 |
4.5.4 | 79 | 10/26/2024 |
4.5.3 | 103 | 10/25/2024 |
4.5.2 | 78 | 10/24/2024 |
4.5.1 | 85 | 10/24/2024 |
4.5.0 | 88 | 10/24/2024 |
4.0.0 | 113 | 10/9/2024 |
3.3.0 | 98 | 10/6/2024 |
3.2.9 | 105 | 9/28/2024 |
3.2.8 | 96 | 9/25/2024 |
3.2.7 | 92 | 9/25/2024 |
3.2.6 | 89 | 9/25/2024 |
3.2.5 | 93 | 9/24/2024 |
3.2.4 | 142 | 8/27/2024 |
3.2.3 | 116 | 8/24/2024 |
3.2.2 | 119 | 8/19/2024 |
3.2.1 | 127 | 8/18/2024 |
3.2.0 | 119 | 8/16/2024 |
3.1.5 | 119 | 6/24/2024 |
3.1.4 | 137 | 6/2/2024 |
3.1.3 | 117 | 5/29/2024 |
3.1.2 | 115 | 5/26/2024 |
3.1.1 | 107 | 5/23/2024 |
3.1.0 | 142 | 5/21/2024 |
3.0.9 | 108 | 5/21/2024 |
3.0.8 | 144 | 3/25/2024 |
3.0.7 | 123 | 3/24/2024 |
3.0.6 | 112 | 3/20/2024 |
3.0.5 | 133 | 3/18/2024 |
3.0.4 | 110 | 3/18/2024 |
3.0.3 | 119 | 3/18/2024 |
3.0.1 | 120 | 3/17/2024 |
3.0.0 | 120 | 3/15/2024 |
2.0.7 | 122 | 3/14/2024 |
2.0.6 | 121 | 3/14/2024 |
2.0.5 | 105 | 3/7/2024 |
2.0.3 | 134 | 3/3/2024 |
2.0.2 | 114 | 3/3/2024 |
2.0.1 | 113 | 3/1/2024 |
2.0.0 | 111 | 2/26/2024 |
1.9.9 | 101 | 2/25/2024 |
1.9.8 | 114 | 2/24/2024 |
1.9.6 | 119 | 2/17/2024 |
1.9.5 | 109 | 2/17/2024 |
1.9.4 | 110 | 2/15/2024 |
1.9.3 | 148 | 2/11/2024 |
1.9.2 | 115 | 2/11/2024 |
1.9.1 | 101 | 2/11/2024 |
1.9.0 | 114 | 2/9/2024 |
1.8.9 | 135 | 2/8/2024 |
1.8.8 | 123 | 2/8/2024 |
1.8.7 | 115 | 2/5/2024 |
1.8.6 | 122 | 2/5/2024 |
1.8.5 | 131 | 1/28/2024 |
1.8.4 | 126 | 1/26/2024 |
1.8.3 | 104 | 1/26/2024 |
1.8.2 | 109 | 1/25/2024 |
1.8.1 | 139 | 1/18/2024 |
1.8.0 | 256 | 5/29/2023 |
1.7.9-prerelease | 154 | 3/12/2023 |
1.7.8-prerelease | 169 | 3/5/2023 |
1.7.7-prerelease | 150 | 2/24/2023 |
1.7.6-prerelease | 172 | 2/20/2023 |
1.7.5-prerelease | 151 | 2/14/2023 |
1.7.1-prerelease | 166 | 2/9/2023 |
1.7.0-prerelease | 154 | 2/5/2023 |
1.6.7-prerelease | 169 | 2/4/2023 |
1.6.6-prerelease | 185 | 2/1/2023 |
1.6.5-prerelease | 226 | 1/12/2023 |
1.6.4-prerelease | 156 | 1/8/2023 |
1.6.3-prerelease | 174 | 12/18/2022 |
1.6.2-prerelease | 167 | 12/4/2022 |
1.6.1-prerelease | 185 | 11/24/2022 |
1.6.0-prerelease | 180 | 11/19/2022 |
1.5.9-prerelease | 179 | 11/6/2022 |
1.5.6-prerelease | 190 | 11/3/2022 |
1.5.5-prerelease | 156 | 11/2/2022 |
1.5.3-prerelease | 167 | 10/29/2022 |
1.5.2-prerelease | 173 | 10/2/2022 |
1.5.1-prerelease | 185 | 10/2/2022 |
1.5.0-prerelease | 178 | 9/21/2022 |
1.4.0-prerelease | 184 | 8/7/2022 |
1.3.9-prerelease | 207 | 8/7/2022 |
1.3.8-prerelease | 206 | 8/7/2022 |
1.3.7-prerelease | 176 | 8/2/2022 |
1.3.6-prerelease | 167 | 8/1/2022 |
1.3.5-prerelease | 172 | 8/1/2022 |
1.3.4-prerelease | 175 | 8/1/2022 |
1.3.3-prerelease | 172 | 8/1/2022 |
1.3.2-prerelease | 185 | 7/29/2022 |
1.3.1-prerelease | 203 | 7/21/2022 |
1.3.0-prerelease | 190 | 7/13/2022 |
1.2.9-prerelease | 200 | 7/11/2022 |
1.2.8-prerelease | 181 | 7/9/2022 |
1.2.7-prerelease | 184 | 7/9/2022 |
1.2.6-prerelease | 205 | 7/7/2022 |
1.2.5-prerelease | 191 | 7/1/2022 |
1.2.4-prerelease | 217 | 5/8/2022 |
1.2.3-prerelease | 200 | 4/18/2022 |
1.2.2-prerelease | 187 | 4/17/2022 |
1.2.1-prerelease | 207 | 4/16/2022 |
1.2.0-prerelease | 192 | 4/16/2022 |
1.1.9-prerelease | 203 | 4/15/2022 |
1.1.8-prerelease | 190 | 4/15/2022 |
1.1.7-prerelease | 199 | 4/14/2022 |
1.1.6-prerelease | 201 | 4/12/2022 |
1.1.5-prerelease | 187 | 4/9/2022 |
1.1.4-prerelease | 184 | 4/7/2022 |
1.1.3-prerelease | 215 | 4/6/2022 |
1.1.2-prerelease | 170 | 4/5/2022 |
1.1.1-prerelease | 177 | 4/4/2022 |
1.1.0-prerelease | 195 | 4/3/2022 |
1.0.9-prerelease | 192 | 4/3/2022 |
1.0.8-prerelease | 208 | 4/3/2022 |
1.0.7-prerelease | 186 | 4/3/2022 |
1.0.6-prerelease | 199 | 4/3/2022 |
1.0.5-prerelease | 201 | 3/26/2022 |
1.0.0-prerelease | 199 | 3/24/2022 |