Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
564906d
Charts: Consolidate Line Chart tooltip stories with interactive controls
annacmc Oct 7, 2025
ba97f0e
Charts: Consolidate Line Chart annotation stories with interactive co…
annacmc Oct 7, 2025
816a4b9
Charts: Consolidate Line Chart glyph stories with interactive controls
annacmc Oct 7, 2025
15f9563
Charts: Consolidate Line Chart legend stories with interactive controls
annacmc Oct 7, 2025
9263be9
Charts: Consolidate Pie Chart legend stories with interactive controls
annacmc Oct 7, 2025
dc2b349
Charts: Add orientation and grid controls to Bar Chart Default story
annacmc Oct 7, 2025
4577f52
changelog
annacmc Oct 7, 2025
3d9d5ee
Fix prettier formatting errors in chart stories
annacmc Oct 8, 2025
84aa7bc
Fix glyph size calculation and coordinate validation logic
annacmc Oct 8, 2025
5482254
Extract shared glyph renderers to line chart config
annacmc Oct 8, 2025
f886aab
Refactor glyph stories to use shared renderers and remove duplication
annacmc Oct 8, 2025
7ab0f59
Remove duplicate legend argTypes from story definitions
annacmc Oct 8, 2025
fb3e24d
Move bar chart argTypes to meta level and simplify Default story
annacmc Oct 8, 2025
7029893
Rename playground stories back to Configuration naming convention
annacmc Oct 8, 2025
dcae1da
Consolidate stories using interactive controls
annacmc Oct 8, 2025
390a48f
Revert glyph size changes - d3 symbols use area not radius
annacmc Oct 9, 2025
21e1688
Add Dimensions category to shared chart argTypes
annacmc Oct 9, 2025
94dfec6
Create tooltipArgTypes configuration for Tooltips category
annacmc Oct 9, 2025
ac26b54
Add Visual Style and Labels categories to pie chart controls
annacmc Oct 9, 2025
51f27df
Consolidate donut chart stories to Configuration and CustomLegend
annacmc Oct 9, 2025
2716efc
Add Data and Visual Style categories to line chart controls
annacmc Oct 9, 2025
566f35a
Add Glyphs category to line chart glyph controls
annacmc Oct 9, 2025
d6eb6e4
Add Data and Visual Style categories to bar chart controls
annacmc Oct 9, 2025
eb7bf6d
Add Configuration story and Data category to bar list chart
annacmc Oct 9, 2025
e900649
Add Configuration story with Data and Labels categories to leaderboar…
annacmc Oct 9, 2025
aa72334
Fix donut docs to reference consolidated Configuration story
annacmc Oct 9, 2025
7d69934
Update docs to reference consolidated Configuration stories
annacmc Oct 13, 2025
6f9cfb8
Replace bar chart Configuration story references with inline MDX exam…
annacmc Oct 13, 2025
5eff3c0
Replace line chart Configuration story references with inline MDX exa…
annacmc Oct 13, 2025
92fdbb1
Replace pie chart LegendConfiguration story reference with inline MDX…
annacmc Oct 13, 2025
0638051
Fix Configuration story controls: differentiate multiple vs many seri…
annacmc Oct 13, 2025
c35c325
Hide dataVariant control from non-Configuration leaderboard stories
annacmc Oct 13, 2025
2789ff6
Hide seriesCount and dimensionMode controls from non-Configuration li…
annacmc Oct 13, 2025
5393894
Hide visual controls from pie chart stories that don't use args
annacmc Oct 13, 2025
16dcb16
Fix bar chart gridVisibility 'both' option and increase 'many' series…
annacmc Oct 13, 2025
69a41fd
Allow legendValueDisplay control in pie chart CompositionAPI story
annacmc Oct 13, 2025
84f0aec
Fix bar chart docs: add exported stories for Horizontal, Many Series,…
annacmc Oct 13, 2025
7cb06ee
Hide Configuration controls from bar chart stories and fix Basic Lege…
annacmc Oct 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Charts: group storybook controls
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Meta, Canvas, Story, Source } from '@storybook/addon-docs/blocks';
import * as BarChartStories from './index.stories';
import BarChart from '../bar-chart';
import { medalCountsData } from '../../../stories/sample-data';

