收入图表卡

与前一年相比的一年的月收入:当前年份作为软区域和实线,去年作为其后面的虚线,因此它们之间的差距就是故事。标题用增量标签计算总数,悬停一个月会将其交换为该月的数字和一年前的数字。与统计卡和专业图表卡具有相同的框架,因此它可以放入任何仪表盘行中。免费,基于 Recharts。

Revenue

$152,314

+16%

$131,304 last year

This year
Last year

安装

使用 CLI 添加收入图表,该 CLI 还会安装 Recharts 及其组成的标签,或复制文件:

已支持深色模式,此 组件 会自动使用 BoardUI 的语义设计变量。 设置主题切换.

CLI 将组件源(及其内部依赖项)复制到您的项目中并安装任何所需的 npm 包。

npx boardui@latest add revenue-chart-card

使用共享 UI 包或自定义导入别名? 配置您的安装路径 在运行 CLI 之前。复制粘贴示例使用默认导入。

你自己的号码

通行证 data 作为十二点 current 和一个 上一个 值。总计、增量和悬停读数均已导出,因此无需其他任何内容来保持同步。 标题 设置静止标题标签。

import { RevenueChartCard, type RevenuePoint,} from "@/components/application/dashboard/revenue-chart-card"; // Twelve points, one per month. `current` is this year, `previous` the same// month a year earlier; the headline and the delta are computed from them.const revenue: RevenuePoint[] = [ { label: "Jan", current: 9840, previous: 8210 }, { label: "Feb", current: 10120, previous: 8460 }, // ... { label: "Dec", current: 14703, previous: 11924 },]; <RevenueChartCard data={revenue} title="Net revenue" />

连续

该卡是 flex-1 默认高度为 344 像素,因此它与订单图表卡或任何其他卡共享一行,如聊天启动器的仪表盘上一样。

{/* Fills a dashboard row beside another card; the default height is 344px */}<div className="flex flex-col gap-4 xl:flex-row"> <RevenueChartCard /> <OrdersChartCard /></div>