@carbon/charts-react 0.58.1 → 0.59.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +4 -0
- package/.prettierignore +1 -0
- package/.storybook/addons.js +2 -0
- package/.storybook/assets/logo.svg +1 -0
- package/.storybook/assets/share.png +0 -0
- package/.storybook/assets/welcome.png +0 -0
- package/.storybook/config.js +22 -0
- package/.storybook/main.js +24 -0
- package/.storybook/manager-head.html +42 -0
- package/.storybook/preview-head.html +10 -0
- package/build.sh +20 -0
- package/carbon.yml +275 -0
- package/carbon__charts-react-tests.tsx +83 -0
- package/demo/bundle/favicon.ico +0 -0
- package/demo/bundle/index.html +22 -0
- package/demo/bundle/logo.svg +1 -0
- package/demo/bundle/main.4a87b5852cddf04c8e9a.bundle.js +1 -0
- package/demo/bundle/runtime~main.6b70b35614cf83eab770.bundle.js +1 -0
- package/demo/bundle/sb_dll/storybook_ui-manifest.json +1 -0
- package/demo/bundle/sb_dll/storybook_ui_dll.LICENCE +113 -0
- package/demo/bundle/sb_dll/storybook_ui_dll.js +2 -0
- package/demo/bundle/share.png +0 -0
- package/demo/bundle/vendors~main.9ceec0efe2f3ef413ade.bundle.js +111 -0
- package/demo/bundle/welcome.png +0 -0
- package/dist/CHANGELOG.md +2150 -0
- package/dist/README.md +56 -0
- package/{alluvial-chart.d.ts → dist/alluvial-chart.d.ts} +0 -0
- package/{alluvial-chart.js → dist/alluvial-chart.js} +0 -0
- package/{area-chart-stacked.d.ts → dist/area-chart-stacked.d.ts} +0 -0
- package/{area-chart-stacked.js → dist/area-chart-stacked.js} +0 -0
- package/{area-chart.d.ts → dist/area-chart.d.ts} +0 -0
- package/{area-chart.js → dist/area-chart.js} +0 -0
- package/{bar-chart-grouped.d.ts → dist/bar-chart-grouped.d.ts} +0 -0
- package/{bar-chart-grouped.js → dist/bar-chart-grouped.js} +0 -0
- package/{bar-chart-simple.d.ts → dist/bar-chart-simple.d.ts} +0 -0
- package/{bar-chart-simple.js → dist/bar-chart-simple.js} +0 -0
- package/{bar-chart-stacked.d.ts → dist/bar-chart-stacked.d.ts} +0 -0
- package/{bar-chart-stacked.js → dist/bar-chart-stacked.js} +0 -0
- package/{base-chart.d.ts → dist/base-chart.d.ts} +0 -0
- package/{base-chart.js → dist/base-chart.js} +0 -0
- package/{boxplot-chart.d.ts → dist/boxplot-chart.d.ts} +0 -0
- package/{boxplot-chart.js → dist/boxplot-chart.js} +0 -0
- package/{bubble-chart.d.ts → dist/bubble-chart.d.ts} +0 -0
- package/{bubble-chart.js → dist/bubble-chart.js} +0 -0
- package/{bullet-chart.d.ts → dist/bullet-chart.d.ts} +0 -0
- package/{bullet-chart.js → dist/bullet-chart.js} +0 -0
- package/{bundle.js → dist/bundle.js} +0 -0
- package/{circle-pack-chart.d.ts → dist/circle-pack-chart.d.ts} +0 -0
- package/{circle-pack-chart.js → dist/circle-pack-chart.js} +0 -0
- package/{combo-chart.d.ts → dist/combo-chart.d.ts} +0 -0
- package/{combo-chart.js → dist/combo-chart.js} +0 -0
- package/{diagrams → dist/diagrams}/CardNode/CardNode.d.ts +0 -0
- package/{diagrams → dist/diagrams}/CardNode/CardNode.js +3 -4
- package/{diagrams → dist/diagrams}/CardNode/CardNodeColumn.d.ts +0 -0
- package/{diagrams → dist/diagrams}/CardNode/CardNodeColumn.js +3 -4
- package/{diagrams → dist/diagrams}/CardNode/CardNodeLabel.d.ts +0 -0
- package/{diagrams → dist/diagrams}/CardNode/CardNodeLabel.js +3 -4
- package/{diagrams → dist/diagrams}/CardNode/CardNodeSubtitle.d.ts +0 -0
- package/{diagrams → dist/diagrams}/CardNode/CardNodeSubtitle.js +3 -4
- package/{diagrams → dist/diagrams}/CardNode/CardNodeTitle.d.ts +0 -0
- package/{diagrams → dist/diagrams}/CardNode/CardNodeTitle.js +3 -4
- package/{diagrams → dist/diagrams}/CardNode/index.d.ts +0 -0
- package/{diagrams → dist/diagrams}/CardNode/index.js +0 -0
- package/{diagrams → dist/diagrams}/Edge/Edge.d.ts +0 -0
- package/{diagrams → dist/diagrams}/Edge/Edge.js +3 -4
- package/{diagrams → dist/diagrams}/Edge/index.d.ts +0 -0
- package/{diagrams → dist/diagrams}/Edge/index.js +0 -0
- package/{diagrams → dist/diagrams}/Marker/Marker.d.ts +0 -0
- package/{diagrams → dist/diagrams}/Marker/Marker.js +3 -4
- package/{diagrams → dist/diagrams}/Marker/index.d.ts +0 -0
- package/{diagrams → dist/diagrams}/Marker/index.js +0 -0
- package/{diagrams → dist/diagrams}/ShapeNode/ShapeNode.d.ts +0 -0
- package/{diagrams → dist/diagrams}/ShapeNode/ShapeNode.js +3 -4
- package/{diagrams → dist/diagrams}/ShapeNode/index.d.ts +0 -0
- package/{diagrams → dist/diagrams}/ShapeNode/index.js +0 -0
- package/dist/diagrams/configs.d.ts +1 -0
- package/dist/diagrams/configs.js +4 -0
- package/{donut-chart.d.ts → dist/donut-chart.d.ts} +0 -0
- package/{donut-chart.js → dist/donut-chart.js} +0 -0
- package/{gauge-chart.d.ts → dist/gauge-chart.d.ts} +0 -0
- package/{gauge-chart.js → dist/gauge-chart.js} +0 -0
- package/{heatmap-chart.d.ts → dist/heatmap-chart.d.ts} +0 -0
- package/{heatmap-chart.js → dist/heatmap-chart.js} +0 -0
- package/{histogram-chart.d.ts → dist/histogram-chart.d.ts} +0 -0
- package/{histogram-chart.js → dist/histogram-chart.js} +0 -0
- package/{index.d.ts → dist/index.d.ts} +0 -0
- package/{index.js → dist/index.js} +0 -0
- package/{line-chart.d.ts → dist/line-chart.d.ts} +0 -0
- package/{line-chart.js → dist/line-chart.js} +0 -0
- package/{lollipop-chart.d.ts → dist/lollipop-chart.d.ts} +0 -0
- package/{lollipop-chart.js → dist/lollipop-chart.js} +0 -0
- package/{meter-chart.d.ts → dist/meter-chart.d.ts} +0 -0
- package/{meter-chart.js → dist/meter-chart.js} +0 -0
- package/dist/package.json +107 -0
- package/{pie-chart.d.ts → dist/pie-chart.d.ts} +0 -0
- package/{pie-chart.js → dist/pie-chart.js} +0 -0
- package/{radar-chart.d.ts → dist/radar-chart.d.ts} +0 -0
- package/{radar-chart.js → dist/radar-chart.js} +0 -0
- package/{scatter-chart.d.ts → dist/scatter-chart.d.ts} +0 -0
- package/{scatter-chart.js → dist/scatter-chart.js} +0 -0
- package/{tree-chart.d.ts → dist/tree-chart.d.ts} +0 -0
- package/{tree-chart.js → dist/tree-chart.js} +0 -0
- package/{treemap-chart.d.ts → dist/treemap-chart.d.ts} +0 -0
- package/{treemap-chart.js → dist/treemap-chart.js} +0 -0
- package/{utils.d.ts → dist/utils.d.ts} +0 -0
- package/{utils.js → dist/utils.js} +0 -0
- package/{wordcloud-chart.d.ts → dist/wordcloud-chart.d.ts} +0 -0
- package/{wordcloud-chart.js → dist/wordcloud-chart.js} +0 -0
- package/helpers/commons.js +30 -0
- package/package.json +106 -106
- package/rollup.config.js +18 -0
- package/src/alluvial-chart.tsx +30 -0
- package/src/area-chart-stacked.tsx +33 -0
- package/src/area-chart.tsx +30 -0
- package/src/bar-chart-grouped.tsx +30 -0
- package/src/bar-chart-simple.tsx +30 -0
- package/src/bar-chart-stacked.tsx +30 -0
- package/src/base-chart.tsx +45 -0
- package/src/boxplot-chart.tsx +30 -0
- package/src/bubble-chart.tsx +30 -0
- package/src/bullet-chart.tsx +30 -0
- package/src/circle-pack-chart.tsx +30 -0
- package/src/combo-chart.tsx +30 -0
- package/src/diagrams/CardNode/CardNode.tsx +121 -0
- package/src/diagrams/CardNode/CardNodeColumn.tsx +38 -0
- package/src/diagrams/CardNode/CardNodeLabel.tsx +32 -0
- package/src/diagrams/CardNode/CardNodeSubtitle.tsx +32 -0
- package/src/diagrams/CardNode/CardNodeTitle.tsx +32 -0
- package/src/diagrams/CardNode/index.tsx +13 -0
- package/src/diagrams/Edge/Edge.tsx +137 -0
- package/src/diagrams/Edge/index.tsx +2 -0
- package/src/diagrams/Marker/Marker.tsx +121 -0
- package/src/diagrams/Marker/index.tsx +9 -0
- package/src/diagrams/ShapeNode/ShapeNode.tsx +153 -0
- package/src/diagrams/ShapeNode/index.tsx +2 -0
- package/src/diagrams/configs.ts +1 -0
- package/src/donut-chart.tsx +30 -0
- package/src/gauge-chart.tsx +30 -0
- package/src/heatmap-chart.tsx +30 -0
- package/src/histogram-chart.tsx +30 -0
- package/src/index.ts +51 -0
- package/src/line-chart.tsx +30 -0
- package/src/lollipop-chart.tsx +30 -0
- package/src/meter-chart.tsx +30 -0
- package/src/pie-chart.tsx +30 -0
- package/src/radar-chart.tsx +30 -0
- package/src/scatter-chart.tsx +30 -0
- package/src/tree-chart.tsx +30 -0
- package/src/treemap-chart.tsx +30 -0
- package/src/utils.ts +7 -0
- package/src/wordcloud-chart.tsx +30 -0
- package/stories/0_intro.stories.js +60 -0
- package/stories/1_gettingStarted.stories.js +74 -0
- package/stories/1_gettingStarted_content.js +121 -0
- package/stories/all.stories.js +110 -0
- package/stories/diagrams/0_Diagrams.stories.js +259 -0
- package/stories/diagrams/CardNode.stories.js +106 -0
- package/stories/diagrams/Edge.stories.js +94 -0
- package/stories/diagrams/Marker.stories.js +95 -0
- package/stories/diagrams/ShapeNode.stories.js +42 -0
- package/tsconfig.json +20 -0
- package/LICENSE.md +0 -201
package/package.json
CHANGED
|
@@ -1,107 +1,107 @@
|
|
|
1
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
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
2
|
+
"name": "@carbon/charts-react",
|
|
3
|
+
"version": "0.59.0-beta.0",
|
|
4
|
+
"description": "Carbon charting components for React",
|
|
5
|
+
"main": "./bundle.js",
|
|
6
|
+
"module": "./index.js",
|
|
7
|
+
"types": "./index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"start": "yarn run storybook",
|
|
10
|
+
"build": "bash build.sh",
|
|
11
|
+
"format": "prettier . --write \"**/*.{scss,css,js,ts,tsx,md}\"",
|
|
12
|
+
"storybook": "start-storybook -p 9007 -c .storybook -s ./.storybook/assets",
|
|
13
|
+
"demo:build": "yarn build && build-storybook -o demo/bundle --quiet -s ./.storybook/assets",
|
|
14
|
+
"clean": "rm -rf dist demo/bundle"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git@github.com:carbon-design-system/carbon-charts.git",
|
|
19
|
+
"homepage": "https://carbon-design-system.github.io/carbon-charts/react/"
|
|
20
|
+
},
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"author": "IBM",
|
|
23
|
+
"keywords": [
|
|
24
|
+
"carbon",
|
|
25
|
+
"charts",
|
|
26
|
+
"react",
|
|
27
|
+
"dataviz",
|
|
28
|
+
"data-visualization",
|
|
29
|
+
"visualizations",
|
|
30
|
+
"d3",
|
|
31
|
+
"svg",
|
|
32
|
+
"component",
|
|
33
|
+
"components",
|
|
34
|
+
"css",
|
|
35
|
+
"html",
|
|
36
|
+
"ibm",
|
|
37
|
+
"typescript",
|
|
38
|
+
"javascript",
|
|
39
|
+
"js",
|
|
40
|
+
"library",
|
|
41
|
+
"pattern",
|
|
42
|
+
"patterns",
|
|
43
|
+
"sass",
|
|
44
|
+
"scss"
|
|
45
|
+
],
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/carbon-design-system/carbon-charts/issues"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/carbon-design-system/carbon-charts#readme",
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@carbon/charts": "^0.59.0-beta.0",
|
|
52
|
+
"@carbon/icons-react": "^10.49.0",
|
|
53
|
+
"@carbon/telemetry": "0.1.0"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
57
|
+
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@storybook/addon-knobs": "5.3.12",
|
|
61
|
+
"@storybook/addon-options": "5.3.12",
|
|
62
|
+
"@storybook/react": "5.3.12",
|
|
63
|
+
"@types/react": "17.0.0",
|
|
64
|
+
"@types/react-dom": "17.0.0",
|
|
65
|
+
"babel-cli": "6.26.0",
|
|
66
|
+
"babel-core": "6.26.0",
|
|
67
|
+
"babel-loader": "7.1.2",
|
|
68
|
+
"babel-plugin-external-helpers": "6.22.0",
|
|
69
|
+
"babel-plugin-transform-object-rest-spread": "6.26.0",
|
|
70
|
+
"babel-plugin-transform-react-jsx": "6.24.1",
|
|
71
|
+
"babel-preset-env": "1.6.1",
|
|
72
|
+
"babel-preset-react": "6.24.1",
|
|
73
|
+
"base64-inline-loader": "1.1.0",
|
|
74
|
+
"css-loader": "0.28.7",
|
|
75
|
+
"img-loader": "2.0.0",
|
|
76
|
+
"react": "17.0.2",
|
|
77
|
+
"react-dom": "17.0.2",
|
|
78
|
+
"rollup": "1.27.10",
|
|
79
|
+
"rollup-plugin-commonjs": "10.1.0",
|
|
80
|
+
"rollup-plugin-node-resolve": "5.2.0",
|
|
81
|
+
"rollup-plugin-terser": "5.1.2",
|
|
82
|
+
"sass": "1.49.9",
|
|
83
|
+
"sass-loader": "8.0.0",
|
|
84
|
+
"style-loader": "0.19.0",
|
|
85
|
+
"typescript": "4.1.2",
|
|
86
|
+
"url-loader": "0.6.2"
|
|
87
|
+
},
|
|
88
|
+
"publishConfig": {
|
|
89
|
+
"directory": "dist",
|
|
90
|
+
"access": "public"
|
|
91
|
+
},
|
|
92
|
+
"maintainers": [
|
|
93
|
+
{
|
|
94
|
+
"name": "Eliad Moosavi",
|
|
95
|
+
"email": "iliadm@ca.ibm.com",
|
|
96
|
+
"url": "https://github.com/theiliad"
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"contributors": [
|
|
100
|
+
{
|
|
101
|
+
"name": "Eliad Moosavi",
|
|
102
|
+
"email": "iliadm@ca.ibm.com",
|
|
103
|
+
"url": "https://github.com/theiliad"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"gitHead": "0149f808eb1b1c704804c137449cb4be3d47db75"
|
|
107
|
+
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { terser } from 'rollup-plugin-terser';
|
|
2
|
+
import resolve from 'rollup-plugin-node-resolve';
|
|
3
|
+
import commonjs from 'rollup-plugin-commonjs';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
input: './dist/index.js',
|
|
7
|
+
output: {
|
|
8
|
+
file: './dist/bundle.js',
|
|
9
|
+
format: 'umd',
|
|
10
|
+
name: 'ChartsReact',
|
|
11
|
+
globals: {
|
|
12
|
+
'@carbon/charts': 'Charts',
|
|
13
|
+
react: 'React',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
plugins: [terser(), resolve(), commonjs()],
|
|
17
|
+
external: ['react', 'react-dom', '@carbon/charts'],
|
|
18
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AlluvialChart as AC } from '@carbon/charts';
|
|
3
|
+
import BaseChart from './base-chart';
|
|
4
|
+
import { ChartConfig, AlluvialChartOptions } from '@carbon/charts/interfaces';
|
|
5
|
+
import { hasChartBeenInitialized } from './utils';
|
|
6
|
+
|
|
7
|
+
type AlluvialChartProps = ChartConfig<AlluvialChartOptions>;
|
|
8
|
+
|
|
9
|
+
export default class AlluvialChart extends BaseChart<AlluvialChartOptions> {
|
|
10
|
+
chartRef!: HTMLDivElement;
|
|
11
|
+
props!: AlluvialChartProps;
|
|
12
|
+
chart!: AC;
|
|
13
|
+
|
|
14
|
+
componentDidMount() {
|
|
15
|
+
if (hasChartBeenInitialized(this.chartRef) === false) {
|
|
16
|
+
this.chart = new AC(this.chartRef, {
|
|
17
|
+
data: this.props.data,
|
|
18
|
+
options: this.props.options,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
ref={(chartRef) => (this.chartRef = chartRef!)}
|
|
27
|
+
className="chart-holder"></div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StackedAreaChart as SAC } from '@carbon/charts';
|
|
3
|
+
import BaseChart from './base-chart';
|
|
4
|
+
import {
|
|
5
|
+
ChartConfig,
|
|
6
|
+
StackedAreaChartOptions,
|
|
7
|
+
} from '@carbon/charts/interfaces';
|
|
8
|
+
import { hasChartBeenInitialized } from './utils';
|
|
9
|
+
|
|
10
|
+
type StackedAreaChartProps = ChartConfig<StackedAreaChartOptions>;
|
|
11
|
+
|
|
12
|
+
export default class StackedAreaChart extends BaseChart<StackedAreaChartOptions> {
|
|
13
|
+
chartRef!: HTMLDivElement;
|
|
14
|
+
props!: StackedAreaChartProps;
|
|
15
|
+
chart!: SAC;
|
|
16
|
+
|
|
17
|
+
componentDidMount() {
|
|
18
|
+
if (hasChartBeenInitialized(this.chartRef) === false) {
|
|
19
|
+
this.chart = new SAC(this.chartRef, {
|
|
20
|
+
data: this.props.data,
|
|
21
|
+
options: this.props.options,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
render() {
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
ref={(chartRef) => (this.chartRef = chartRef!)}
|
|
30
|
+
className="chart-holder"></div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AreaChart as AC } from '@carbon/charts';
|
|
3
|
+
import BaseChart from './base-chart';
|
|
4
|
+
import { ChartConfig, AreaChartOptions } from '@carbon/charts/interfaces';
|
|
5
|
+
import { hasChartBeenInitialized } from './utils';
|
|
6
|
+
|
|
7
|
+
type AreaChartProps = ChartConfig<AreaChartOptions>;
|
|
8
|
+
|
|
9
|
+
export default class AreaChart extends BaseChart<AreaChartOptions> {
|
|
10
|
+
chartRef!: HTMLDivElement;
|
|
11
|
+
props!: AreaChartProps;
|
|
12
|
+
chart!: AC;
|
|
13
|
+
|
|
14
|
+
componentDidMount() {
|
|
15
|
+
if (hasChartBeenInitialized(this.chartRef) === false) {
|
|
16
|
+
this.chart = new AC(this.chartRef, {
|
|
17
|
+
data: this.props.data,
|
|
18
|
+
options: this.props.options,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
ref={(chartRef) => (this.chartRef = chartRef!)}
|
|
27
|
+
className="chart-holder"></div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GroupedBarChart as GBC } from '@carbon/charts';
|
|
3
|
+
import BaseChart from './base-chart';
|
|
4
|
+
import { ChartConfig, BarChartOptions } from '@carbon/charts/interfaces';
|
|
5
|
+
import { hasChartBeenInitialized } from './utils';
|
|
6
|
+
|
|
7
|
+
type GroupedBarChartProps = ChartConfig<BarChartOptions>;
|
|
8
|
+
|
|
9
|
+
export default class GroupedBarChart extends BaseChart<BarChartOptions> {
|
|
10
|
+
chartRef!: HTMLDivElement;
|
|
11
|
+
props!: GroupedBarChartProps;
|
|
12
|
+
chart!: GBC;
|
|
13
|
+
|
|
14
|
+
componentDidMount() {
|
|
15
|
+
if (hasChartBeenInitialized(this.chartRef) === false) {
|
|
16
|
+
this.chart = new GBC(this.chartRef, {
|
|
17
|
+
data: this.props.data,
|
|
18
|
+
options: this.props.options,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
ref={(chartRef) => (this.chartRef = chartRef!)}
|
|
27
|
+
className="chart-holder"></div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SimpleBarChart as SBC } from '@carbon/charts';
|
|
3
|
+
import BaseChart from './base-chart';
|
|
4
|
+
import { ChartConfig, BarChartOptions } from '@carbon/charts/interfaces';
|
|
5
|
+
import { hasChartBeenInitialized } from './utils';
|
|
6
|
+
|
|
7
|
+
type SimpleBarChartProps = ChartConfig<BarChartOptions>;
|
|
8
|
+
|
|
9
|
+
export default class SimpleBarChart extends BaseChart<BarChartOptions> {
|
|
10
|
+
chartRef!: HTMLDivElement;
|
|
11
|
+
props!: SimpleBarChartProps;
|
|
12
|
+
chart!: SBC;
|
|
13
|
+
|
|
14
|
+
componentDidMount() {
|
|
15
|
+
if (hasChartBeenInitialized(this.chartRef) === false) {
|
|
16
|
+
this.chart = new SBC(this.chartRef, {
|
|
17
|
+
data: this.props.data,
|
|
18
|
+
options: this.props.options,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
ref={(chartRef) => (this.chartRef = chartRef!)}
|
|
27
|
+
className="chart-holder"></div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StackedBarChart as SBC } from '@carbon/charts';
|
|
3
|
+
import BaseChart from './base-chart';
|
|
4
|
+
import { ChartConfig, StackedBarChartOptions } from '@carbon/charts/interfaces';
|
|
5
|
+
import { hasChartBeenInitialized } from './utils';
|
|
6
|
+
|
|
7
|
+
type StackedBarChartProps = ChartConfig<StackedBarChartOptions>;
|
|
8
|
+
|
|
9
|
+
export default class StackedBarChart extends BaseChart<StackedBarChartOptions> {
|
|
10
|
+
chartRef!: HTMLDivElement;
|
|
11
|
+
props!: StackedBarChartProps;
|
|
12
|
+
chart!: SBC;
|
|
13
|
+
|
|
14
|
+
componentDidMount() {
|
|
15
|
+
if (hasChartBeenInitialized(this.chartRef) === false) {
|
|
16
|
+
this.chart = new SBC(this.chartRef, {
|
|
17
|
+
data: this.props.data,
|
|
18
|
+
options: this.props.options,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
ref={(chartRef) => (this.chartRef = chartRef!)}
|
|
27
|
+
className="chart-holder"></div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Chart as BaseChartType } from '@carbon/charts/chart';
|
|
3
|
+
import { ChartTabularData, BaseChartOptions } from '@carbon/charts/interfaces';
|
|
4
|
+
|
|
5
|
+
type Props<Options> = { options?: Options; data?: ChartTabularData };
|
|
6
|
+
|
|
7
|
+
export default class BaseChart<
|
|
8
|
+
Options = BaseChartOptions
|
|
9
|
+
> extends React.Component<Props<Options>> {
|
|
10
|
+
data: ChartTabularData | [];
|
|
11
|
+
options: Options | {};
|
|
12
|
+
props!: Props<Options>;
|
|
13
|
+
chart!: BaseChartType;
|
|
14
|
+
|
|
15
|
+
constructor(props: Props<Options>) {
|
|
16
|
+
super(props);
|
|
17
|
+
|
|
18
|
+
const { options, data } = props;
|
|
19
|
+
|
|
20
|
+
if (!options) {
|
|
21
|
+
console.error('Missing options!');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!data) {
|
|
25
|
+
console.error('Missing data!');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
this.data = props.data || [];
|
|
29
|
+
this.options = props.options || {};
|
|
30
|
+
|
|
31
|
+
Object.assign(this, this.chart);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
shouldComponentUpdate(nextProps: Props<Options>) {
|
|
35
|
+
return (
|
|
36
|
+
this.props.data !== nextProps.data ||
|
|
37
|
+
this.props.options !== nextProps.options
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
componentDidUpdate() {
|
|
42
|
+
this.chart.model.setData(this.props.data);
|
|
43
|
+
this.chart.model.setOptions(this.props.options);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BoxplotChart as BC } from '@carbon/charts';
|
|
3
|
+
import BaseChart from './base-chart';
|
|
4
|
+
import { ChartConfig, BoxplotChartOptions } from '@carbon/charts/interfaces';
|
|
5
|
+
import { hasChartBeenInitialized } from './utils';
|
|
6
|
+
|
|
7
|
+
type BoxplotChartProps = ChartConfig<BoxplotChartOptions>;
|
|
8
|
+
|
|
9
|
+
export default class BoxplotChart extends BaseChart<BoxplotChartOptions> {
|
|
10
|
+
chartRef!: HTMLDivElement;
|
|
11
|
+
props!: BoxplotChartProps;
|
|
12
|
+
chart!: BC;
|
|
13
|
+
|
|
14
|
+
componentDidMount() {
|
|
15
|
+
if (hasChartBeenInitialized(this.chartRef) === false) {
|
|
16
|
+
this.chart = new BC(this.chartRef, {
|
|
17
|
+
data: this.props.data,
|
|
18
|
+
options: this.props.options,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
ref={(chartRef) => (this.chartRef = chartRef!)}
|
|
27
|
+
className="chart-holder"></div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BubbleChart as BC } from '@carbon/charts';
|
|
3
|
+
import BaseChart from './base-chart';
|
|
4
|
+
import { ChartConfig, BubbleChartOptions } from '@carbon/charts/interfaces';
|
|
5
|
+
import { hasChartBeenInitialized } from './utils';
|
|
6
|
+
|
|
7
|
+
type BubbleChartProps = ChartConfig<BubbleChartOptions>;
|
|
8
|
+
|
|
9
|
+
export default class BubbleChart extends BaseChart<BubbleChartOptions> {
|
|
10
|
+
chartRef!: HTMLDivElement;
|
|
11
|
+
props!: BubbleChartProps;
|
|
12
|
+
chart!: BC;
|
|
13
|
+
|
|
14
|
+
componentDidMount() {
|
|
15
|
+
if (hasChartBeenInitialized(this.chartRef) === false) {
|
|
16
|
+
this.chart = new BC(this.chartRef, {
|
|
17
|
+
data: this.props.data,
|
|
18
|
+
options: this.props.options,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
ref={(chartRef) => (this.chartRef = chartRef!)}
|
|
27
|
+
className="chart-holder"></div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BulletChart as BC } from '@carbon/charts';
|
|
3
|
+
import BaseChart from './base-chart';
|
|
4
|
+
import { ChartConfig, BulletChartOptions } from '@carbon/charts/interfaces';
|
|
5
|
+
import { hasChartBeenInitialized } from './utils';
|
|
6
|
+
|
|
7
|
+
type BulletChartProps = ChartConfig<BulletChartOptions>;
|
|
8
|
+
|
|
9
|
+
export default class BulletChart extends BaseChart<BulletChartOptions> {
|
|
10
|
+
chartRef!: HTMLDivElement;
|
|
11
|
+
props!: BulletChartProps;
|
|
12
|
+
chart!: BC;
|
|
13
|
+
|
|
14
|
+
componentDidMount() {
|
|
15
|
+
if (hasChartBeenInitialized(this.chartRef) === false) {
|
|
16
|
+
this.chart = new BC(this.chartRef, {
|
|
17
|
+
data: this.props.data,
|
|
18
|
+
options: this.props.options,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
ref={(chartRef) => (this.chartRef = chartRef!)}
|
|
27
|
+
className="chart-holder"></div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CirclePackChart as CPC } from '@carbon/charts';
|
|
3
|
+
import BaseChart from './base-chart';
|
|
4
|
+
import { ChartConfig, CirclePackChartOptions } from '@carbon/charts/interfaces';
|
|
5
|
+
import { hasChartBeenInitialized } from './utils';
|
|
6
|
+
|
|
7
|
+
type CirclePackChartProps = ChartConfig<CirclePackChartOptions>;
|
|
8
|
+
|
|
9
|
+
export default class CirclePackChart extends BaseChart<CirclePackChartOptions> {
|
|
10
|
+
chartRef!: HTMLDivElement;
|
|
11
|
+
props!: CirclePackChartProps;
|
|
12
|
+
chart!: CPC;
|
|
13
|
+
|
|
14
|
+
componentDidMount() {
|
|
15
|
+
if (hasChartBeenInitialized(this.chartRef) === false) {
|
|
16
|
+
this.chart = new CPC(this.chartRef, {
|
|
17
|
+
data: this.props.data,
|
|
18
|
+
options: this.props.options,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
ref={(chartRef) => (this.chartRef = chartRef!)}
|
|
27
|
+
className="chart-holder"></div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComboChart as CC } from '@carbon/charts';
|
|
3
|
+
import BaseChart from './base-chart';
|
|
4
|
+
import { ChartConfig, ComboChartOptions } from '@carbon/charts/interfaces';
|
|
5
|
+
import { hasChartBeenInitialized } from './utils';
|
|
6
|
+
|
|
7
|
+
type ComboChartProps = ChartConfig<ComboChartOptions>;
|
|
8
|
+
|
|
9
|
+
export default class ComboChart extends BaseChart<ComboChartOptions> {
|
|
10
|
+
chartRef!: HTMLDivElement;
|
|
11
|
+
props!: ComboChartProps;
|
|
12
|
+
chart!: CC;
|
|
13
|
+
|
|
14
|
+
componentDidMount() {
|
|
15
|
+
if (hasChartBeenInitialized(this.chartRef) === false) {
|
|
16
|
+
this.chart = new CC(this.chartRef, {
|
|
17
|
+
data: this.props.data,
|
|
18
|
+
options: this.props.options,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
ref={(chartRef) => (this.chartRef = chartRef!)}
|
|
27
|
+
className="chart-holder"></div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|