Heatmap.
PROEncode values at two coordinates using color.
LIVE EXAMPLE
Grid measurements
Appearance and style7
Axes and grid lines14
Legend and interaction13
Title and dimensions3
Place each cell using x and y coordinates and encode value as color. All values are sample data.
View code
<div id="chart-container" style="width: 100%; min-width: 0;"></div>
<script type="module">
import { defineCustomElement as define0 } from '@syidax/advanced-pro/components/sy-heatmap.js';
define0();
// Pro: complete registerLicense at app startup using your issued certificate.
// The website preview certificate is not for use in customer apps.
const specs = [
{
"id": "example-chart",
"tag": "sy-heatmap",
"props": {
"data": [
{
"x": 0,
"y": 0,
"value": 10
},
{
"x": 1,
"y": 0,
"value": 27
},
{
"x": 2,
"y": 0,
"value": 44
},
{
"x": 3,
"y": 0,
"value": 61
},
{
"x": 4,
"y": 0,
"value": 78
},
{
"x": 5,
"y": 0,
"value": 95
},
{
"x": 0,
"y": 1,
"value": 22
},
{
"x": 1,
"y": 1,
"value": 39
},
{
"x": 2,
"y": 1,
"value": 56
},
{
"x": 3,
"y": 1,
"value": 73
},
{
"x": 4,
"y": 1,
"value": 90
},
{
"x": 5,
"y": 1,
"value": 17
},
{
"x": 0,
"y": 2,
"value": 34
},
{
"x": 1,
"y": 2,
"value": 51
},
{
"x": 2,
"y": 2,
"value": 68
},
{
"x": 3,
"y": 2,
"value": 85
},
{
"x": 4,
"y": 2,
"value": 12
},
{
"x": 5,
"y": 2,
"value": 29
},
{
"x": 0,
"y": 3,
"value": 46
},
{
"x": 1,
"y": 3,
"value": 63
},
{
"x": 2,
"y": 3,
"value": 80
},
{
"x": 3,
"y": 3,
"value": 97
},
{
"x": 4,
"y": 3,
"value": 24
},
{
"x": 5,
"y": 3,
"value": 41
},
{
"x": 0,
"y": 4,
"value": 58
},
{
"x": 1,
"y": 4,
"value": 75
},
{
"x": 2,
"y": 4,
"value": 92
},
{
"x": 3,
"y": 4,
"value": 19
},
{
"x": 4,
"y": 4,
"value": 36
},
{
"x": 5,
"y": 4,
"value": 53
}
],
"width": 640,
"height": 360,
"brandPosition": "bottom-right",
"brandLogo": ""
}
}
];
const container = document.querySelector('#chart-container');
const elements = specs.map(({ tag, id, props }) => {
const element = document.createElement(tag);
element.id = id;
Object.assign(element, props);
element.setAttribute('aria-label', 'heatmap example chart');
return element;
});
container.replaceChildren(...elements);
const chart = elements.at(-1);
const onEvent = event => {
console.log('pointClick', event.detail);
};
chart.addEventListener('pointClick', onEvent);
const observer = new ResizeObserver(([entry]) => {
const width = Math.max(160, Math.floor(entry.contentRect.width));
elements.forEach(element => { element.width = width; });
});
observer.observe(container);
// In an SPA, call this function when the view is disposed.
function disposeChart() {
observer.disconnect();
chart.removeEventListener('pointClick', onEvent);
container.replaceChildren();
}
</script>Usage and data
#Explore matrix patterns across time, products, sensor locations, and similar dimensions.
Color alone makes precise values difficult to read. Provide a legend, tooltips, and a table.
Data contract
| Property | Input format |
|---|---|
data | An array of { x, y, value }. x and y are numeric or categorical coordinates. |
Updating data
Assign a new array or object to the property instead of mutating values inside an array. Chart events provide selection results through event.detail. When disposing of the view, clean up ResizeObserver and event listeners registered by your app.
Feature examples
#Try 20 interactive feature examples and inspect their code. Select “Edit in preview” to combine more options in the settings panel above.
Cell spacing and cornersPRO
Distinguish individual measurements with rounded cells and spacing.
View code
Cell outlinesPRO
Draw lines around cell boundaries.
View code
Inspect values with the pointerPRO
Point to data to view the value at that location.
View code
Crosshair trackingPRO
Move the pointer to read horizontal and vertical coordinates alongside values.
View code
Drag to zoom and panPRO
Drag to zoom and hold Shift to pan. Use Ctrl + wheel to zoom in or out.
View code
Replay animationPRO
Redraw the same example to inspect its initial display animation.
View code
AnimationPRO
Compare 1 examples of Animation. Buttons and options update both the live result and source code.
View code
AxisPRO
Compare 5 examples of Axis. Buttons and options update both the live result and source code.
View code
CrosshairPRO
Compare 5 examples of Crosshair. Buttons and options update both the live result and source code.
View code
Data inputPRO
Compare 1 examples of Data input. Buttons and options update both the live result and source code.
View code
Large datasetsPRO
Compare 1 examples of Large datasets. Buttons and options update both the live result and source code.
View code
SizePRO
Compare 1 examples of Size. Buttons and options update both the live result and source code.
View code
TooltipPRO
Compare 13 examples of Tooltip. Buttons and options update both the live result and source code.
View code
Visual mapPRO
Compare 3 examples of Visual map. Buttons and options update both the live result and source code.
View code
Zoom and panPRO
Compare 6 examples of Zoom and pan. Buttons and options update both the live result and source code.
View code
Context menuPRO
Compare 1 examples of Context menu. Buttons and options update both the live result and source code.
View code
Data context menuPRO
Compare 1 examples of Data context menu. Buttons and options update both the live result and source code.
View code
Read coordinates and dataPRO
Compare 1 examples of Read coordinates and data. Buttons and options update both the live result and source code.
View code
OverviewPRO
Compare 5 examples of Overview. Buttons and options update both the live result and source code.
View code
Streaming · Add and update live dataPRO
Compare 5 examples of Add and update live data. Buttons and options update both the live result and source code.
View code
Add to your interface
#The code tabs below the preview contain the full data, options, event bindings, and responsive sizing for the current example. Copy them into an app project, such as Vite, that can resolve the installed packages.
API reference
#The full public API for sy-heatmap. Pass objects and arrays as JavaScript properties. Select a name to view usage code and type definitions.
Key properties
| Attribute / Property | Type / Default | Description |
|---|---|---|
HeatmapDataDefault: undefined | An array of { x, y, value }. x and y are numeric or categorical coordinates. | |
numberDefault: 640 | Chart width in pixels. Update with ResizeObserver when the container changes. | |
numberDefault: 400 | Chart height in pixels. | |
| brandLogo | stringDefault: undefined | The default is the Syidax logo. With the Pro chart.branding entitlement, use none or a PNG, JPEG, or WebP data URL. |
| brandPosition | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'Default: 'bottom-right' | The corner where the logo is anchored. Applies equally to Community and Pro, on screen and in image exports. |
| emptyColor | stringDefault: 'transparent' | The colour of an empty cell (default transparent — the host background shows). |
| cellGap | numberDefault: 0 | Gap between cells in CSS px. |
| cellRadius | numberDefault: 0 | Set as an HTML attribute or JavaScript property. type: number. |
| cellBorder | numberDefault: 0 | Set as an HTML attribute or JavaScript property. type: number. |
| cellBorderColor | stringDefault: 'rgba(17,24,39,0.35)' | Set as an HTML attribute or JavaScript property. type: string. |
HeatmapLodModeDefault: 'auto' | Allowed values: auto, point, area, smooth. Default: 'auto'. | |
| areaReduce | 'mean' | 'max'Default: 'mean' | Allowed values: max, mean. Default: 'mean'. |
| xAxis | CartesianAxisInputDefault: undefined | Allowed values: auto, off. Default: undefined. |
| yAxis | YAxisInputDefault: undefined | One y axis (the row category axis), or a slot array `[rows, …]` — later slots mirror the rows or carry a numeric `kind` of their own. |
| gridLines | CartesianGridLinesInputDefault: undefined | Grid lines default OFF (the cells tile the plot). |
CartesianCrosshairInputDefault: undefined | Crosshair that follows the cursor across the plot. | |
CartesianZoomInputDefault: undefined | Settings for zooming and the visible range. | |
| chartTitle | stringDefault: undefined | The title inside the chart. Explain the data's unit and meaning alongside it. |
| chartSubtitle | stringDefault: undefined | The subtitle inside the chart. |
CartesianTooltipInputDefault: undefined | Tooltip settings for pointer-driven values, position, and content. | |
| tooltipEnabled | booleanDefault: true | Set as an HTML attribute or JavaScript property. type: boolean. |
| animated | booleanDefault: false | Whether to animate initial display and data changes. |
| animationDuration | numberDefault: 600 | Animation duration in milliseconds. |
| animationEasing | HeatmapEasingDefault: 'ease-out' | Allowed values: linear, ease-out, ease-in, ease-in-out. Default: 'ease-out'. |
| animationType | HeatmapAnimationTypeDefault: undefined | Allowed values: initial, update. Default: undefined. |
Other properties 15
| Attribute / Property | Type / Default | Description |
|---|---|---|
HeatmapMatrixInputDefault: undefined | A dense matrix: `{ columns, rows, values }` (row-major) or rows of columns. | |
| xCategories | HeatmapCategoriesInputDefault: undefined | Column labels (array, or a comma list attribute). Given explicitly, they fix the column count. |
| yCategories | HeatmapCategoriesInputDefault: undefined | Row labels (row 0 is the top row). |
HeatmapColorInputDefault: undefined | The colour ramp: a scheme name (`viridis`, `blues`, …), a colour list / comma list, or `[t, colour]` stops. | |
| valueMin | numberDefault: undefined | Domain ends; an omitted end follows the data extent. |
| valueMax | numberDefault: undefined | Set as an HTML attribute or JavaScript property. type: number. |
| renderPath | HeatmapRenderPathDefault: 'auto' | Allowed values: auto, plane, cells. Default: 'auto'. |
| enableMouseTracking | booleanDefault: true | Set as an HTML attribute or JavaScript property. type: boolean. |
| tooltipFormat | (detail: HeatmapPointEventDetail) => stringDefault: undefined | Pass as a JavaScript property. type: (detail: HeatmapPointEventDetail) => string. |
| streamSource | HeatmapStreamSourceDefault: undefined | A stream source for live data. Check the contract for the specific type. |
| streamMax | numberDefault: undefined | The maximum number of streaming data points to retain. |
| streamWindow | numberDefault: undefined | The streaming data range to keep visible. |
| visualMap | VisualMapBinding | nullDefault: undefined | Pass as a JavaScript property. type: VisualMapBinding | null. |
HeatmapEngineModeDefault: 'auto' | Renderer selection: auto, standard, or pro. Engine selection is separate from permission to use a Pro chart type. | |
HeatmapUnavailableBehaviourDefault: 'fallback' | `fallback` shows the on-chart notice when the renderer cannot run; `error` throws. |
Events 14
| Events | Detail type | Description |
|---|---|---|
HeatmapRenderResult & { tier: HeatmapEngineTier; engine?: ChartEngineStatus } | Emits rendering results in detail when chart drawing completes. | |
HeatmapPointEventDetail | A point selection event. Read the selected data and index from CustomEvent.detail. | |
HeatmapPointEventDetail | null | CustomEvent.detail type: HeatmapPointEventDetail | null. Event names are case-sensitive. | |
CartesianCrosshairEventDetail | null | CustomEvent.detail type: CartesianCrosshairEventDetail | null. Event names are case-sensitive. | |
ChartPointContextMenuEventDetail<HeatmapPointEventDetail> | CustomEvent.detail type: ChartPointContextMenuEventDetail<HeatmapPointEventDetail>. Event names are case-sensitive. | |
{ count: number } | CustomEvent.detail type: { count: number }. Event names are case-sensitive. | |
{ dropped: number } | CustomEvent.detail type: { dropped: number }. Event names are case-sensitive. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
CartesianTooltipEventDetail | Whether to display the built-in tooltip. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
CartesianTooltipActionEventDetail | CustomEvent.detail type: CartesianTooltipActionEventDetail. Event names are case-sensitive. | |
CartesianZoomChangeEventDetail | Zoom — every zoom / pan change (drag, keyboard, wheel, pinch, API, reset); `null` zoom = the full extent. |
Methods 33
Stencil methods return Promises. Use await within an async function to read the result.
| Method / Arguments | Return type | Description |
|---|---|---|
Promise<ChartDataTable> | Current normalized table, including the retained stream; independent of GPU availability. | |
Promise<HeatmapRenderResult> | Draws a frame now; rejects with the SyidaxLicenseError while the type is not entitled or the chart is frozen. | |
Promise<HeatmapEngineTier> | An asynchronous method. Check the argument and return types below. | |
Promise<string | undefined> | The reason the renderer cannot run (`undefined` while it runs). | |
| data: HeatmapData | Promise<void> | An asynchronous method. Check the argument and return types below. |
| matrix: HeatmapMatrixInput | Promise<void> | An asynchronous method. Check the argument and return types below. |
| cell: HeatmapDatum | HeatmapTuple | Promise<void> | An asynchronous method. Check the argument and return types below. |
| cells: ReadonlyArray<HeatmapDatum | HeatmapTuple> | Promise<void> | An asynchronous method. Check the argument and return types below. |
| count: number | Promise<void> | An asynchronous method. Check the argument and return types below. |
| cells: ReadonlyArray<HeatmapDatum | HeatmapTuple> | Promise<void> | An asynchronous method. Check the argument and return types below. |
Promise<HeatmapStreamSource | undefined> | An asynchronous method. Check the argument and return types below. | |
| options: { duration?: number; easing?: HeatmapEasing; enabled?: boolean; type?: HeatmapAnimationType } | Promise<void> | An asynchronous method. Check the argument and return types below. |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
| col: number, row: number | Promise<CartesianTooltipEventDetail | null> | An asynchronous method. Check the argument and return types below. |
| index: number | Promise<CartesianTooltipEventDetail | null> | An asynchronous method. Check the argument and return types below. |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
| col: number, row: number | Promise<HeatmapPointEventDetail | null> | An asynchronous method. Check the argument and return types below. |
| cssX: number, cssY: number | Promise<HeatmapPointEventDetail | null> | The cell under host-relative CSS coordinates (inside the plot, through the zoomed matrix), or null. |
| col: number, row: number | Promise<number | null> | The value of a cell (`null` when empty or outside the grid). |
Promise<HeatmapValueExtent | null> | Min / max / finite count of the current values (`null` when nothing is finite). | |
Promise<{ columns: number; rows: number; cells: number }> | Columns × rows of the current grid. | |
| request: CartesianZoomRequest | Promise<CartesianZoomChangeEventDetail | null> | Zoom to explicit windows in index units: `x` / `y` as `{ min, max }` or `[min, max]` (`null` clears that orientation). |
| factor: number, anchorFraction?: number | Promise<CartesianZoomChangeEventDetail | null> | Scale the current windows by `factor` (< 1 zooms in) around `anchorFraction` (0..1, default centre). |
| delta: { x?: number; y?: number } | Promise<CartesianZoomChangeEventDetail | null> | Slide the zoomed windows by index units (`{ x?, y? }`); a no-op at the full extent. |
Promise<CartesianZoomChangeEventDetail | null> | Back to the full matrix. | |
Promise<CartesianZoomState | null> | The current zoom state (`null` = the full extent). | |
| request?: CartesianZoomExtentRequest | Promise<CartesianZoomExtentDetail | null> | The full extent (and key) of the primary — or the named — axes: `-0.5 … columns - 0.5` / `-0.5 … rows - 0.5`. |
| binding: VisualMapBinding | null | Promise<VisualMapBinding | null> | Bind (or clear) a visual map: every cell is coloured through it on the next frame. |
Promise<VisualMapBinding | null> | An asynchronous method. Check the argument and return types below. | |
| request?: VisualMapExtentRequest | Promise<VisualMapExtent | null> | The extent a bound `sy-visual-map` adopts as its domain: the finite cell values (`value`), or the index ranges (`x` = columns, `y` = rows, `index` = cells). |
Promise<ChartEngineStatus> | Requested engine vs what runs, and why (CHART-ADD-08): the decision for the current inputs, read without side effects (ProChartLicense.engineStatus); a renderer that failed at run time reports engine-unsupported. |
No matching APIs.