Search results

Getting Started

This section briefly explains about how to include a HeatMap in your Blazor client-side application. You can refer Getting Started with Syncfusion Blazor for Client-Side in Visual Studio 2019 Preview page for introduction part of the system requirements and configure the common specifications.

Importing Syncfusion Blazor component in the application

  1. Install Syncfusion.EJ2.Blazor NuGet package to the application by using the NuGet Package Manager. Please ensure to check the Include prerelease option.
  2. You can add the client-side resources through CDN or local npm package in the <head> element of the ~/wwwroot/index.html page.
<head>
    <script src="https://cdn.syncfusion.com/ej2/17.3.29/dist/ej2.min.js"></script>
</head>

Adding component package to the application

Open ~/_Imports.razor file and import the Syncfusion.EJ2.Blazor.HeatMap packages.

@using Syncfusion.EJ2.Blazor
@using Syncfusion.EJ2.Blazor.HeatMap

Adding HeatMap component to the application

Now, add the Syncfusion Blazor HeatMap component in any web page razor in the Pages folder. For example, the HeatMap component is added in the ~/Pages/Index.razor page.

@using Syncfusion.EJ2.Blazor.HeatMap

<EjsHeatMap DataSource="@HeatMapData">
    <HeatMapTitle Text="Sales Revenue per Employee (in 1000 US$)"></HeatMapTitle>
    <HeatMapCellSettings ShowLabel="true" TileType="CellType.Rect"></HeatMapCellSettings>
</EjsHeatMap>

@code{

    int[,] GetDefaultData()
    {
        int[,] DataSource = new int[,]
        {
            {52, 65, 67, 45, 37, 52},
            {68, 52, 63, 51, 30, 51},
            {7, 16, 47, 47, 88, 6},
            {66, 64, 46, 40, 47, 41},
            {14, 46, 97, 69, 69, 3},
            {54, 46, 61, 46, 40, 39}
        };
        return DataSource;
    }
    public object HeatMapData { get; set; }
    protected override void OnInitialized()
    {
        HeatMapData = GetDefaultData();
    }
}

Heatmap Sample

Run the application

After successful compilation of your application, simply press F5 to run the application.

See Also

Getting Started with Syncfusion Blazor for Client-Side in .NET Core CLI

Getting Started with Syncfusion Blazor for Server-Side in Visual Studio 2019 Preview

Getting Started with Syncfusion Blazor for Server-Side in .NET Core CLI