Skip to content

Commit 1623c1e

Browse files
committed
Update docs, template and guidelines
1 parent 9ed5e69 commit 1623c1e

File tree

8 files changed

+67
-25
lines changed

8 files changed

+67
-25
lines changed

projects/js-packages/charts/docs/ai-documentation-guide.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,14 @@ Controls [what this category affects]:
176176

177177
### Theme Integration
178178

179-
Explanation of how feature integrates with chart themes.
179+
For the Theme Integration section, use the standardized format from the `feature-documentation.mdx.template`. This section should:
180+
181+
- Show how to create a custom theme by defining properties to override
182+
- Include a code example with `GlobalChartsProvider`
183+
- List available themes (Default and Custom)
184+
- Include a note explaining that the provider automatically merges properties
185+
186+
See the template for the complete section structure.
180187
```
181188

182189
### 8. Advanced Usage

projects/js-packages/charts/docs/feature-documentation.mdx.template

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,27 @@ Controls [what this affects]:
135135

136136
### Theme Integration
137137

138-
[Explanation of how feature integrates with chart themes and any theme-specific styling].
138+
The [component] integrates with the global charts theming system. Create a custom theme by defining the properties you want to override:
139+
140+
<Source
141+
language="tsx"
142+
code={ `import { GlobalChartsProvider } from '@automattic/charts';
143+
144+
const customTheme = {
145+
colors: ['#FF6B6B', '#4ECDC4', '#45B7D1', '#FFA07A'],
146+
[otherThemeProperties]: [values],
147+
};
148+
149+
<GlobalChartsProvider theme={customTheme}>
150+
<[Component] data={data} />
151+
</GlobalChartsProvider>` }
152+
/>
153+
154+
**Available themes:**
155+
- **Default**: Neutral colors and styling
156+
- **Custom**: Define your own theme object with properties to override
157+
158+
**Note**: The `GlobalChartsProvider` automatically merges custom theme properties with the default theme, so you only need to specify the properties you want to override.
139159

140160
## Custom [Feature Name]
141161

projects/js-packages/charts/src/components/bar-chart/stories/index.docs.mdx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -539,21 +539,24 @@ Full functionality in all modern browsers supporting:
539539

540540
## Theming Integration
541541

542-
Bar Charts integrate seamlessly with the chart theming system:
542+
Bar Charts integrate seamlessly with the chart theming system. Create a custom theme by defining the properties you want to override:
543543

544544
<Source
545545
language="jsx"
546-
code={ `import { GlobalChartsProvider, jetpackTheme } from '@automattic/charts';
546+
code={ `import { GlobalChartsProvider } from '@automattic/charts';
547547
548-
<GlobalChartsProvider theme={jetpackTheme}>
548+
const customTheme = {
549+
colors: ['#FF6B6B', '#4ECDC4', '#45B7D1', '#FFA07A'],
550+
gridColor: '#E0E0E0',
551+
};
552+
553+
<GlobalChartsProvider theme={customTheme}>
549554
<BarChart data={data} />
550555
</GlobalChartsProvider>` }
551556
/>
552557

553558
**Available themes:**
554559
- **Default**: Neutral colors and styling
555-
- **Jetpack**: Jetpack brand colors and styling
556-
- **Woo**: WooCommerce brand colors and styling
557-
- **Custom**: Define your own theme object with custom color schemes
560+
- **Custom**: Define your own theme object with properties to override
558561

559562
The component automatically adapts bar colors, patterns, and styling based on the active theme while maintaining accessibility standards.

projects/js-packages/charts/src/components/leaderboard-chart/stories/index.docs.mdx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -461,22 +461,24 @@ The component supports CSS custom properties for advanced styling:
461461

462462
### Theme Integration
463463

464-
The chart integrates with the global charts theming system:
464+
The chart integrates with the global charts theming system. Create a custom theme by defining the properties you want to override:
465465

