HelpBot Assistant

How can I help you?

Getting Started with React HeatMap chart component

10 Feb 202624 minutes to read

This section explains the steps required to create a HeatMap and demonstrates the basic usage of the HeatMap component.

You can explore some useful features in the HeatMap component using the following video.

Dependencies

The HeatMap component requires the following packages and their dependencies.

|-- @syncfusion/ej2-react-heatmap
    |-- @syncfusion/ej2-heatmap
    |-- @syncfusion/ej2-base
    |-- @syncfusion/ej2-data
    |-- @syncfusion/ej2-svg-base
    |-- @syncfusion/ej2-react-base

Installation and configuration

To easily set up a React application, use create-vite-app, which provides a faster development environment, smaller bundle sizes, and optimized builds compared to traditional tools like create-react-app. For detailed steps, refer to the Vite installation instructions. Vite sets up your environment using JavaScript and optimizes your application for production.

Note: To create a React application using create-react-app, refer to this documentation for more details.

To create a new Vite React application, run one of the following commands.

npm create vite@latest my-app

To set-up a React application in TypeScript environment, run the following command.

npm create vite@latest my-app -- --template react-ts
cd my-app
npm run dev

To set-up a React application in JavaScript environment, run the following command.

npm create vite@latest my-app -- --template react
cd my-app
npm run dev

Include a Syncfusion theme CSS in the application entry point. Import a theme (for example, the Material theme) in src/main.tsx or src/index.js:

import '@syncfusion/ej2-base/styles/material.css';

Replace material with the desired theme name (e.g., bootstrap5, fabric, tailwind).

Adding Syncfusion® packages

All the available Essential® JS 2 packages are published in npmjs.com public registry. To install HeatMap package, use the following command.

npm install @syncfusion/ej2-react-heatmap --save

Adding HeatMap to the project

Add the HeatMap component to the application. For a basic example, add the component in src/App.tsx using the following code.

  import * as React from 'react';
  import * as ReactDOM from 'react-dom';
  import { HeatMapComponent } from '@syncfusion/ej2-react-heatmap';

   export function App() {
    return ( <HeatMapComponent id='heatmap'></HeatMapComponent> );
  }

  export default App;

Now run the npm run dev command in the console to start the development server. This command compiles your code and serves the application locally, opening it in the browser.

npm run dev

The application compiles and serves locally in the browser. The following example shows a basic HeatMap.

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { HeatMapComponent } from '@syncfusion/ej2-react-heatmap';

export function App() {
  return ( <HeatMapComponent ></HeatMapComponent> );
}

const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { HeatMapComponent } from '@syncfusion/ej2-react-heatmap';

export function App() {
  return ( <HeatMapComponent ></HeatMapComponent> );
}

const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);

Module injection

The heat map components are segregated into individual feature-wise modules. To use its feature, you need to inject its feature service in the AppModule. In the current application,the basic heat map is modified to visualize sales revenue data for week, and the tooltip and legend features of the heat map are used. Find the relevant feature modules and descriptions as follows.

  • Legend - Provides the legend feature by injecting it.
  • Tooltip - Provides the tooltip feature by injecting it.

Now, import the above-mentioned modules from the heat map package and inject them into services.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { HeatMapComponent, Inject, Legend, Tooltip} from '@syncfusion/ej2-react-heatmap';

export function App() {
  return(<HeatMapComponent id='heatmap'>
        <Inject services={[Legend, Tooltip]}/>
        </HeatMapComponent>
        );
}

const root = ReactDOM.createRoot(document.getElementById('heatmap'));
root.render(<App />);

When using React 18, import createRoot from react-dom/client or use the appropriate rendering API for the React version in use.

Populate heat map with data

This section shows how to populate a two-dimensional array of values into the heat map.

import { HeatMapComponent, Inject, Legend, Tooltip } from '@syncfusion/ej2-react-heatmap';
import * as ReactDOM from "react-dom";
import * as React from "react";

export function App() {
    var heatmapData = [
    [73, 39, 26, 39, 94, 0],
    [93, 58, 53, 38, 26, 68],
    [99, 28, 22, 4, 66, 90],
    [14, 26, 97, 69, 69, 3],
    [7, 46, 47, 47, 88, 6],
    [41, 55, 73, 23, 3, 79],
    [56, 69, 21, 86, 3, 33],
    [45, 7, 53, 81, 95, 79],
    [60, 77, 74, 68, 88, 51],
    [25, 25, 10, 12, 78, 14],
    [25, 56, 55, 58, 12, 82],
    [74, 33, 88, 23, 86, 59]];
    return ( <HeatMapComponent  dataSource={heatmapData}>
            <Inject services={[Legend, Tooltip]} />
            </HeatMapComponent> );
}

