Skip to content
forked from lqdev/Blazly

A .NET Core 3.0 Razor Components Library for Plotly.js

License

Notifications You must be signed in to change notification settings

erikthysell/Blazly

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blazly

A .NET Core 3.0 Razor Component Library

Dependendices

Build

dotnet build

Use

  1. Add reference to the project from Blazor/Razor Pages project

  2. Copy the plotlyInterop.js and plotly.min.js files to the wwwroot of the web application that references this project.

  3. Add the following lines at the end of your body tag in the wwwroot/index.html file.

    <script src="plotly.min.js"></script>
    <script src="plotlyInterop.js"></script>
  4. Add the following imports to the _Imports.razor file in the project directory.

    @using Blazly
    @using Blazly.Base
    @using Blazly.Components
  5. Add the following code to the Blazor/Razor page where the plot component will be used:

<Plot Id="myPlot"
      Data="@traces"
      Layout="@chartLayout"
      />

@code {
    Trace[] traces = new Trace[]
    {
        new Trace()
        {
            X=new float[] {1,2,3,4},
            Y=new float[] {10, 15, 13, 17},
            Name="Series 1",
            Type="scatter"
        },
        new Trace()
        {
            X=new float[] {1,2,3,4},
            Y=new float[] {16, 5, 11, 9},
            Name="Series 2",
            Type="scatter"
        }
    };

    Layout chartLayout = new Layout()
    {
        Title = "My Blazly Line Plot"
    };
}

About

A .NET Core 3.0 Razor Components Library for Plotly.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 48.2%
  • HTML 26.2%
  • CSS 13.2%
  • JavaScript 12.4%