Density Map.

PRO

Show concentrations of observations as a smooth density surface.

Live preview24 feature examples

LIVE EXAMPLE

Density

Match the page theme
Interact with the chart to see selection and range-change results here.
OptionsChanges are reflected in the preview and code.
Appearance and style7
Axes and grid lines14
Legend and interaction13
Title and dimensions3

Estimate density around observed points. All values are sample data.

View code
Current preview
<div id="chart-container" style="width: 100%; min-width: 0;"></div>

<script type="module">
  import { defineCustomElement as define0 } from '@syidax/advanced-pro/components/sy-density-map.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-density-map",
      "props": {
        "data": [
          {
            "x": 0,
            "y": 7,
            "weight": 1
          },
          {
            "x": 16,
            "y": 4,
            "weight": 2
          },
          {
            "x": 29,
            "y": -3,
            "weight": 3
          },
          {
            "x": 37,
            "y": -7,
            "weight": 1
          },
          {
            "x": 44,
            "y": -5,
            "weight": 2
          },
          {
            "x": 55,
            "y": 2,
            "weight": 3
          },
          {
            "x": -1,
            "y": 17,
            "weight": 1
          },
          {
            "x": 15,
            "y": 15,
            "weight": 2
          },
          {
            "x": 29,
            "y": 9,
            "weight": 3
          },
          {
            "x": 38,
            "y": 4,
            "weight": 1
          },
          {
            "x": 45,
            "y": 4,
            "weight": 2
          },
          {
            "x": 55,
            "y": 10,
            "weight": 3
          },
          {
            "x": -3,
            "y": 26,
            "weight": 1
          },
          {
            "x": 14,
            "y": 26,
            "weight": 2
          },
          {
            "x": 29,
            "y": 21,
            "weight": 3
          },
          {
            "x": 39,
            "y": 15,
            "weight": 1
          },
          {
            "x": 47,
            "y": 13,
            "weight": 2
          },
          {
            "x": 55,
            "y": 18,
            "weight": 3
          },
          {
            "x": -4,
            "y": 35,
            "weight": 1
          },
          {
            "x": 13,
            "y": 37,
            "weight": 2
          },
          {
            "x": 29,
            "y": 33,
            "weight": 3
          },
          {
            "x": 40,
            "y": 26,
            "weight": 1
          },
          {
            "x": 48,
            "y": 23,
            "weight": 2
          },
          {
            "x": 56,
            "y": 26,
            "weight": 3
          },
          {
            "x": -5,
            "y": 43,
            "weight": 1
          },
          {
            "x": 11,
            "y": 47,
            "weight": 2
          },
          {
            "x": 28,
            "y": 45,
            "weight": 3
          },
          {
            "x": 41,
            "y": 38,
            "weight": 1
          },
          {
            "x": 49,
            "y": 33,
            "weight": 2
          },
          {
            "x": 57,
            "y": 35,
            "weight": 3
          },
          {
            "x": -5,
            "y": 51,
            "weight": 1
          },
          {
            "x": 10,
            "y": 56,
            "weight": 2
          },
          {
            "x": 27,
            "y": 56,
            "weight": 3
          },
          {
            "x": 41,
            "y": 50,
            "weight": 1
          },
          {
            "x": 51,
            "y": 44,
            "weight": 2
          },
          {
            "x": 58,
            "y": 44,
            "weight": 3
          }
        ],
        "kernel": "gaussian",
        "bandwidth": 9,
        "columns": 60,
        "rows": 40,
        "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', 'density-map 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 clusters and spatial concentration among many points.

Density is an estimate, not a raw observation. Results depend on bandwidth and coordinate units.

Data contract

PropertyInput format
dataAn array of { x, y, weight? }.
bandwidthThe range over which the kernel is applied.
kernelThe kernel used for density estimation.

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 24 interactive feature examples and inspect their code. Select “Edit in preview” to combine more options in the settings panel above.

Wide density radiusPRO

Aggregate nearby points across a wider area to see overall density.

Interact with the chart to see results here.
View code

Epanechnikov kernelPRO

Compare the density distribution's shape using a different kernel.

Interact with the chart to see results here.
View code

Inspect values with the pointerPRO

Point to data to view the value at that location.

Interact with the chart to see results here.
View code

Crosshair trackingPRO

Move the pointer to read horizontal and vertical coordinates alongside values.

Interact with the chart to see results here.
View code

Drag to zoom and panPRO

Drag to zoom and hold Shift to pan. Use Ctrl + wheel to zoom in or out.

Interact with the chart to see results here.
View code

Replay animationPRO

Redraw the same example to inspect its initial display animation.

Interact with the chart to see results here.
View code

AnimationPRO

Compare 1 examples of Animation. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

AxisPRO

Compare 6 examples of Axis. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

BandwidthPRO

Compare 5 examples of Bandwidth. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

ComputePRO

Compare 3 examples of Compute. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

CrosshairPRO

Compare 5 examples of Crosshair. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Data inputPRO

Compare 1 examples of Data input. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

KernelPRO

Compare 6 examples of Kernel. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Large datasetsPRO

Compare 1 examples of Large datasets. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

RenderPRO

Compare 5 examples of Render. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

SizePRO

Compare 1 examples of Size. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

TooltipPRO

Compare 13 examples of Tooltip. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Visual mapPRO

Compare 3 examples of Visual map. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Zoom and panPRO

Compare 6 examples of Zoom and pan. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Context menuPRO

Compare 1 examples of Context menu. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Data context menuPRO

Compare 1 examples of Data context menu. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
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.

Interact with the chart to see results here.
View code

OverviewPRO

Compare 4 examples of Overview. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
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.

Interact with the chart to see results here.
View code

API reference

#

The full public API for sy-density-map. Pass objects and arrays as JavaScript properties. Select a name to view usage code and type definitions.

Key properties

Attribute / PropertyType / DefaultDescription
DensityMapInputDefault: undefinedAn array of { x, y, weight? }.
numberDefault: 640Chart width in pixels. Update with ResizeObserver when the container changes.
numberDefault: 400Chart height in pixels.
brandLogostringDefault: undefinedThe 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.
cellSizenumberDefault: 3CSS px per estimate cell (the grid follows the plot size); `columns` / `rows` override it.
DensityMapBandwidthInputDefault: 'auto'The range over which the kernel is applied.
bandwidthUnitDensityMapBandwidthUnitDefault: 'data'`data` (default) — the bandwidth is in data units; `px` — in CSS px of the plot.
DensityMapKernelDefault: 'gaussian'The kernel used for density estimation.
numberDefault: 0.02Cells under this fraction of the peak density are empty (the background shows through).
numberDefault: 0.06Set as an HTML attribute or JavaScript property. type: number.
densityUnitDensityMapUnitInputDefault: 'mass'Allowed values: mass, per-area. Default: 'mass'.
xAxisXAxisInputDefault: undefinedOne x axis, or `[bottom, top, …]` slots (the multi x-axis; a slot may carry its own `min` / `max`, `kind: 'log' | 'time'` or `linkedTo` per the shared contract).
yAxisYAxisInputDefault: undefinedOne y axis, or `[left, right, …]` — a later slot may carry its own `min` / `max` (a second unit for the same y), a `kind` or `linkedTo`.
gridLinesCartesianGridLinesInputDefault: undefinedGrid lines default OFF (the plane tiles the plot).
CartesianCrosshairInputDefault: undefinedCrosshair that follows the cursor across the plot.
CartesianZoomInputDefault: undefinedSettings for zooming and the visible range.
chartTitlestringDefault: undefinedThe title inside the chart. Explain the data's unit and meaning alongside it.
chartSubtitlestringDefault: undefinedThe subtitle inside the chart.
CartesianTooltipInputDefault: undefinedTooltip settings for pointer-driven values, position, and content.
tooltipEnabledbooleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
animatedbooleanDefault: falseWhether to animate initial display and data changes.
animationDurationnumberDefault: 600Animation duration in milliseconds.
animationEasingDensityMapEasingDefault: 'ease-out'Allowed values: linear, ease-out, ease-in, ease-in-out. Default: 'ease-out'.
animationTypeDensityMapAnimationTypeDefault: undefinedAllowed values: initial, update. Default: undefined.
Other properties 21
Attribute / PropertyType / DefaultDescription
xMinnumberDefault: undefinedExplicit domain ends (an omitted end follows the point extent padded by `padding`; `x-axis` / `y-axis` `min` / `max` also set them).
xMaxnumberDefault: undefinedSet as an HTML attribute or JavaScript property. type: number.
yMinnumberDefault: undefinedSet as an HTML attribute or JavaScript property. type: number.
yMaxnumberDefault: undefinedSet as an HTML attribute or JavaScript property. type: number.
numberDefault: 0.05The fraction of the span padded on each automatic domain end.
numberDefault: undefinedSet as an HTML attribute or JavaScript property. type: number.
numberDefault: undefinedSet as an HTML attribute or JavaScript property. type: number.
computePathDensityMapComputePathInputDefault: 'auto'Allowed values: auto, cpu, gpu. Default: 'auto'.
string | ReadonlyArray<string> | ReadonlyArray<readonly [number, string]>Default: undefinedThe colour ramp over the density domain (a scheme name, a colour list / comma list, or `[t, colour]` stops).
valueMinnumberDefault: undefinedDensity domain ends; an omitted end follows 0 … the peak.
valueMaxnumberDefault: undefinedSet as an HTML attribute or JavaScript property. type: number.
emptyColorstringDefault: 'transparent'The colour of an empty (under-threshold) cell — transparent by default.
DensityMapLodModeDefault: 'smooth'The plane's level of detail: `smooth` (bilinear between cell centres — the default here), `auto`, `point`, `area`.
enableMouseTrackingbooleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
tooltipFormat(detail: DensityMapPointEventDetail) => stringDefault: undefinedPass as a JavaScript property. type: (detail: DensityMapPointEventDetail) => string.
streamSourceDensityMapStreamSourceDefault: undefinedA stream source for live data. Check the contract for the specific type.
streamMaxnumberDefault: undefinedThe maximum number of streaming data points to retain.
streamWindownumberDefault: undefinedThe streaming data range to keep visible.
visualMapVisualMapBinding | nullDefault: undefinedA visual-map binding (a `sy-visual-map` snapshot + dimension); it overrides `colors` / `value-min` / `value-max` while bound.
DensityMapEngineModeDefault: 'auto'Renderer selection: auto, standard, or pro. Engine selection is separate from permission to use a Pro chart type.
DensityMapUnavailableBehaviourDefault: 'fallback'`fallback` shows the on-chart notice when the renderer cannot run; `error` throws.
Events 14
EventsDetail typeDescription
DensityMapRenderResult & { tier: DensityMapEngineTier; engine?: ChartEngineStatus }Emits rendering results in detail when chart drawing completes.
DensityMapPointEventDetailA point selection event. Read the selected data and index from CustomEvent.detail.
DensityMapPointEventDetail | nullCustomEvent.detail type: DensityMapPointEventDetail | null. Event names are case-sensitive.
CartesianCrosshairEventDetail | nullCustomEvent.detail type: CartesianCrosshairEventDetail | null. Event names are case-sensitive.
ChartPointContextMenuEventDetail<DensityMapPointEventDetail>CustomEvent.detail type: ChartPointContextMenuEventDetail<DensityMapPointEventDetail>. 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.
voidCustomEvent.detail type: void. Event names are case-sensitive.
voidCustomEvent.detail type: void. Event names are case-sensitive.
voidCustomEvent.detail type: void. Event names are case-sensitive.
CartesianTooltipEventDetailWhether to display the built-in tooltip.
voidCustomEvent.detail type: void. Event names are case-sensitive.
CartesianTooltipActionEventDetailCustomEvent.detail type: CartesianTooltipActionEventDetail. Event names are case-sensitive.
CartesianZoomChangeEventDetailFired after every zoom change (drag / pan / wheel / pinch / keyboard / api / reset) with the new state.
Methods 39

Stencil methods return Promises. Use await within an async function to read the result.

Method / ArgumentsReturn typeDescription
Promise<ChartDataTable>Current normalized table, including the retained stream; independent of GPU availability.
Promise<DensityMapRenderResult>Draws a frame now; rejects with the SyidaxLicenseError while the type is not entitled or the chart is frozen.
Promise<DensityMapEngineTier>An asynchronous method. Check the argument and return types below.
Promise<string | undefined>The reason the renderer cannot run (`undefined` while it runs).
data: DensityMapInputPromise<void>An asynchronous method. Check the argument and return types below.
point: DensityMapPoint | DensityMapTuplePromise<void>An asynchronous method. Check the argument and return types below.
points: ReadonlyArray<DensityMapPoint | DensityMapTuple>Promise<void>An asynchronous method. Check the argument and return types below.
count: numberPromise<void>An asynchronous method. Check the argument and return types below.
points: ReadonlyArray<DensityMapPoint | DensityMapTuple>Promise<void>An asynchronous method. Check the argument and return types below.
Promise<DensityMapStreamSource | undefined>An asynchronous method. Check the argument and return types below.
options: { duration?: number; easing?: DensityMapEasing; enabled?: boolean; type?: DensityMapAnimationType }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.
cssX: number, cssY: numberPromise<DensityMapPointEventDetail | null>The estimate cell under host-relative CSS coordinates, or null (the density waits for a pending readback).
col: number, row: numberPromise<number | null>The density of a cell in the public unit (`null` under the threshold or outside the grid).
x: number, y: numberPromise<number | null>The density at a data-space point in the public unit (`null` outside the domain or under the threshold).
Promise<DensityMapValueExtent | null>The density extent of the estimate in the public unit (min 0, max = the peak, finite = cells over the threshold).
col: number, row: numberPromise<CartesianTooltipEventDetail | null>An asynchronous method. Check the argument and return types below.
index: numberPromise<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: numberPromise<DensityMapPointEventDetail | null>An asynchronous method. Check the argument and return types below.
Promise<{ columns: number; rows: number; cells: number }>An asynchronous method. Check the argument and return types below.
Promise<DensityMapDomain>The data domain the grid spans.
Promise<DensityMapBandwidth>The resolved bandwidth (data units, CSS px, cells; `auto` when Silverman chose it).
Promise<{ kernel: DensityMapKernel; x: number[]; y: number[]; radius: { x: number; y: number } }>An asynchronous method. Check the argument and return types below.
Promise<DensityMapComputeStats>The statistics of the last estimate (points, grid, kernel, bandwidth, radius, compute time, peak, mass).
Promise<Float32Array>An asynchronous method. Check the argument and return types below.
Promise<{ values: Float32Array; densityMax: number; mass: number; binned: number; finite: number; computeMs: number; radius: { x: number; y: number } }>An asynchronous method. Check the argument and return types below.
binding: VisualMapBinding | nullPromise<VisualMapBinding | null>Bind (or clear with null) a visual-map snapshot; it wins over the `visualMap` prop until the prop changes again.
Promise<VisualMapBinding | null>An asynchronous method. Check the argument and return types below.
request?: VisualMapExtentRequestPromise<VisualMapExtent | null>The extent of a dimension: `value` = the density (0 … peak), `x` / `y` = the domain, `index` = the cell indexes.
request: CartesianZoomRequestPromise<CartesianZoomChangeEventDetail | null>Zoom to explicit windows in data units: `x` / `y` as `{ min, max }` or `[min, max]` (`null` clears that orientation); `xAxis` / `yAxis` name the axis by id or slot index (default: the primary axis).
factor: number, anchorFraction?: numberPromise<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 data units (`{ x?, y? }`); a no-op at the full extent.
Promise<CartesianZoomChangeEventDetail | null>Back to the full extent.
Promise<CartesianZoomState | null>The current zoom state (`null` = full extent).
request?: CartesianZoomExtentRequestPromise<CartesianZoomExtentDetail | null>The full extent (and key) of the primary — or the named — master axes (the field's x / y domain).
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.