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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | 1x 1x 1x 1x 1x 1x 1x | import React from 'react';
import { Meta, Story } from '@storybook/react';
import * as chartConstants from '../../constants/charts';
import AxisLabel, { IAxisLabelProps } from './AxisLabel';
export default {
title: 'Visualizations/AxisLabel',
component: AxisLabel,
parameters: {
docs: {
description: {
component: AxisLabel.peek.description,
},
},
},
} as Meta;
/* Basic */
export const Basic: Story<IAxisLabelProps> = (args) => {
const width = 800;
const height = 400;
const margin = { top: 50, right: 50, bottom: 50, left: 50 };
const innerWidth = width - margin.right - margin.left;
const innerHeight = height - margin.top - margin.bottom;
return (
<svg width={width} height={height}>
{/* dotted outline for the svg */}
<rect
x={1}
y={1}
width={width - 2}
height={height - 2}
style={{
strokeWidth: 1,
strokeDasharray: '2,2',
fill: 'none',
stroke: 'black',
}}
/>
{/* show the inner part of the chart */}
<g transform={`translate(${margin.left}, ${margin.top})`}>
<rect
style={{
fill: 'lightgrey',
}}
width={innerWidth}
height={innerHeight}
/>
</g>
<g transform={'translate(0,0)'}>
<AxisLabel
{...args}
orient='left'
width={margin.left}
height={height}
label='Left'
/>
</g>
<g transform={`translate(${margin.left + innerWidth}, 0)`}>
<AxisLabel
{...args}
orient='right'
color={chartConstants.COLOR_0}
width={margin.right}
height={height}
label='Right'
/>
</g>
<g transform={`translate(0, ${margin.top + innerHeight})`}>
<AxisLabel
{...args}
orient='bottom'
color={chartConstants.COLOR_1}
width={width}
height={margin.bottom}
label='Bottom'
/>
</g>
<g transform={'translate(0, 0)'}>
<AxisLabel
{...args}
orient='top'
color={chartConstants.COLOR_2}
width={width}
height={margin.top}
label='Top'
/>
</g>
</svg>
);
};
|