DocumentationCharts

Full Height

Every chart except the pie chart accepts heightFull. Turn it on and height stops being a fixed size and becomes a minimum height value: the chart grows to fill its container whenever that container is taller, and keeps filling it as the container resizes.

Try It

Both charts below use the same config — height: 200 — and the same container. The only difference is heightFull. Drag the slider to resize the containers.

360px

heightFull: false

Stays 200px tall

heightFull: true

Fills the container

Drag below 200px and the two panels converge: there is nothing left to fill, so heightFull falls back to the height minimum. Both charts stay 200px tall and get clipped by the container rather than squashing into it.

Fill A Flex Layout

The container does not have to carry an explicit height — any definite height works, including one handed down by a flex or grid track. That covers the common case: a tile with a header on top and a chart taking whatever is left.

Requests Per Minute

Last 24 hours

<!-- A dashboard tile: the header takes what it needs, the chart takes the rest. -->
<mat-card class="flex flex-col" style="height: 360px">
  <h5>Requests per minute</h5>
  <p>Last 24 hours</p>

  <div class="flex-1 min-h-0">
    <pcac-line-chart [config]="config" />
  </div>
</mat-card>

Markup

<!-- The wrapper owns the height; the chart fills it. -->
<div style="height: 360px">
  <pcac-bar-vertical-chart [config]="config" />
</div>
const config = {
  data: [ ... ],

  // Minimum height. Used as-is whenever the container is shorter than this.
  height: 200,

  // Grow past 'height' to fill the container whenever it is taller.
  heightFull: true
} as PcacBarVerticalChartConfig;

Notes

  • Give the wrapper a definite height. An explicit height, or a flex/grid track that resolves to one. If the wrapper is auto-height there is nothing to fill, and the chart falls back to height.
  • height is a floor, not a target. A container shorter than height leaves the chart at height; it is never drawn smaller than you asked for.
  • Resizing keeps working. Charts already rebuild when their container's width changes; with heightFull on they watch its height too, so collapsing sidebars, tab switches and window resizes all stay filled.
  • The pie chart does not support it. There, height feeds the radius rather than a drawing area, so filling a tall container would silently resize the pie itself. The option is ignored.