CodePen
Sandbox Download

New York City 311 helicopter noise complaints by day of week and hour of day.

What is a heat chart?

Heat chart visualizes data in a grid format, where individual values are represented as colors in cells. It is useful for identifying patterns, correlations, and outliers in large datasets.

Data configurations

This section covers a few data configuration examples for heat charts, each configured using the heat chart model. See the heat chart model reference for the full list of available properties and methods.

Calendar heat chart

A calendar heat chart visualizes data over time using two date fields. Each cell corresponds to a specific calendar unit defined by the intersection of the row and column, with color representing the value for that unit.

CodePen
Sandbox Download
This chart visualizes the amount of helicopter noise complaints in New York City by day of week and hour of day. Each cell represents a specific combination of day of week and hour of day, with darker colors indicating more complaints for that time period.
  1. Set the xAxisField and yAxisField properties to "Created_Date" to specify the date field.
  2. The temporal binning for each axis needs to be set accordingly. Set the xTemporalBinning property to have a unit of hourOfDay to bin the x-axis by hour of day, and set the yTemporalBinning property to have a unit of dayOfWeek to bin the y-axis by day of week.
  3. Use the setYAxisSortOrder method to sort the y-axis in descending order to have Sunday at the top and Saturday at the bottom.
Calendar heat chart
31 collapsed lines
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Calendar Heat Chart</title>
<style>
html,
body,
arcgis-chart {
height: 100%;
margin: 0;
}
</style>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.2/"></script>
</head>
<body>
<arcgis-chart></arcgis-chart>
<script type="module">
const { createModel } = await $arcgis.import("@arcgis/charts-components/model/shared/setup-utils.js");
const FeatureLayer = await $arcgis.import("@arcgis/core/layers/FeatureLayer.js");
const featureLayer = new FeatureLayer({
portalItem: {
id: "caea6a7ab4fe44b9b4ec3abb7314c1bb",
},
});
const chartElement = document.querySelector("arcgis-chart");
const heatChartModel = await createModel({
layer: featureLayer,
chartType: "heatChart",
});
heatChartModel.xAxisField = "Created_Date";
heatChartModel.yAxisField = "Created_Date";
heatChartModel.xTemporalBinning = { type: "calendarDateParts", unit: "hourOfDay" };
heatChartModel.yTemporalBinning = { type: "calendarDateParts", unit: "dayOfWeek" };
heatChartModel.setYAxisSortOrder("Desc");
15 collapsed lines
heatChartModel.gradientRules = {
colorList: [
[200, 225, 255, 255],
[220, 0, 0, 255],
],
};
heatChartModel.titleText = "NYC 311 Helicopter Noise Complaints";
heatChartModel.dataLabelsVisibility = true;
heatChartModel.legendPosition = "top";
chartElement.autoInverseDataLabelTextColor = true;
chartElement.model = heatChartModel;
chartElement.actionMode = "none";
</script>
</body>
</html>

Matrix heat chart

A matrix heat chart visualizes relationships between two categorical fields. Each cell represents the intersection of the two categories, and all records sharing the same category values are aggregated into the same cell, with color representing the aggregated value.

CodePen
Sandbox Download
This chart visualizes the average price of short term rentals listings in New York City for each combination of room type and neighborhood group. Each cell represents a specific combination of room type and neighborhood group, with darker colors indicating higher average prices.
  1. Set the xAxisField and yAxisField properties to "room_type" and "neighbourhood_group" respectively to specify the categorical fields.
  2. Set the numericFields property to ["price"] to specify the numeric field to be aggregated for color representation, and set the aggregationType property to "avg" to aggregate using the average value of the price field.
