Component guideEditable source

Revenue vs target

Compare weekly revenue with a plan, inspect variance, and read the exact values.

On this page4 sectionsBack to top

Use the period selector to compare the last four or all eight sample weeks. Bars show revenue and the dashed line shows the target. The totals, achievement rate, and table use the same selected weeks.

Live preview
Loading preview...

#Installation

Complete the base setup, then install this recipe with the CLI tab below. It works in React 19 projects using Next.js or Vite and Tailwind CSS v4.

npx shadcn@latest add https://neobrutal-ui.andongmin.com/r/chart-revenue-target.json

#Usage

import ChartRevenueTarget from "@/components/ui/chart-revenue-target";

export default function Example() {
  return <ChartRevenueTarget />;
}

#API reference

The default export is an editable recipe with no required props. It includes illustrative data, not a live data connection. Edit the following constants in the installed source to adapt it.

Source settingMeaning
weeksOrdered rows containing week, revenue, and target. Amounts are USD.
rangeInitial period: "4" for the last four weeks or "8" for all weeks.
moneyCurrency formatter shared by summaries, tooltip, and table.
configSeries labels and shared theme colors.

Keep weekly targets positive when adapting this sample. Achievement is total revenue divided by total target; it is not the average of weekly percentages. Variance is revenue minus target.

#Accessibility

The selector has a visible label and supports keyboard input. The chart enables Recharts keyboard navigation. Calculated summaries remain visible without hovering, and the expandable data table provides the exact values behind the plot. Preserve these alternatives when adapting the recipe. The plot does not animate and inherits the consuming project's light and dark theme tokens.