DocumentationCharts

Angular Dot Plot Chart

The dot plot places each point along a single value axis. Points with the same value, or that fall in the same binWidth bin, stack into a column. This shows how the values are spread out while keeping every item visible, so each one can still be hovered and clicked. A point can also be drawn as an image instead of a dot. The dot plot uses the same data as the Plot Chart: a list of series, each holding its points. A point's value sets its position on the axis, its key is its name, and its series sets its color. Points without a numeric value are skipped, and so are hidden series and hidden points.

Try it

A month of daily high temperatures, one mark per day, grouped by the weather. The controls below change the chart's config as you use them. The Configuration table explains each setting.

values within 2° stack togethereach day shows its weather22pxno tick marks

Daily highs in June

Change the settings above and it redraws.

const config: PcacDotPlotChartConfig = {
  // Each series holds its points. value = position on the axis, key = the point's name.
  data: [
    { key: 'Sunny', value: null, hide: false, data: [
      { key: 'June 1', value: 81, hide: false, data: [], image: 'sun.svg' },
      ...
    ] },
    ...
  ],
  xAxis: { domainMin: 50, domainMax: 90, label: 'Daily high (°F)', showGrid: true },
  binWidth: 2,
  pointImage: { maxWidth: 22, maxHeight: 22 },
};

Showing the drawn size

When a column is too tall for the chart's height, every mark shrinks by the same amount until the column fits. This means marks can end up smaller than the size set by pointImage (or dotRadius). To see it in the demo above, set binWidth to 5 and raise pointImage. The markFit output tells you how much the marks shrank: 1 means full size, and anything below 1 means they were scaled down. An image is drawn at maxWidth * fit by maxHeight * fit.

Use markFit to keep a size control accurate. Track two values: the size the user picked and the size the control shows. Build the chart's config from the picked size. That way, the marks grow back toward the picked size when the columns get shorter (with different data or a taller chart, for example), and if the chart can't fit the picked size, the control settles on the size that was actually drawn. markFit only emits when the fit changes, so whenever the user moves the control, set the shown size to the picked size and let the next markFit correct it.

// The picked size drives the chart; the slider shows the size that was drawn.
readonly pickedSize = signal(40);
readonly shownSize = signal(40);

readonly config = computed<PcacDotPlotChartConfig>(() => {
  const size = this.pickedSize();
  return { ...base, pointImage: { maxWidth: size, maxHeight: size } };
});

// The slider: [value]="shownSize()" (input)="pick(...)"
pick(size: number): void {
  this.pickedSize.set(size);
  // markFit only emits when the fit changes, so assume the size fits until it says otherwise.
  this.shownSize.set(size);
}

// The chart: (markFit)="onMarkFit($event)"
onMarkFit(fit: number): void {
  this.shownSize.set(Math.floor(this.pickedSize() * fit));
}

Markup

<pcac-dot-plot-chart [config]="config" (dotClicked)="onClicked($event)" />

API

import { PcacDotPlotChart, PcacDotPlotChartConfig } from '@pioneer-code/pioneer-charts';

Configuration

NameDescription
dataCollection of PcacData objects.
heightHeight of chart component. Default is 200px.
ariaLabelWhat the chart shows, for screen readers — e.g. 'Sales by month, 2026'. The chart is announced as a group with this name, and each bar, slice or point inside it by its own key and value (see Accessibility). When omitted, its type is used: 'Bar chart', 'Pie chart', 'Line chart' and so on.
heightFullIf true, height is treated as a minimum height and the chart grows to fill its container whenever that container is taller. Default is false.
  • Give the element you wrap the chart in a definite height — an explicit height, or a flex/grid track that resolves to one. The chart stretches itself to fill it.
  • If that wrapper is auto-height, there is nothing to fill and the chart falls back to height.
  • The chart keeps filling as the container resizes, so this works with collapsing sidebars, tabs and window resizes.
