Skip to content

Misfits-Rebels-Outcasts/Blazor-Sparkline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blazor-Sparkline

Sparkline Charts for Blazor using Fonts

Open Source Sparkline Charts for Blazor and WebAssembly. It uses C#, HTML and CSS with minimal Javascript dependencies.

Sparklines are typically used to display summary information and they commonly appear in multiple rows of a HTML table. This component uses Open Type Fonts and does not require a SVG or Canvas element. The font is downloaded once and then used to display the Sparkline charts multiple times.

The current font uses dots to draw each segment of the Sparkline and is useful when you have many data points. The width of each segment can be specified by using the SegmentWidth parameter. A bigger SegmentWidth results in a longer Sparkline. It also means more data characters (dots) need to be generated to display the Sparkline using the font. Additional fonts will be added to support specific SegmentWidth instead of just a dot. This enables the the reduction of data characters generated.

#elegantlysimple

v0.2

MIT Licence

To use Sparkline

  1. Create your Blazor project.

  2. In YourProject.csproj, add

<ProjectReference Include="../Blazor-Sparkline/Sparklines/Sparklines.csproj" />

  1. In index.html, add

<link href="_content/Sparklines/styles.css" rel="stylesheet" />

  1. Finally, in Pages->Index.razor, add

<Sparkline InputData="60,0,16,25,48,45,1,0,6,37,78,79,90,90,91,99,80,0,40,0,0,56" GenerateText="true" SegmentWidth="30"></Sparkline>

To use Column Bars

  1. Create your Blazor project.

  2. In YourProject.csproj, add

<ProjectReference Include="../Blazor-Sparkline/ColumnBars/ColumnBars.csproj" />

  1. In index.html, add

<link href="_content/ColumnBars/styles.css" rel="stylesheet" />

  1. Finally, in Pages->Index.razor, add

<ColumnBars InputData="221,330,111,114,140,158,206,249,262,266,285,340,428,81,206,249,262,440,158,206,249,262,266,285,340,428" GenerateText="true" ></ColumnBars>

Similary

To use Bullet Chart

<ProjectReference Include="../Blazor-Sparkline/BulletBars/BulletBars.csproj" />

<link href="_content/BulletBars/styles.css" rel="stylesheet" />

<BulletBars InputData="26,40,95,100" Actual="49" Target="53" GenerateText="true">
</BulletBars>

To use MiniPie

<ProjectReference Include="../Blazor-Sparkline/MiniPie/MiniPie.csproj" />

<link href="_content/MiniPie/styles.css" rel="stylesheet" />

<MiniPie InputData="26,40,95,100" GenerateText="true">
</MiniPie>

To use Win Loss Draw

<ProjectReference Include="../Blazor-Sparkline/WinLoss/WinLoss.csproj" />

<link href="_content/WinLoss/styles.css" rel="stylesheet" />

<WinLoss InputData="1,1,1,-1,1,1,1,0,1,-1,1,1,1,1,1,0,1,-1,1,1,1,1,0,0,0,1,1,1,0,1,1,-1,1,1,1,1" GenerateText="true">
</WinLoss>

Alternatively, check out our Misfits-Rebels-Outcasts/Blazor-Dashboard project on how to use this Blazor Sparkline component.