diff --git a/package-lock.json b/package-lock.json index 0a8a3f6..b0be21d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7519,6 +7519,11 @@ "type": "^1.0.1" } }, + "d3": { + "version": "3.5.17", + "resolved": "https://registry.npmjs.org/d3/-/d3-3.5.17.tgz", + "integrity": "sha1-vEZ0gAQ3iyGjYMn8fPUjF5B2L7g=" + }, "damerau-levenshtein": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.5.tgz", @@ -15819,6 +15824,11 @@ "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, + "nvd3": { + "version": "1.8.6", + "resolved": "https://registry.npmjs.org/nvd3/-/nvd3-1.8.6.tgz", + "integrity": "sha1-LT66dL8zNjtRAevx0JPFmlOuc8Q=" + }, "nwmatcher": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.4.tgz", @@ -18610,6 +18620,15 @@ "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==", "dev": true }, + "react-nvd3": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/react-nvd3/-/react-nvd3-0.5.7.tgz", + "integrity": "sha1-Bul8pada/L9qx/VHUhf0HBsHYqc=", + "requires": { + "d3": "^3.5.16", + "nvd3": "^1.8.2" + } + }, "react-popper": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/react-popper/-/react-popper-1.3.4.tgz", diff --git a/package.json b/package.json index 490d966..ccf5fbd 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "moment": "^2.24.0", "react": "^16.11.0", "react-dom": "^16.11.0", + "react-nvd3": "^0.5.7", "react-pure-lifecycle": "^3.0.0", "react-redux": "^7.1.1", "react-scripts": "3.2.0", diff --git a/src/l2_molecules/chart/bar_chart.js b/src/l2_molecules/chart/bar_chart.js new file mode 100644 index 0000000..be15e25 --- /dev/null +++ b/src/l2_molecules/chart/bar_chart.js @@ -0,0 +1,66 @@ +import React from 'react' +import PropTypes from 'prop-types' +import styled from 'styled-components' +import NVD3Chart from 'react-nvd3' + +const datum = [{ + key: 'Cumulative Return', + values: [ + { + 'label' : 'A' , + 'value' : -29.765957771107 + } , + { + 'label' : 'B' , + 'value' : 0 + } , + { + 'label' : 'C' , + 'value' : 32.807804682612 + } , + { + 'label' : 'D' , + 'value' : 196.45946739256 + } , + { + 'label' : 'E' , + 'value' : 0.19434030906893 + } , + { + 'label' : 'F' , + 'value' : -98.079782601442 + } , + { + 'label' : 'G' , + 'value' : -13.925743130903 + } , + { + 'label' : 'H' , + 'value' : -5.1387322875705 + } + ] +} +] + +export const BarChartPure = ({id, className, ...props}) => +
+ +
+ +BarChartPure.propTypes = { + className: PropTypes.string, + id: PropTypes.string +} + +const BarChart = styled(BarChartPure)` + display: flex; + justify-content: center; +` + +export default BarChart diff --git a/src/l2_molecules/chart/chart.stories.js b/src/l2_molecules/chart/chart.stories.js new file mode 100644 index 0000000..f34af11 --- /dev/null +++ b/src/l2_molecules/chart/chart.stories.js @@ -0,0 +1,21 @@ +import React from 'react' +import {storiesOf} from '@storybook/react' +import {action} from '@storybook/addon-actions' +import Frame from '~/l1_atoms/frame' +import BarChart from './bar_chart' + +storiesOf('l2_molecules', module) + .add('チャート部品', () => + +

バーチャートのサンプル

+ + + , { + info: { + inline: true, + header: false, + text: ` + 横幅は上位の DIV で設定して利用する。 + ` + } + })