Matrix heat chart
31 collapsed lines
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Matrix Heat Chart</title>
<style>
html,
body,
arcgis-chart {
height: 100%;
margin: 0;
}
</style>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.2/"></script>
</head>
<body>
<arcgis-chart></arcgis-chart>
<script type="module">
const { createModel } = await $arcgis.import("@arcgis/charts-components/model/shared/setup-utils.js");
const FeatureLayer = await $arcgis.import("@arcgis/core/layers/FeatureLayer.js");
const featureLayer = new FeatureLayer({
portalItem: {
id: "a8fbe2753beb4cd4aeef4d47e5e32a7c",
},
});
const chartElement = document.querySelector("arcgis-chart");
const heatChartModel = await createModel({
layer: featureLayer,
chartType: "heatChart",
});
heatChartModel.xAxisField = "room_type";
heatChartModel.yAxisField = "neighbourhood_group";
heatChartModel.numericFields = ["price"];
heatChartModel.aggregationType = "avg";
19 collapsed lines
heatChartModel.titleText = "Average Price of Short-Term Rentals in NYC by Room Type and Neighbourhood Group";
heatChartModel.setAxisTitleText("Room Type", 0);
heatChartModel.setAxisTitleText("Neighbourhood Group", 1);
heatChartModel.dataLabelsVisibility = true;
heatChartModel.legendPosition = "top";
heatChartModel.setAxisValueFormat(0, {
type: "category",
characterLimit: 20,
});
heatChartModel.setAxisValueFormat(1, {
type: "category",
characterLimit: 20,
});
chartElement.autoInverseDataLabelTextColor = true;
chartElement.model = heatChartModel;
chartElement.actionMode = "none";
</script>
</body>
</html>

Customization options

Heat rule types

