tableChart.stories.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import React from 'react';
  2. import {withInfo} from '@storybook/addon-info';
  3. import {number, text, boolean, array} from '@storybook/addon-knobs';
  4. import TableChart from 'app/components/charts/tableChart';
  5. export default {
  6. title: 'Charts/TableChart',
  7. };
  8. export const _TableChart = withInfo(
  9. 'A simple table that can calculate totals and relative share as a bar inside of a row'
  10. )(() => {
  11. const ERROR_TYPE_DATA = [
  12. ['TypeError', 50, 40, 30],
  13. ['SyntaxError', 40, 30, 20],
  14. ['NameError', 15, 15, 15],
  15. ['ZeroDivisionError', 20, 10, 0],
  16. ];
  17. return (
  18. <TableChart
  19. data={ERROR_TYPE_DATA}
  20. dataStartIndex={number('Data Start Index', 1)}
  21. showRowTotal={boolean('Show Row Total', true)}
  22. showColumnTotal={boolean('Show Column Total', true)}
  23. shadeRowPercentage={boolean('Shade Row %', true)}
  24. headers={array('Headers', [
  25. text('Column 1', 'Exception Type'),
  26. text('Column 2', 'Project 1'),
  27. text('Column 3', 'Project 2'),
  28. text('Column 4', 'Project 3'),
  29. ])}
  30. widths={array('Widths', [
  31. number('Column 1', null),
  32. number('Column 2', 100),
  33. number('Column 3', 100),
  34. number('Column 4', 100),
  35. ])}
  36. rowTotalLabel={text('Row Total Label', 'Row Total')}
  37. rowTotalWidth={number('Row Total Column Width', 120)}
  38. />
  39. );
  40. });
  41. _TableChart.story = {
  42. name: 'TableChart',
  43. };