All files / laravel-saas/resources/js/Components/ui Chart.stories.tsx

0% Statements 0/70
100% Branches 1/1
100% Functions 1/1
0% Lines 0/70

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81                                                                                                                                                                 
import type { Meta, StoryObj } from '@storybook/react';
import { Chart } from './Chart';
 
const meta = {
  title: 'UI/Chart',
  component: Chart,
  parameters: {
    layout: 'padded',
  },
  tags: ['autodocs'],
} satisfies Meta<typeof Chart>;
 
export default meta;
type Story = StoryObj<typeof meta>;
 
const sampleData = [
  { name: 'Jan', value: 400, users: 240, revenue: 2400 },
  { name: 'Feb', value: 300, users: 139, revenue: 2210 },
  { name: 'Mar', value: 200, users: 980, revenue: 2290 },
  { name: 'Apr', value: 278, users: 390, revenue: 2000 },
  { name: 'May', value: 189, users: 480, revenue: 2181 },
  { name: 'Jun', value: 239, users: 380, revenue: 2500 },
];
 
export const LineChart: Story = {
  args: {
    type: 'line',
    data: sampleData,
    dataKey: 'value',
    height: 300,
  },
};
 
export const BarChart: Story = {
  args: {
    type: 'bar',
    data: sampleData,
    dataKey: 'users',
    height: 300,
  },
};
 
export const AreaChart: Story = {
  args: {
    type: 'area',
    data: sampleData,
    dataKey: 'revenue',
    height: 300,
  },
};
 
export const CustomColors: Story = {
  args: {
    type: 'line',
    data: sampleData,
    dataKey: 'value',
    stroke: '#8884d8',
    height: 300,
  },
};
 
export const LargeChart: Story = {
  args: {
    type: 'area',
    data: sampleData,
    dataKey: 'revenue',
    height: 400,
    fill: '#82ca9d',
    stroke: '#82ca9d',
  },
};
 
export const SmallChart: Story = {
  args: {
    type: 'bar',
    data: sampleData.slice(0, 4),
    dataKey: 'users',
    height: 200,
    fill: '#ffc658',
  },
};