When configuring a heat chart, you can choose between two types of heat rules:

  • Gradient: Represents the data with a continuous range of colors, which can provide a more detailed view of the data distribution but may be harder to interpret at a glance. This is the default heat rule type.

    • The legend will show a smooth transition between colors, and if outside range colors are specified, the legend will also display the colors for values outside of the minimum and maximum value.
  • Renderer: Represents the data with five equal intervals. This can make it easier to interpret the data by grouping similar values together and providing clear distinctions between different ranges.

    • The legend will show five class breaks with distinct colors, and the color ramp can be customized to use different color schemes.

    Gradient

    CodePen
    Sandbox Download
    This chart visualizes the amount of helicopter noise complaints in New York City by day of week and hour of day, with a gradient legend to represent the range of values. Values outside of the minimum (30) and maximum (330) value are represented by a light blue and dark red colors respectively.
    1. Set the heatRulesType property to "gradient".
    2. Use the gradientRules property to specify the color ramp segments for the gradient legend.
    3. Set the colorList property of gradientRules to specify the colors for each segment.
    4. Optionally, set the minValue and maxValue properties of gradientRules to define the minimum and maximum values for the gradient legend.
    5. If minValue and maxValue are set, you can also set the outsideRangeLowerColor and outsideRangeUpperColor properties of gradientRules to specify the colors outside of the minimum and maximum value.
    Gradient
    36 collapsed lines
    <html>
    <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <title>Calendar Heat Chart with gradient heat rule type</title>
    <style>
    html,
    body,
    arcgis-chart {
    height: 100%;
    margin: 0;
    }
    </style>
    <!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
    <script type="module" src="https://js.arcgis.com/5.2/"></script>
    </head>
    <body>
    <arcgis-chart></arcgis-chart>
    <script type="module">
    const { createModel } = await $arcgis.import("@arcgis/charts-components/model/shared/setup-utils.js");
    const FeatureLayer = await $arcgis.import("@arcgis/core/layers/FeatureLayer.js");
    const featureLayer = new FeatureLayer({
    portalItem: {
    id: "caea6a7ab4fe44b9b4ec3abb7314c1bb",
    },
    });
    const chartElement = document.querySelector("arcgis-chart");
    const heatChartModel = await createModel({
    layer: featureLayer,
    chartType: "heatChart",
    });
    heatChartModel.xAxisField = "Created_Date";
    heatChartModel.yAxisField = "Created_Date";
    heatChartModel.xTemporalBinning = { type: "calendarDateParts", unit: "hourOfDay" };
    heatChartModel.yTemporalBinning = { type: "calendarDateParts", unit: "dayOfWeek" };
    heatChartModel.setYAxisSortOrder("Desc");
    heatChartModel.heatRuleType = "gradient";
    heatChartModel.gradientRules = {
    colorList: [
    [200, 225, 255, 255], // light blue
    [220, 0, 0, 255], // red
    ],
    minValue: 30,
    maxValue: 330,
    outsideRangeLowerColor: [240, 248, 255, 255], // very light blue
    outsideRangeUpperColor: [160, 30, 30, 255], // very dark red
    };
    9 collapsed lines
    heatChartModel.titleText = "Helicopter Noise Complaints (Gradient)";
    heatChartModel.dataLabelsVisibility = true;
    heatChartModel.legendPosition = "top";
    chartElement.autoInverseDataLabelTextColor = true;
    chartElement.model = heatChartModel;
    chartElement.actionMode = "none";
    </script>
    </body>
    </html>

    Renderer

    CodePen
    Sandbox Download
    This chart visualizes the amount of helicopter noise complaints in New York City by day of week and hour of day, with a renderer heat rule to represent the data in five equal intervals.
    1. Set the heatRulesType property to "renderer".
    2. Use the colorRampName property to "Esri Green and Blue 3" to specify the color ramp name for the class break legend. The full available list of color ramps can be found in the Esri color ramps guide.
    Renderer
    36 collapsed lines
    <html>
    <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <title>Calendar Heat Chart with renderer heat rule type</title>
    <style>
    html,
    body,
    arcgis-chart {
    height: 100%;
    margin: 0;
    }
    </style>
    <!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
    <script type="module" src="https://js.arcgis.com/5.2/"></script>
    </head>
    <body>
    <arcgis-chart></arcgis-chart>
    <script type="module">
    const { createModel } = await $arcgis.import("@arcgis/charts-components/model/shared/setup-utils.js");
    const FeatureLayer = await $arcgis.import("@arcgis/core/layers/FeatureLayer.js");
    const featureLayer = new FeatureLayer({
    portalItem: {
    id: "caea6a7ab4fe44b9b4ec3abb7314c1bb",
    },
    });
    const chartElement = document.querySelector("arcgis-chart");
    const heatChartModel = await createModel({
    layer: featureLayer,
    chartType: "heatChart",
    });
    heatChartModel.xAxisField = "Created_Date";
    heatChartModel.yAxisField = "Created_Date";
    heatChartModel.xTemporalBinning = { type: "calendarDateParts", unit: "hourOfDay" };
    heatChartModel.yTemporalBinning = { type: "calendarDateParts", unit: "dayOfWeek" };
    heatChartModel.setYAxisSortOrder("Desc");
    heatChartModel.heatRulesType = "renderer";
    heatChartModel.colorRampName = "Esri Green and Blue 3";
    9 collapsed lines
    heatChartModel.titleText = "Helicopter Noise Complaints (Renderer)";
    heatChartModel.dataLabelsVisibility = true;
    heatChartModel.legendPosition = "top";
    chartElement.autoInverseDataLabelTextColor = true;
    chartElement.model = heatChartModel;
    chartElement.actionMode = "none";
    </script>
    </body>
    </html>

Empty cell

When a heat chart cell contains no data, it displays as a grey cell by default. You can customize empty cells to display specific text or a symbol. Hover tooltips and legend items will also reflect this customization.

CodePen
Sandbox Download
Customized empty cell styling.
  1. Use the emptyCellText property to configure the text of empty cells.
  2. Use the emptyCellSymbol property to configure the symbol of empty cells.