const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
import { HeatMapComponent, Inject, Legend, Tooltip } from '@syncfusion/ej2-react-heatmap';
import * as ReactDOM from "react-dom";
import * as React from "react";

export function App() {
    let heatmapData : any[] = [
    [73, 39, 26, 39, 94, 0],
    [93, 58, 53, 38, 26, 68],
    [99, 28, 22, 4, 66, 90],
    [14, 26, 97, 69, 69, 3],
    [7, 46, 47, 47, 88, 6],
    [41, 55, 73, 23, 3, 79],
    [56, 69, 21, 86, 3, 33],
    [45, 7, 53, 81, 95, 79],
    [60, 77, 74, 68, 88, 51],
    [25, 25, 10, 12, 78, 14],
    [25, 56, 55, 58, 12, 82],
    [74, 33, 88, 23, 86, 59]];
    return ( <HeatMapComponent  dataSource={heatmapData}>
            <Inject services={[Legend, Tooltip]} />
            </HeatMapComponent> );
}

const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);

Enable axis labels

Axis labels can be added and formatted using the xAxis and yAxis properties. Axis labels provide contextual information for the heat map values.

import * as React from "react";
import * as ReactDOM from 'react-dom';
import { HeatMapComponent, Inject, Legend, Tooltip } from '@syncfusion/ej2-react-heatmap';

export function App() {
    var heatmapData = [
    [73, 39, 26, 39, 94, 0],
    [93, 58, 53, 38, 26, 68],
    [99, 28, 22, 4, 66, 90],
    [14, 26, 97, 69, 69, 3],
    [7, 46, 47, 47, 88, 6],
    [41, 55, 73, 23, 3, 79],
    [56, 69, 21, 86, 3, 33],
    [45, 7, 53, 81, 95, 79],
    [60, 77, 74, 68, 88, 51],
    [25, 25, 10, 12, 78, 14],
    [25, 56, 55, 58, 12, 82],
    [74, 33, 88, 23, 86, 59]];
    return (<HeatMapComponent
            xAxis = { {
                labels : ['Nancy', 'Andrew', 'Janet', 'Margaret', 'Steven', 'Michael', 'Robert',
                'Laura', 'Anne', 'Paul', 'Karin', 'Mario'],
            } }
            yAxis = { {
                labels : ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat'],
            } }
            dataSource={heatmapData}>
            <Inject services={[Legend, Tooltip]} />
            </HeatMapComponent> );
}

const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
import * as React from "react";
import * as ReactDOM from 'react-dom';
import { HeatMapComponent, Inject, Legend, Tooltip } from '@syncfusion/ej2-react-heatmap';

export function App() {
    let heatmapData : any[] = [
    [73, 39, 26, 39, 94, 0],
    [93, 58, 53, 38, 26, 68],
    [99, 28, 22, 4, 66, 90],
    [14, 26, 97, 69, 69, 3],
    [7, 46, 47, 47, 88, 6],
    [41, 55, 73, 23, 3, 79],
    [56, 69, 21, 86, 3, 33],
    [45, 7, 53, 81, 95, 79],
    [60, 77, 74, 68, 88, 51],
    [25, 25, 10, 12, 78, 14],
    [25, 56, 55, 58, 12, 82],
    [74, 33, 88, 23, 86, 59]];
    return (<HeatMapComponent
            xAxis = { {
                labels : ['Nancy', 'Andrew', 'Janet', 'Margaret', 'Steven', 'Michael', 'Robert',
                'Laura', 'Anne', 'Paul', 'Karin', 'Mario'],
            } }
            yAxis = { {
                labels : ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat'],
            } }
            dataSource={heatmapData}>
            <Inject services={[Legend, Tooltip]} />
            </HeatMapComponent> );
}

const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);

Add heat map title

Add a title using the titleSettings property to the heat map to provide quick information to the user about the data populated in the heat map.

import * as React from "react";
import * as ReactDOM from 'react-dom';
import { HeatMapComponent, Inject, Legend, Tooltip } from '@syncfusion/ej2-react-heatmap';

