Skip to content

Commit 25ca86c

Browse files
Copilothotlong
andcommitted
Clarify documentation for two different chart APIs
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent e357d95 commit 25ca86c

File tree

1 file changed

+43
-7
lines changed

1 file changed

+43
-7
lines changed

docs/plugins/plugin-charts.mdx

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ npm install @object-ui/plugin-charts
3030
height: 300,
3131
color: "#8884d8"
3232
}}
33-
title="Bar Chart"
34-
description="Display data as vertical bars"
33+
title="Simple Bar Chart"
34+
description="Simple bar chart with basic API - type: 'bar-chart'"
3535
/>
3636

3737
<InteractiveDemo
@@ -56,8 +56,8 @@ npm install @object-ui/plugin-charts
5656
expenses: { label: "Expenses", color: "#82ca9d" }
5757
}
5858
}}
59-
title="Multi-Line Chart"
60-
description="Compare multiple metrics over time"
59+
title="Advanced Line Chart"
60+
description="Advanced chart with multiple series - type: 'chart', chartType: 'line'"
6161
/>
6262

6363
<InteractiveDemo
@@ -86,6 +86,11 @@ npm install @object-ui/plugin-charts
8686

8787
## Usage
8888

89+
The plugin provides two chart APIs:
90+
91+
1. **Simple Bar Chart** (`bar-chart`) - Simplified API for basic bar charts
92+
2. **Advanced Charts** (`chart`) - Full-featured API supporting multiple chart types (bar, line, area) and multiple data series
93+
8994
### Basic Usage
9095

9196
```tsx
@@ -140,7 +145,11 @@ const schema = {
140145

141146
## Chart Types
142147

143-
### Bar Chart
148+
The plugin provides two different chart components:
149+
150+
### Simple Bar Chart (bar-chart)
151+
152+
For basic single-series bar charts, use the simplified `bar-chart` type:
144153

145154
```tsx
146155
const schema = {
@@ -157,7 +166,34 @@ const schema = {
157166
}
158167
```
159168

160-
### Line Chart
169+
### Advanced Charts (chart)
170+
171+
For multi-series charts or line/area charts, use the advanced `chart` type with the `chartType` property:
172+
173+
##### Bar Chart
174+
175+
```tsx
176+
const schema = {
177+
type: 'chart',
178+
chartType: 'bar',
179+
data: [
180+
{ month: 'Jan', sales: 400, target: 350 },
181+
{ month: 'Feb', sales: 300, target: 400 },
182+
{ month: 'Mar', sales: 600, target: 550 }
183+
],
184+
xAxisKey: 'month',
185+
series: [
186+
{ dataKey: 'sales' },
187+
{ dataKey: 'target' }
188+
],
189+
config: {
190+
sales: { label: 'Sales', color: '#3b82f6' },
191+
target: { label: 'Target', color: '#10b981' }
192+
}
193+
}
194+
```
195+
196+
##### Line Chart
161197

162198
```tsx
163199
const schema = {
@@ -178,7 +214,7 @@ const schema = {
178214
}
179215
```
180216

181-
### Area Chart
217+
#### Area Chart
182218

183219
```tsx
184220
const schema = {

0 commit comments

Comments
 (0)