Dual Axis Guard

Dual Axis Guard is a copy-paste React component that stops dual-axis chart faked a correlation before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/dual-axis-guard
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsDual-axis chart faked a correlation

Was this component page useful?

How do I install Dual Axis Guard?

pnpm dlx shadcn@latest add @bollard/dual-axis-guard

The files land in your project. They're yours to edit.

How do I use Dual Axis Guard in React?

dual-axis-guard-usage.tsx
import { DualAxisGuard } from "@/components/ui/dual-axis-guard"

<DualAxisGuard
  label="Ad spend vs sign-ups"
  labels={months}
  left={{ label: "Ad spend", values: [4.0, 4.1, 4.2, 4.35, 4.45, 4.6], format: lakh }}
  right={{ label: "Sign-ups", values: [1000, 1180, 1460, 1720, 2050, 2400] }}
  height={130}
/>

What input mistakes does Dual Axis Guard catch?

  • Zero baselines at different heights on the two axes
  • Independent ranges that make different growth rates look identical
  • Each series' real change, stated in the summary

What props does Dual Axis Guard accept?

DualAxisGuard props
PropTypeDefault
label* (required)

Accessible name of the chart, shown as its caption.

string—
labels* (required)

X-axis labels, one per value.

string[]—
left* (required)

The series on the left axis.

DualAxisSeries—
right* (required)

The series on the right axis.

DualAxisSeries—
value

Controlled view.

DualAxisMode—
defaultValue

Initial view when uncontrolled.

DualAxisMode"dual"
onValueChange

Called when the view switches between dual-axis and indexed.

(mode: DualAxisMode) => void—
indexAt

Which point becomes 100 when indexed, and where change is measured from.

number0
locale

Locale for the default number and percent formats.

string"en"
height

Plot height in px.

number160
children

Draw with your own chart library instead of the built-in SVG; the warnings still apply.

(view: DualAxisView) => React.ReactNode—
messages

Override any visible string.

Partial<DualAxisGuardMessages>—

* required. Also accepts the native props of <figure> (className, aria-*, data-*…), passed through to it.

How is Dual Axis Guard accessible?

  • A text summary of each series' change, linked to the chart
  • The scrubber is a role="slider" with arrow and Page Up/Down keys
  • Legend swatches are aria-hidden; series are named in text

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Indexing to 100 needs a positive value at the index point
  • It flags misleading scales, not whether the series are actually related

What expensive mistakes does Dual Axis Guard stop?

Dual-axis chart faked a correlation

Also known as

dual axis · chart · recharts · y axis · dashboard · analytics · line chart · data viz

Field type

What dependencies does Dual Axis Guard require?

Dual Axis Guard facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameDual Axis Guard
Registry identifier@bollard/dual-axis-guard
Install commandnpx shadcn@latest add @bollard/dual-axis-guard
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Dual Axis Guard

What form validation mistake does Dual Axis Guard catch?

Dual Axis Guard prevents dual-axis chart faked a correlation. Shows how much each series in a dual-axis chart really changed and offers to index both to 100, so the chart doesn't imply a correlation that isn't there. Catches: Zero baselines at different heights on the two axes, Independent ranges that make different growth rates look identical, Each series' real change, stated in the summary. Limitation: validate dual-axis-guard schemas on backend.

How do I install dual-axis-guard with shadcn?

Run `npx shadcn@latest add @bollard/dual-axis-guard`. Sources added: registry/default/dual-axis-guard/dual-axis-guard.tsx. Package requirements: lucide-react.

What props customize Dual Axis Guard?

Dual Axis Guard accepts `label`, `labels`, `left`, `right`, `value`. Configures dual axis, chart, recharts behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of dual-axis-guard?

Indexing to 100 needs a positive value at the index point. It flags misleading scales, not whether the series are actually related Server requirement: backend verification for dual-axis-guard.

How does Dual Axis Guard meet accessibility guidelines?

A text summary of each series' change, linked to the chart. The scrubber is a role="slider" with arrow and Page Up/Down keys. Legend swatches are aria-hidden; series are named in text. Minimizes errors: misleading dual axis chart, two y axes chart.

Which components pair with Dual Axis Guard?