export function App() {
    var heatmapData = [
    [73, 39, 26, 39, 94, 0],
    [93, 58, 53, 38, 26, 68],
    [99, 28, 22, 4, 66, 90],
    [14, 26, 97, 69, 69, 3],
    [7, 46, 47, 47, 88, 6],
    [41, 55, 73, 23, 3, 79],
    [56, 69, 21, 86, 3, 33],
    [45, 7, 53, 81, 95, 79],
    [60, 77, 74, 68, 88, 51],
    [25, 25, 10, 12, 78, 14],
    [25, 56, 55, 58, 12, 82],
    [74, 33, 88, 23, 86, 59]];
    return ( <HeatMapComponent
            titleSettings = { {
                text: 'Sales Revenue per Employee (in 1000 US$)',
                textStyle: {
                    size: '15px',
                    fontWeight: '500',
                    fontStyle: 'Normal',
                    fontFamily: 'Segoe UI'
                }
            } }
            xAxis = { {
                labels: ['Nancy', 'Andrew', 'Janet', 'Margaret', 'Steven', 'Michael', 'Robert',
                'Laura', 'Anne', 'Paul', 'Karin', 'Mario']
            } }
            yAxis = { {
                labels: ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat'],
            } }
            dataSource={heatmapData}>
            <Inject services={[Legend, Tooltip]} />
            </HeatMapComponent> );
}

const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
import * as React from "react";
import * as ReactDOM from 'react-dom';
import { HeatMapComponent, Inject, Legend, Tooltip } from '@syncfusion/ej2-react-heatmap';

export function App() {
    let heatmapData : any[] = [
    [73, 39, 26, 39, 94, 0],
    [93, 58, 53, 38, 26, 68],
    [99, 28, 22, 4, 66, 90],
    [14, 26, 97, 69, 69, 3],
    [7, 46, 47, 47, 88, 6],
    [41, 55, 73, 23, 3, 79],
    [56, 69, 21, 86, 3, 33],
    [45, 7, 53, 81, 95, 79],
    [60, 77, 74, 68, 88, 51],
    [25, 25, 10, 12, 78, 14],
    [25, 56, 55, 58, 12, 82],
    [74, 33, 88, 23, 86, 59]];
    return ( <HeatMapComponent
            titleSettings = { {
                text: 'Sales Revenue per Employee (in 1000 US$)',
                textStyle: {
                    size: '15px',
                    fontWeight: '500',
                    fontStyle: 'Normal',
                    fontFamily: 'Segoe UI'
                }
            } }
            xAxis = { {
                labels: ['Nancy', 'Andrew', 'Janet', 'Margaret', 'Steven', 'Michael', 'Robert',
                'Laura', 'Anne', 'Paul', 'Karin', 'Mario']
            } }
            yAxis = { {
                labels: ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat'],
            } }
            dataSource={heatmapData}>
            <Inject services={[Legend, Tooltip]} />
            </HeatMapComponent> );
}

const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);

Enable legend

Enable a legend through the legendSettings object by setting the visible property to true and injecting the Legend module into services.

import * as React from "react";
import * as ReactDOM from 'react-dom';
import { HeatMapComponent, Inject, Legend, Tooltip } from '@syncfusion/ej2-react-heatmap';

export function App() {
    var heatmapData = [
    [73, 39, 26, 39, 94, 0],
    [93, 58, 53, 38, 26, 68],
    [99, 28, 22, 4, 66, 90],
    [14, 26, 97, 69, 69, 3],
    [7, 46, 47, 47, 88, 6],
    [41, 55, 73, 23, 3, 79],
    [56, 69, 21, 86, 3, 33],
    [45, 7, 53, 81, 95, 79],
    [60, 77, 74, 68, 88, 51],
    [25, 25, 10, 12, 78, 14],
    [25, 56, 55, 58, 12, 82],
    [74, 33, 88, 23, 86, 59]];
    return ( <HeatMapComponent
            titleSettings = { {
                text: 'Sales Revenue per Employee (in 1000 US$)',
                textStyle: {
                    size: '15px',
                    fontWeight: '500',
                    fontStyle: 'Normal',
                    fontFamily: 'Segoe UI'
                }
            } }
            xAxis = { {
                labels: ['Nancy', 'Andrew', 'Janet', 'Margaret', 'Steven', 'Michael', 'Robert',
                'Laura', 'Anne', 'Paul', 'Karin', 'Mario']
            } }
            yAxis = { {
                labels: ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat'],
            } }
            dataSource={heatmapData}
            legendSettings = { {
                visible:true,
                position: 'Right',
                showLabel: true,
                height: "150"
            } }>
            <Inject services={[Legend, Tooltip]} />
            </HeatMapComponent> );
}