466466
<Source
467467
language="tsx"
468-
code={ `import { GlobalChartsProvider, jetpackTheme } from '@automattic/charts';
468+
code={ `import { GlobalChartsProvider } from '@automattic/charts';
469469
470-
<GlobalChartsProvider theme={jetpackTheme}>
470+
const customTheme = {
471+
colors: ['#FF6B6B', '#4ECDC4', '#45B7D1', '#FFA07A'],
472+
};
473+
474+
<GlobalChartsProvider theme={customTheme}>
471475
<LeaderboardChart data={data} />
472476
</GlobalChartsProvider>` }
473477
/>
474478

475479
**Available themes:**
476480
- **Default**: Neutral colors and styling
477-
- **Jetpack**: Jetpack brand colors and styling
478-
- **Woo**: WooCommerce brand colors and styling
479-
- **Custom**: Define your own theme object
481+
- **Custom**: Define your own theme object with properties to override
480482

481483
## Accessibility
482484

projects/js-packages/charts/src/components/line-chart/stories/annotation.docs.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ Annotations inherit styling from your chart theme. You can customize annotation
203203
<Source
204204
language="jsx"
205205
code={ `const customTheme = {
206-
...defaultTheme,
207206
annotationStyles: {
208207
label: {
209208
backgroundFill: '#f0f8ff',

projects/js-packages/charts/src/components/line-chart/stories/index.docs.mdx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -678,19 +678,22 @@ Full functionality in all modern browsers supporting:
678678

679679
## Theming Integration
680680

681-
Line Charts integrate seamlessly with the chart theming system:
681+
Line Charts integrate seamlessly with the chart theming system. Create a custom theme by defining the properties you want to override:
682682

683683
<Source
684684
language="jsx"
685-
code={ `import { GlobalChartsProvider, jetpackTheme } from '@automattic/charts';
685+
code={ `import { GlobalChartsProvider } from '@automattic/charts';
686686
687-
<GlobalChartsProvider theme={jetpackTheme}>
687+
const customTheme = {
688+
colors: ['#FF6B6B', '#4ECDC4', '#45B7D1', '#FFA07A'],
689+
gridColor: '#E0E0E0',
690+
};
691+
692+
<GlobalChartsProvider theme={customTheme}>
688693
<LineChart data={data} />
689694
</GlobalChartsProvider>` }
690695
/>
691696

692697
**Available themes:**
693698
- **Default**: Neutral colors and styling
694-
- **Jetpack**: Jetpack brand colors and styling
695-
- **Woo**: WooCommerce brand colors and styling
696-
- **Custom**: Define your own theme object
699+
- **Custom**: Define your own theme object with properties to override

projects/js-packages/charts/src/components/pie-chart/stories/index.docs.mdx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,22 @@ const customTheme = {
282282

283283
### Theme Integration
284284

285-
Pie Charts automatically integrate with the chart theme system, inheriting colors, typography, and styling from the active theme. Custom themes can be applied using the `GlobalChartsProvider`:
285+
Pie Charts automatically integrate with the chart theme system, inheriting colors, typography, and styling from the active theme. Create a custom theme by defining the properties you want to override:
286286

287287
<Source
288288
language="jsx"
289-
code={ `import { GlobalChartsProvider, jetpackTheme } from '@automattic/charts';
289+
code={ `import { GlobalChartsProvider } from '@automattic/charts';
290+
291+
const customTheme = {
292+
colors: ['#FF6B6B', '#4ECDC4', '#45B7D1', '#FFA07A'],
293+
};
290294
291-
<GlobalChartsProvider theme={ jetpackTheme }>
295+
<GlobalChartsProvider theme={ customTheme }>
292296
<PieChart data={ data } />
293297
</GlobalChartsProvider>` }
294298

295299
/>
300+
301+
**Available themes:**
302+
- **Default**: Neutral colors and styling
303+
- **Custom**: Define your own theme object with properties to override

projects/js-packages/charts/src/stories/index.docs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Great for showing parts of a whole, with customizable thickness and gap spacing.
8484
Charts expect data in a standardized format with `date` (for time-series) or category values and numeric `value` properties.
8585

8686
### Theme System
87-
Use the `GlobalChartsProvider` component to apply consistent styling across all charts with support for custom themes.
87+
Use the `GlobalChartsProvider` component to apply consistent styling across all charts. Create custom themes by defining the properties you want to override, such as colors, grid styling, and typography.
8888

8989
### Responsive Design
9090
All charts automatically adapt to their container size using the `withResponsive` higher-order component.

0 commit comments

Comments
 (0)