Pitch Class Histogram
pc-histogramVisualizersTwelve bars: how much each pitch class sounded.
$ pnpm dlx shadcn@latest add @pluginui/core-pc-histogramInstall
Copies the source into your project. Anything it depends on comes with it. Run this in your React project with shadcn initialized; no registry configuration is needed.
Pulls in
Install using the registry URL
$ pnpm dlx shadcn@latest add https://pluginui.com/r/core-pc-histogram.jsonUsage
Connect the documented props to your application or host.
import { PcHistogram } from "@/components/ui/pc-histogram"
<PcHistogram
weights={[1, 0, 0.55, 0, 0.8, 0.6, 0, 0.9, 0, 0.55, 0, 0.45]}
activePcs={[0, 4, 7]}
rootPc={0}
/>About Pitch Class Histogram
This plain view of the circle-of-fifths wheel's data earns its place by making comparisons easier. On a wheel, the eye struggles to compare lengths at twelve different angles; twelve bars on a common baseline are easier to read. Use the wheel to see the key and this view to read the numbers. Peak normalisation makes the tallest bar fill the plot whatever the units. A pitch class that never sounded keeps a visible stub, because silent and absent should not look identical. The root marker and live-chord highlight turn the summary into a readout: the bars show the harmony so far, and the highlight shows the harmony now.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| weights | number[] | — | Length-12 pitch-class weights in CHROMATIC order (0 = C … 11 = B). Peak-normalised internally; units are arbitrary. |
| activePcs | number[] | — | Pitch classes to highlight, typically the chord sounding now. Values are reduced mod 12. |
| rootPc | number | — | Marks this pitch class as the root/tonic with a tick beneath its bar. |
| height | number | 96 | Height of the bars in pixels, excluding the labels beneath them. |
| showLabels | boolean | true | Draw the note name under each bar. |
| width | number | string | "100%" | Overall width. Defaults to filling the container. |
| color | string | — | Bar colour. Defaults to the --uikit-accent token. |
Interaction
- Drag with pointer capture, so the gesture keeps tracking past the edge of the control.
- Shift while dragging for a fine pass; release it mid-gesture and coarse tracking resumes.
- Double-click resets to
defaultValue. - Arrow keys step normally, Shift+arrow steps finely, PageUp/PageDown jump by ten, Home/End go to the extremes.
- Proper
sliderandswitchroles with livearia-valuetext, so a screen reader announces the formatted value rather than the raw number. - The scroll wheel adjusts the value while the pointer is over the control; stepped ranges move at least one declared step per notch by default.