const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
import * as React from "react";
import * as ReactDOM from 'react-dom';
import { HeatMapComponent, Inject, Legend, Tooltip } from '@syncfusion/ej2-react-heatmap';

export function App() {
    let heatmapData : any[]  = [
    [73, 39, 26, 39, 94, 0],
    [93, 58, 53, 38, 26, 68],
    [99, 28, 22, 4, 66, 90],
    [14, 26, 97, 69, 69, 3],
    [7, 46, 47, 47, 88, 6],
    [41, 55, 73, 23, 3, 79],
    [56, 69, 21, 86, 3, 33],
    [45, 7, 53, 81, 95, 79],
    [60, 77, 74, 68, 88, 51],
    [25, 25, 10, 12, 78, 14],
    [25, 56, 55, 58, 12, 82],
    [74, 33, 88, 23, 86, 59]];
    return ( <HeatMapComponent
            titleSettings = { {
                text: 'Sales Revenue per Employee (in 1000 US$)',
                textStyle: {
                    size: '15px',
                    fontWeight: '500',
                    fontStyle: 'Normal',
                    fontFamily: 'Segoe UI'
                }
            } }
            xAxis = { {
                labels: ['Nancy', 'Andrew', 'Janet', 'Margaret', 'Steven', 'Michael', 'Robert',
                'Laura', 'Anne', 'Paul', 'Karin', 'Mario']
            } }
            yAxis = { {
                labels: ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat'],
            } }
            dataSource={heatmapData}
            legendSettings = { {
                visible:true,
                position: 'Right',
                showLabel: true,
                height: "150"
            } }>
            <Inject services={[Legend, Tooltip]} />
            </HeatMapComponent> );
}

const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);

Add data label

Add data labels to improve the readability of the heat map. This can be achieved by setting the showLabel property to true in the cellSettings object.

import * as React from "react";
import * as ReactDOM from 'react-dom';
import { HeatMapComponent, Inject, Legend, Tooltip } from '@syncfusion/ej2-react-heatmap';

export function App() {
    var heatmapData = [
    [73, 39, 26, 39, 94, 0],
    [93, 58, 53, 38, 26, 68],
    [99, 28, 22, 4, 66, 90],
    [14, 26, 97, 69, 69, 3],
    [7, 46, 47, 47, 88, 6],
    [41, 55, 73, 23, 3, 79],
    [56, 69, 21, 86, 3, 33],
    [45, 7, 53, 81, 95, 79],
    [60, 77, 74, 68, 88, 51],
    [25, 25, 10, 12, 78, 14],
    [25, 56, 55, 58, 12, 82],
    [74, 33, 88, 23, 86, 59]];
    return ( <HeatMapComponent
            titleSettings= { {
                text: 'Sales Revenue per Employee (in 1000 US$)',
                textStyle: {
                    size: '15px',
                    fontWeight: '500',
                    fontStyle: 'Normal',
                    fontFamily: 'Segoe UI'
                }
            } }
            xAxis = { {
                labels: ['Nancy', 'Andrew', 'Janet', 'Margaret', 'Steven', 'Michael', 'Robert',
                'Laura', 'Anne', 'Paul', 'Karin', 'Mario']
            } }
            yAxis = { {
                labels: ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat'],
            } }
            cellSettings = { {
                showLabel: true,
            } }
            dataSource={heatmapData}
            legendSettings = { {
                position: 'Right',
                showLabel: true,
                height: "150"
            } }>
            <Inject services={[Legend, Tooltip]} />
            </HeatMapComponent> );
    }

const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
import * as React from "react";
import * as ReactDOM from 'react-dom';
import { HeatMapComponent, Inject, Legend, Tooltip } from '@syncfusion/ej2-react-heatmap';

