Skip to content

Commit 30860b3

Browse files
committed
Add stories
1 parent e7247a1 commit 30860b3

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import {
2+
chartDecorator,
3+
sharedChartArgTypes,
4+
ChartStoryArgs,
5+
ordersByCountry,
6+
themeArgTypes,
7+
} from '../../../stories';
8+
import GeoChart from '../geo-chart';
9+
import type { Meta, StoryObj } from '@storybook/react';
10+
11+
type StoryArgs = ChartStoryArgs< React.ComponentProps< typeof GeoChart > >;
12+
13+
const meta: Meta< StoryArgs > = {
14+
title: 'JS Packages/Charts/Types/Geo Chart',
15+
component: GeoChart,
16+
parameters: {
17+
layout: 'centered',
18+
},
19+
tags: [ 'autodocs' ],
20+
argTypes: {
21+
data: {
22+
control: 'object',
23+
description: 'Record mapping country ISO codes to numeric values',
24+
table: {
25+
type: { summary: 'Record<string, number>' },
26+
},
27+
},
28+
width: {
29+
control: { type: 'number', min: 400, max: 1200, step: 50 },
30+
description: 'Width of the chart in pixels',
31+
table: {
32+
type: { summary: 'number' },
33+
defaultValue: { summary: '800' },
34+
},
35+
},
36+
height: {
37+
control: { type: 'number', min: 300, max: 800, step: 50 },
38+
description: 'Height of the chart in pixels',
39+
table: {
40+
type: { summary: 'number' },
41+
defaultValue: { summary: '500' },
42+
},
43+
},
44+
className: {
45+
control: 'text',
46+
description: 'Additional CSS class name',
47+
table: {
48+
type: { summary: 'string' },
49+
},
50+
},
51+
...sharedChartArgTypes,
52+
...themeArgTypes,
53+
},
54+
decorators: [ chartDecorator ],
55+
};
56+
57+
export default meta;
58+
type Story = StoryObj< StoryArgs >;
59+
60+
export const Default: Story = {
61+
args: {
62+
data: ordersByCountry,
63+
width: 800,
64+
height: 500,
65+
},
66+
};
67+
68+
export const SmallSize: Story = {
69+
args: {
70+
data: ordersByCountry,
71+
width: 600,
72+
height: 400,
73+
},
74+
};
75+
76+
export const SingleCountry: Story = {
77+
args: {
78+
data: {
79+
USA: 1500,
80+
},
81+
width: 800,
82+
height: 500,
83+
},
84+
};
85+
86+
export const EmptyData: Story = {
87+
args: {
88+
data: {},
89+
width: 800,
90+
height: 500,
91+
},
92+
};

projects/js-packages/charts/src/stories/sample-data/index.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,3 +929,27 @@ export const customerRevenueLegendData = [
929929
comparison: '133%',
930930
},
931931
];
932+
933+
/**
934+
* Orders by country data
935+
*
936+
* Orders by country data for geo chart visualization
937+
* - Category: categorical
938+
* - Data points: 12
939+
* - Suitable for: GeoChart
940+
*/
941+
export const ordersByCountry: Record< string, number > = {
942+
USA: 1000,
943+
CAN: 500,
944+
GBR: 450,
945+
DEU: 400,
946+
AUS: 350,
947+
FRA: 300,
948+
MEX: 250,
949+
JPN: 200,
950+
BRA: 150,
951+
IND: 120,
952+
ITA: 100,
953+
ESP: 80,
954+
NLD: 60,
955+
};

0 commit comments

Comments
 (0)