<Meta title="JS Packages/Charts/Types/Bar Chart" of={ BarChartStories } />

Expand Down Expand Up @@ -35,7 +37,15 @@ For detailed information about component props, types, and method signatures, se

The simplest bar chart requires only a `data` prop with categorical data:

<Canvas of={ BarChartStories.SingleSeries } />
<Canvas>
<Story name="Simple Single Series">
{() => (
<div style={{ maxWidth: '1200px', aspectRatio: '2/1' }}>
<BarChart data={[medalCountsData[0]]} />
</div>
)}
</Story>
</Canvas>

<Source
language="jsx"
Expand Down Expand Up @@ -91,7 +101,7 @@ Standard vertical bar charts with categories on the x-axis and values on the y-a

Horizontal bar charts with categories on the y-axis and values on the x-axis, ideal for long category names:

<Canvas of={ BarChartStories.HorizontalBarChart } />
<Canvas of={ BarChartStories.HorizontalOrientation } />

<Source
language="jsx"
Expand Down Expand Up @@ -137,7 +147,7 @@ Display multiple data series with automatic color differentiation and grouped ba

The component handles large numbers of series gracefully with automatic color cycling:

<Canvas of={ BarChartStories.ManyDataSeries } />
<Canvas of={ BarChartStories.ManySeriesWithLegend } />

<Source
language="jsx"
Expand Down Expand Up @@ -173,9 +183,7 @@ Add visual accessibility and distinction with pattern fills instead of solid col

### Smart Formatting

Automatic formatting handles large numbers with appropriate abbreviations:

<Canvas of={ BarChartStories.SmartFormatting } />
Automatic formatting handles large numbers with appropriate abbreviations (see examples in the stories above).

Values are automatically formatted as:
- **1B and above**: "1.23B"
Expand All @@ -189,7 +197,41 @@ Values are automatically formatted as:

Bar charts support both categorical labels and time-series data:

<Canvas of={ BarChartStories.TimeSeries } />
<Canvas>
<Story name="Time Series Data">
{() => (
<div style={{ maxWidth: '1200px', aspectRatio: '2/1' }}>
<BarChart
data={[
{
label: 'Page Views',
data: [
{ date: new Date('2024-01-01'), value: 2230 },
{ date: new Date('2024-02-01'), value: 2580 },
{ date: new Date('2024-03-01'), value: 3500 },
{ date: new Date('2024-04-01'), value: 3200 },
{ date: new Date('2024-05-01'), value: 4100 },
],
options: {},
},
]}
withTooltips={true}
gridVisibility="x"
options={{
axis: {
x: {
tickFormat: (timestamp) => {
const date = new Date(timestamp);
return date.toLocaleDateString('en-US', { month: 'short' });
},
},
},
}}
/>
</div>
)}
</Story>
</Canvas>

<Source
language="jsx"
Expand Down Expand Up @@ -279,7 +321,7 @@ By default, bars with zero values have no visual height, making them difficult t

Display series information with automatic color and pattern matching:

<Canvas of={ BarChartStories.WithLegend } />
<Canvas of={ BarChartStories.LegendHorizontalBottom } />

<Source
language="jsx"
Expand All @@ -297,7 +339,7 @@ Display series information with automatic color and pattern matching:

Display legends vertically for charts with many series:

<Canvas of={ BarChartStories.CustomLegendPositioning } />
<Canvas of={ BarChartStories.LegendVerticalTop } />

<Source
language="jsx"
Expand Down Expand Up @@ -380,7 +422,19 @@ Control grid line visibility and appearance:

Charts automatically resize based on container size:

<Canvas of={ BarChartStories.FixedDimensions } />
<Canvas>
<Story name="Responsive Behavior">
{() => (
<div style={{ width: '100%' }}>
<BarChart
data={[medalCountsData[0], medalCountsData[1], medalCountsData[2]]}
withTooltips={true}
gridVisibility="x"
/>
</div>
)}
</Story>
</Canvas>

<Source
language="jsx"
Expand Down
Loading
Loading