export function App() {
    let heatmapData : any[]  = [
    [73, 39, 26, 39, 94, 0],
    [93, 58, 53, 38, 26, 68],
    [99, 28, 22, 4, 66, 90],
    [14, 26, 97, 69, 69, 3],
    [7, 46, 47, 47, 88, 6],
    [41, 55, 73, 23, 3, 79],
    [56, 69, 21, 86, 3, 33],
    [45, 7, 53, 81, 95, 79],
    [60, 77, 74, 68, 88, 51],
    [25, 25, 10, 12, 78, 14],
    [25, 56, 55, 58, 12, 82],
    [74, 33, 88, 23, 86, 59]];
    return ( <HeatMapComponent
            titleSettings= { {
                text: 'Sales Revenue per Employee (in 1000 US$)',
                textStyle: {
                    size: '15px',
                    fontWeight: '500',
                    fontStyle: 'Normal',
                    fontFamily: 'Segoe UI'
                }
            } }
            xAxis = { {
                labels: ['Nancy', 'Andrew', 'Janet', 'Margaret', 'Steven', 'Michael', 'Robert',
                'Laura', 'Anne', 'Paul', 'Karin', 'Mario']
            } }
            yAxis = { {
                labels: ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat'],
            } }
            cellSettings = { {
                showLabel: true,
            } }
            dataSource={heatmapData}
            legendSettings = { {
                position: 'Right',
                showLabel: true,
                height: "150"
            } }>
            <Inject services={[Legend, Tooltip]} />
            </HeatMapComponent> );
    }

const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);

Add custom cell palette

The default palette settings of the heat map cells can be customized by using the paletteSettings property. Using the palette property in paletteSettings object, you can change the color set for the cells. You can change the color mode of the cells to fixed or gradient mode using the type property.

import * as React from "react";
import * as ReactDOM from 'react-dom';
import { HeatMapComponent, Inject, Legend, Tooltip } from '@syncfusion/ej2-react-heatmap';

export function App() {
    var heatmapData = [
    [73, 39, 26, 39, 94, 0],
    [93, 58, 53, 38, 26, 68],
    [99, 28, 22, 4, 66, 90],
    [14, 26, 97, 69, 69, 3],
    [7, 46, 47, 47, 88, 6],
    [41, 55, 73, 23, 3, 79],
    [56, 69, 21, 86, 3, 33],
    [45, 7, 53, 81, 95, 79],
    [60, 77, 74, 68, 88, 51],
    [25, 25, 10, 12, 78, 14],
    [25, 56, 55, 58, 12, 82],
    [74, 33, 88, 23, 86, 59]];
    return ( <HeatMapComponent
            titleSettings = { {
                text: 'Sales Revenue per Employee (in 1000 US$)',
                textStyle: {
                    size: '15px',
                    fontWeight: '500',
                    fontStyle: 'Normal',
                    fontFamily: 'Segoe UI'
                }
            } }
            xAxis = { {
                labels: ['Nancy', 'Andrew', 'Janet', 'Margaret', 'Steven', 'Michael', 'Robert',
                'Laura', 'Anne', 'Paul', 'Karin', 'Mario']
            } }
            yAxis = { {
                labels: ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat'],
            } }
            cellSettings = { {
                showLabel: true,
            } }
            paletteSettings = { {
                palette: [
                    { value: 0, color: '#C06C84' },
                    { value: 50, color: '#6C5B7B' },
                    { value: 100, color: '#355C7D' }
                ],
                type: "Gradient"
            } }
            dataSource={heatmapData}
            legendSettings = { {
                position: 'Right',
                showLabel: true,
                height: "150"
            } }>
            <Inject services={[Legend, Tooltip]} />
            </HeatMapComponent> );
    }

const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
import * as React from "react";
import * as ReactDOM from 'react-dom';
import { HeatMapComponent, Inject, Legend, Tooltip } from '@syncfusion/ej2-react-heatmap';

export function App() {
    let heatmapData : any[] = [
    [73, 39, 26, 39, 94, 0],
    [93, 58, 53, 38, 26, 68],
    [99, 28, 22, 4, 66, 90],
    [14, 26, 97, 69, 69, 3],
    [7, 46, 47, 47, 88, 6],
    [41, 55, 73, 23, 3, 79],
    [56, 69, 21, 86, 3, 33],
    [45, 7, 53, 81, 95, 79],
    [60, 77, 74, 68, 88, 51],
    [25, 25, 10, 12, 78, 14],
    [25, 56, 55, 58, 12, 82],
    [74, 33, 88, 23, 86, 59]];
    return ( <HeatMapComponent
            titleSettings = { {
                text: 'Sales Revenue per Employee (in 1000 US$)',
                textStyle: {
                    size: '15px',
                    fontWeight: '500',
                    fontStyle: 'Normal',
                    fontFamily: 'Segoe UI'
                }
            } }
            xAxis = { {
                labels: ['Nancy', 'Andrew', 'Janet', 'Margaret', 'Steven', 'Michael', 'Robert',
                'Laura', 'Anne', 'Paul', 'Karin', 'Mario']
            } }
            yAxis = { {
                labels: ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat'],
            } }
            cellSettings = { {
                showLabel: true,
            } }
            paletteSettings = { {
                palette: [
                    { value: 0, color: '#C06C84' },
                    { value: 50, color: '#6C5B7B' },
                    { value: 100, color: '#355C7D' }
                ],
                type: "Gradient"
            } }
            dataSource={heatmapData}
            legendSettings = { {
                position: 'Right',
                showLabel: true,
                height: "150"
            } }>
            <Inject services={[Legend, Tooltip]} />
            </HeatMapComponent> );
    }