Empty cell
37 collapsed lines
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Calendar Heat Chart with empty cells</title>
<style>
html,
body,
arcgis-chart {
height: 100%;
margin: 0;
}
</style>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.2/"></script>
</head>
<body>
<arcgis-chart></arcgis-chart>
<script type="module">
const { createModel } = await $arcgis.import("@arcgis/charts-components/model/shared/setup-utils.js");
const FeatureLayer = await $arcgis.import("@arcgis/core/layers/FeatureLayer.js");
const featureLayer = new FeatureLayer({
portalItem: {
id: "caea6a7ab4fe44b9b4ec3abb7314c1bb",
},
});
const chartElement = document.querySelector("arcgis-chart");
const heatChartModel = await createModel({
layer: featureLayer,
chartType: "heatChart",
});
heatChartModel.xAxisField = "Created_Date";
heatChartModel.yAxisField = "Created_Date";
heatChartModel.xTemporalBinning = { type: "calendarDateParts", unit: "hourOfDay" };
heatChartModel.yTemporalBinning = { type: "calendarDateParts", unit: "dayOfWeek" };
heatChartModel.setYAxisSortOrder("Desc");
heatChartModel.heatRulesType = "renderer";
// Empty cells will be displayed with text of "No complaints" and a black forward diagonal fill pattern.
heatChartModel.emptyCellText = "No complaints";
heatChartModel.emptyCellSymbol = {
type: "esriSFS",
style: "esriSFSForwardDiagonal",
color: [0, 0, 0, 255],
};
9 collapsed lines
heatChartModel.titleText = "Helicopter Noise Complaints (Empty Cells)";
heatChartModel.dataLabelsVisibility = true;
heatChartModel.legendPosition = "top";
chartElement.autoInverseDataLabelTextColor = true;
chartElement.model = heatChartModel;
chartElement.actionMode = "none";
</script>
</body>
</html>

Grid lines

By default, there are no grid lines surrounding the heat chart cells, but you can customize the grid lines to improve the visual separation of cells. Legend items will reflect the color of the grid lines.

CodePen
Sandbox Download
Customized grid line styling.
  1. Use the setGridLinesSymbol method to configure the appearance of grid lines.
Grid lines
37 collapsed lines
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Calendar Heat Chart with grid lines</title>
<style>
html,
body,
arcgis-chart {
height: 100%;
margin: 0;
}
</style>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.2/"></script>
</head>
<body>
<arcgis-chart></arcgis-chart>
<script type="module">
const { createModel } = await $arcgis.import("@arcgis/charts-components/model/shared/setup-utils.js");
const FeatureLayer = await $arcgis.import("@arcgis/core/layers/FeatureLayer.js");
const featureLayer = new FeatureLayer({
portalItem: {
id: "caea6a7ab4fe44b9b4ec3abb7314c1bb",
},
});
const chartElement = document.querySelector("arcgis-chart");
const heatChartModel = await createModel({
layer: featureLayer,
chartType: "heatChart",
});
heatChartModel.xAxisField = "Created_Date";
heatChartModel.yAxisField = "Created_Date";
heatChartModel.xTemporalBinning = { type: "calendarDateParts", unit: "hourOfDay" };
heatChartModel.yTemporalBinning = { type: "calendarDateParts", unit: "dayOfWeek" };
heatChartModel.setYAxisSortOrder("Desc");
heatChartModel.heatRulesType = "renderer";
// Grid lines will be displayed with a black dashed line.
heatChartModel.setGridLinesSymbol({
type: "esriSLS",
style: "esriSLSDash",
color: [0, 0, 0, 255],
width: 2,
});
9 collapsed lines
heatChartModel.titleText = "Helicopter Noise Complaints (Grid Lines)";
heatChartModel.dataLabelsVisibility = true;
heatChartModel.legendPosition = "top";
chartElement.autoInverseDataLabelTextColor = true;
chartElement.model = heatChartModel;
chartElement.actionMode = "none";
</script>
</body>
</html>