Area Chart With Custom Events

Preview

Loading…

Installation

CLI
npx @sonojs/ui@latest add area-chart-with-custom-events
Also needsnpx @sonojs/ui@latest add chart chart-mock-data chart-styles && npm i recharts

Usage

import
import AreaChartWithCustomEventsDemo from "@/components/charts/area-chart-with-custom-events"
page.tsx
export default function Page() {
  return <AreaChartWithCustomEventsDemo />
}

Scrub

scrub highlights the active category and dims the rest (default true). Pass false to keep the idle last-category view.

scrub
import { AreaChartWithCustomEvents } from "@/components/charts/area-chart-with-custom-events"

export default function Page() {
  return <AreaChartWithCustomEvents scrub={false} />
}

Plot direction

plotDir only flips the plot (bars / axes). Header and legend still follow page dir. Omit it to match the page (default).

plotDir
import { AreaChartWithCustomEvents } from "@/components/charts/area-chart-with-custom-events"

export default function Page() {
  return (
    <div dir="rtl">
      {/* Chrome RTL · bars still start on the left */}
      <AreaChartWithCustomEvents plotDir="ltr" />
    </div>
  )
}

Props

PropTypeDefaultDescription
scrubbooleantrueHover, touch, and keyboard scrub — dim inactive categories and update the metric header.
plotDir"ltr" · "rtl"page dirPlot-only layout (bar sides / axes). Header and legend keep following page dir.