Component

Bar Chart

Vertical bars, one series. Per-bar color overrides via the color field.

Installation

import { WrBarChart } from 'ngwr/bar-chart';

@Component({ imports: [WrBarChart] })
export class MyComponent {
  protected readonly bars = [
    { label: 'Mon', value: 12 },
    { label: 'Tue', value: 18, color: 'var(--wr-color-success)' },
    { label: 'Wed', value: 9 },
    { label: 'Thu', value: 24, color: 'var(--wr-color-warning)' },
    { label: 'Fri', value: 17 },
    { label: 'Sat', value: 6 },
    { label: 'Sun', value: 11 },
  ];
}

Basic

<wr-bar-chart [data]="bars" />

API

Inputs of <wr-bar-chart>.

NameDescriptionTypeDefault
datareadonly WrBarChartDatum[][]
colorDefault bar colour when a datum has none.stringprimary
showValuesShow value labels above each bar.booleantrue
heightPixel height of the chart area.number200
maxExplicit max value. 0 = auto.number0

Types

Data shapes used by the inputs and outputs above.

interface WrBarChartDatum {
  label: string;
  value: number;
  color?: string;
}
NameDescriptionTypeDefault
WrBarChartDatumOne bar of data.interface
labelrequiredCategory label under the bar.string
valuerequiredBar magnitude.number
colorCSS color for the bar.stringpalette