@chotot/charts
v1.1.0
Published
Classified Ads group (Chotot) chart design system
Readme
@chotot/charts
React chart components (BarChart, LineChart, PieChart) for the Clad UI v3 Design System, built on Chart.js v4 (react-chartjs-2) and styled with @chotot/clad-ui design tokens.
Installation
pnpm add @chotot/charts @chotot/clad-ui @chotot/iconsSetup
Import the chart stylesheet alongside @chotot/clad-ui/styles.css (or @chotot/clad-ui/preset.css):
import '@chotot/clad-ui/styles.css';
import '@chotot/charts/styles.css';Usage
BarChart & LineChart
import { BarChart, LineChart } from '@chotot/charts';
const labels = ['T1', 'T2', 'T3', 'T4', 'T5', 'T6'];
const datasets = [
{
label: 'Lượt xem tin',
data: [120, 190, 150, 220, 280, 310],
},
];
export function AnalyticsCharts() {
return (
<div className="grid grid-cols-1 gap-lg md:grid-cols-2">
<BarChart title="Lượt xem theo tháng" labels={labels} datasets={datasets} />
<LineChart title="Xu hướng lượt xem" labels={labels} datasets={datasets} />
</div>
);
}PieChart
import { PieChart } from '@chotot/charts';
export function CategoryShareChart() {
return (
<PieChart
title="Tỷ trọng danh mục"
labels={['Bất động sản', 'Xe cộ', 'Đồ điện tử']}
datasets={[
{
data: [45, 35, 20],
},
]}
/>
);
}License
Apache-2.0