xAxis / yAxisPer-axis settings, one PcacAxisConfig for each axis. Every field is optional; omit the whole object for a default axis. See the Axis Styling guide for a live demo.
  • hide — if true, the axis isn't drawn at all and the margins it would have occupied go to the plot (left and top for the y axis, bottom and right for the x axis); the chart's overall size doesn't change. Default false.
  • showGrid — draw grid lines from this axis's ticks (or, on a category axis, from each category) across the plot: horizontal lines for the y axis, vertical for the x. Left unset, each chart keeps the grid it has always drawn — the y axis's on vertical bar and line/area/plot charts, the x axis's on the horizontal bar chart — and no other. Set it to turn either grid on or off.
  • gridColor — any CSS color for this axis's grid lines, in place of the theme's $gray-200. Only shows while that grid is drawn (it doesn't turn the grid on). Applied as the --pcac-grid-color custom property on the grid group; a stylesheet can set the same property on an ancestor instead.
  • ticks — requested number of ticks (a hint to D3, so the exact count can differ), and the number of grid lines. Ignored by a category axis, which has one tick per category. Default 5.
  • tickSize — length in pixels of the small tick marks. Marks are not drawn unless this is set, so setting a size is also what turns them on (6 is D3's usual length); 0 keeps them off but pulls the labels in to the axis. Labels follow the marks and the chart's margins grow or shrink by the same amount, so the plot area shrinks to make room rather than pushing labels off the edge. Stroked with the theme's $gray-900 via .pcac-axis-tick-marks .tick line, unless tickColor is set. Ignored while autoTickSize is on.
  • autoTickSize — if true, size the tick marks from the chart's points instead of tickSize: half the largest mark toward this axis, so a point sitting on the axis ends where its tick does and never covers a tick label (D3's 3px tick padding is the gap left between them). The largest mark is measured as drawn — a hovered dot, an image's pointImage box (its height for the x axis, its width for the y), and a gauge ring around either, after any shrinking to fit. This overrides tickSize: with it on, any tickSize on the same axis is ignored. It turns the marks on, as a tickSize does, and the margins make room the same way. Honored by the line, area, plot and dot plot charts; the other charts ignore it. On the dot plot the marks never reach the axis (the bottom row sits a gap above it), so there it only spaces the labels to the marks' size. Default false.
  • tickColor — any CSS color for the tick marks. Only shows once tickSize has turned the marks on. Applied as --pcac-axis-tick-color on the axis group.
  • tickLabelColor — any CSS color for the tick labels (the values along the axis), which otherwise follow the page's text color (currentColor). Applied as --pcac-axis-tick-label-color on the axis group.
  • showLine — if true, draw a solid line along the axis itself (with D3's short end-caps). Independent of the tick marks. Default false. Stroked with the theme's $gray-900 via .pcac-axis-line .domain, unless lineColor is set.
  • lineColor — any CSS color for the axis line. Only shows with showLine on. Applied as --pcac-axis-line-color on the axis group.
  • label — a title for the axis, drawn centered along it just inside the chart's edge (below the tick labels for the x axis; rotated to read bottom-to-top, left of them, for the y axis). The margin grows by 18px to make room, shrinking the plot area. Not drawn on a hidden axis. Styled by the theme's .pcac-axis-label rule.
  • labelColor — any CSS color for the label, in place of the theme's $gray-700. Applied as --pcac-axis-label-color on the axis group.
  • subLabels — { min?, mid?, max? }: up to three short labels placed by position along the axis, in their own row just outside the tick labels (and inside the label, if there is one). min is aligned to the axis's start, mid centered, max to its end, so they never spill past the axis; on the y axis they read bottom-to-top with min at the bottom. The margin grows by 16px when any is set. Not drawn on a hidden axis. Styled by the theme's .pcac-axis-sub-label rule. On a zoomable axis each one stays with the value at its spot on the unzoomed axis; zoomed out of view, the nearest on each side is pinned to that end, dimmed, with an arrow toward its value (.pcac-axis-sub-label-out-of-view).
  • subLabelColor — any CSS color for all of the subLabels, in place of the theme's $gray-600. Applied as --pcac-axis-sub-label-color on the axis group.
  • format — a PcacFormatEnum: how this axis's values are shown in its tick labels and in the default tooltip, and on the line/area/plot charts' x axis also how a point's key maps to an x position. What each value does is chart-specific; see the rows below. Default None. Ignored by a category axis.
  • domainMin / domainMax — the axis's domain, independent of the data. Defaults 0 and 100. Which axes read them is chart-specific (see the rows below): a bar chart's value axis reads only domainMax, and the line/area/plot charts' x axis reads them only under the Decimal and DateTime formats.
value axisOn a dot plot, xAxis is the value axis. Set domainMin and domainMax to fix its range. Without them, the axis covers the data, rounded out to even tick values. format controls how its ticks and the tooltip's value are shown, and every label, sub label, tick, and grid setting works as usual. There is no y axis, because a column's height is a count of marks, not a value. yAxis is ignored.
binWidthGroups values into bins of this width, in the axis's units, and stacks each bin at its center. Bins start at xAxis.domainMin, or at 0 if that isn't set. When binWidth isn't set, only equal values stack.
dotRadiusThe radius of each dot, in pixels. Default 6. A hovered dot grows by 2 pixels and fills with its series' color.
gapThe space between stacked marks, in pixels. Default 2.
pointImageThe largest size (maxWidth / maxHeight) for points that have an image. The image is drawn in place of the dot, the same as on the plot chart. If the tallest column won't fit in the chart's height, every mark shrinks by the same amount until it does, so nothing gets cut off. markFit reports how much they shrank (see Showing the drawn size).
colorOverrideColors to use for the series, in order, in place of the theme palette. Any CSS color works. If there are more series than colors, the colors repeat.

Events

BindingDescriptionPayload
(dotClicked)="onClicked($event)"Emitted when a dot or image is clicked, or when it has focus and the user presses Enter or Space. It sends a copy of the item. Give the item an id so you can match it back to your own record (see Data Contract).PcacData
(markFit)="onMarkFit($event)"Emitted after a redraw changes how much the marks were scaled to fit the chart's height. 1 means full size. Below 1 means a column was too tall, so every mark was shrunk to fit. Marks are drawn at pointImage.maxWidth * fit by maxHeight * fit, or with a radius of dotRadius * fit (see Showing the drawn size).number