Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/Allegiance-Consulting/blazor-highcharts

Blazor Wrapper for Highcharts library
https://github.com/Allegiance-Consulting/blazor-highcharts

Last synced: 3 months ago
JSON representation

Blazor Wrapper for Highcharts library

Lists

README

        

# blazor-highcharts
Blazor Wrapper for Highcharts library

A Demo can be found https://allegiance-consulting.github.io/blazor-highcharts/

### Quick Installation Guide

Install Package.

Add the following to `_Imports.razor`
```razor
@using Allegiance.Blazor.Highcharts.Charts;
@using Allegiance.Blazor.Highcharts.Options;
@using Allegiance.Blazor.Highcharts.Constants;
@using Allegiance.Blazor.Highcharts.Services;
```
Add the following to `index.html`
```razor











```
Add the following to the relevant sections of `Program.cs`
```c#
using Allegiance.Blazor.Highcharts.Services;
```
```c#
builder.Services.AddSingleton();
```
### Usage
```razor
@using Allegiance.Blazor.Highcharts.Charts
@using Allegiance.Blazor.Highcharts.Options

@inject IChartService chartService
@inject IJSRuntime jsRuntime
@implements IDisposable

@code {

protected override void OnAfterRender(bool firstRender)
{
base.OnAfterRender(firstRender);
if (firstRender)
{
chartService.RenderChart("basicLine", BasicLineGraph.Generate());
}
}

private ChartObject BasicLineGraph = new ChartObject()
{
Series = new List()
{
new SeriesElement("Series Element 1", new List(){
1, 10, 20, 30, 40, 50, 60, 70
}),
new SeriesElement("Series Element 2", new List(){
80, 40, 20, 10, 5, 2.5, 1.25, 0.625
}),
new SeriesElement("Series Element 3", new List(){
80/(10^7), 80/(10^6), 80/(10^5), 80/(10^4),80/(10^3), 80/(10^2), 80/(10^1), 80/(10^0)
}),
new SeriesElement("Series Element 4", new List(){
20,40,10,60,30,50,20,40
})
},
Title = new Title("Thisd is the Tittle"),
Subtitle = new Title("This is the Subtitle"),
YAxis = new YAxis(
new Title("Title of Y-axis")
),
XAxis = new XAxis(
new Accessibility("Title of Y-axis")
)
};

public void Dispose()
{
BasicLineGraph.DisposeChart(jsRuntime, "basicLine");
}
}
```