const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);

Enable tooltip

The tooltip is used when you cannot display information by using the data labels due to space constraints. You can enable the tooltip by setting the showTooltip property to true and injecting the Tooltip module into the services.

import * as React from "react";
import * as ReactDOM from 'react-dom';
import { HeatMapComponent, Inject, Legend, Tooltip } from '@syncfusion/ej2-react-heatmap';

export function App() {
    var heatmapData = [
    [73, 39, 26, 39, 94, 0],
    [93, 58, 53, 38, 26, 68],
    [99, 28, 22, 4, 66, 90],
    [14, 26, 97, 69, 69, 3],
    [7, 46, 47, 47, 88, 6],
    [41, 55, 73, 23, 3, 79],
    [56, 69, 21, 86, 3, 33],
    [45, 7, 53, 81, 95, 79],
    [60, 77, 74, 68, 88, 51],
    [25, 25, 10, 12, 78, 14],
    [25, 56, 55, 58, 12, 82],
    [74, 33, 88, 23, 86, 59]];
    return ( <HeatMapComponent
            titleSettings = { {
                text: 'Sales Revenue per Employee (in 1000 US$)',
                textStyle: {
                    size: '15px',
                    fontWeight: '500',
                    fontStyle: 'Normal',
                    fontFamily: 'Segoe UI'
                }
            } }
            xAxis = { {
                labels: ['Nancy', 'Andrew', 'Janet', 'Margaret', 'Steven', 'Michael', 'Robert',
                'Laura', 'Anne', 'Paul', 'Karin', 'Mario']
            } }
            yAxis = { {
                labels: ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat'],
            } }
            cellSettings = { {
                showLabel: true,
            } }
            dataSource={heatmapData}
            showTooltip={true}
            legendSettings = { {
                visible:true,
                position: 'Right',
                showLabel: true,
                height: "150"
            } }>
            <Inject services={[Legend, Tooltip]} />
            </HeatMapComponent> );
}

const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);
import * as React from "react";
import * as ReactDOM from 'react-dom';
import { HeatMapComponent, Inject, Legend, Tooltip } from '@syncfusion/ej2-react-heatmap';

export function App() {
    let heatmapData : any[]  = [
    [73, 39, 26, 39, 94, 0],
    [93, 58, 53, 38, 26, 68],
    [99, 28, 22, 4, 66, 90],
    [14, 26, 97, 69, 69, 3],
    [7, 46, 47, 47, 88, 6],
    [41, 55, 73, 23, 3, 79],
    [56, 69, 21, 86, 3, 33],
    [45, 7, 53, 81, 95, 79],
    [60, 77, 74, 68, 88, 51],
    [25, 25, 10, 12, 78, 14],
    [25, 56, 55, 58, 12, 82],
    [74, 33, 88, 23, 86, 59]];
    return ( <HeatMapComponent
            titleSettings = { {
                text: 'Sales Revenue per Employee (in 1000 US$)',
                textStyle: {
                    size: '15px',
                    fontWeight: '500',
                    fontStyle: 'Normal',
                    fontFamily: 'Segoe UI'
                }
            } }
            xAxis = { {
                labels: ['Nancy', 'Andrew', 'Janet', 'Margaret', 'Steven', 'Michael', 'Robert',
                'Laura', 'Anne', 'Paul', 'Karin', 'Mario']
            } }
            yAxis = { {
                labels: ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat'],
            } }
            cellSettings = { {
                showLabel: true,
            } }
            dataSource={heatmapData}
            showTooltip={true}
            legendSettings = { {
                visible:true,
                position: 'Right',
                showLabel: true,
                height: "150"
            } }>
            <Inject services={[Legend, Tooltip]} />
            </HeatMapComponent> );
}

const root = ReactDOM.createRoot(document.getElementById('container'));
root.render(<App />);