@carbon/charts-react 0.59.0-beta.0 → 1.0.1
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/CHANGELOG.md +49 -282
- package/LICENSE.md +201 -0
- package/README.md +5 -1
- package/{dist/alluvial-chart.d.ts → alluvial-chart.d.ts} +0 -0
- package/{dist/alluvial-chart.js → alluvial-chart.js} +0 -0
- package/{dist/area-chart-stacked.d.ts → area-chart-stacked.d.ts} +0 -0
- package/{dist/area-chart-stacked.js → area-chart-stacked.js} +0 -0
- package/{dist/area-chart.d.ts → area-chart.d.ts} +0 -0
- package/{dist/area-chart.js → area-chart.js} +0 -0
- package/{dist/bar-chart-grouped.d.ts → bar-chart-grouped.d.ts} +0 -0
- package/{dist/bar-chart-grouped.js → bar-chart-grouped.js} +0 -0
- package/{dist/bar-chart-simple.d.ts → bar-chart-simple.d.ts} +0 -0
- package/{dist/bar-chart-simple.js → bar-chart-simple.js} +0 -0
- package/{dist/bar-chart-stacked.d.ts → bar-chart-stacked.d.ts} +0 -0
- package/{dist/bar-chart-stacked.js → bar-chart-stacked.js} +0 -0
- package/{dist/base-chart.d.ts → base-chart.d.ts} +0 -0
- package/{dist/base-chart.js → base-chart.js} +0 -0
- package/{dist/boxplot-chart.d.ts → boxplot-chart.d.ts} +0 -0
- package/{dist/boxplot-chart.js → boxplot-chart.js} +0 -0
- package/{dist/bubble-chart.d.ts → bubble-chart.d.ts} +0 -0
- package/{dist/bubble-chart.js → bubble-chart.js} +0 -0
- package/{dist/bullet-chart.d.ts → bullet-chart.d.ts} +0 -0
- package/{dist/bullet-chart.js → bullet-chart.js} +0 -0
- package/{dist/bundle.js → bundle.js} +0 -0
- package/{dist/circle-pack-chart.d.ts → circle-pack-chart.d.ts} +0 -0
- package/{dist/circle-pack-chart.js → circle-pack-chart.js} +0 -0
- package/{dist/combo-chart.d.ts → combo-chart.d.ts} +0 -0
- package/{dist/combo-chart.js → combo-chart.js} +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNode.d.ts +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNode.js +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNodeColumn.d.ts +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNodeColumn.js +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNodeLabel.d.ts +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNodeLabel.js +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNodeSubtitle.d.ts +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNodeSubtitle.js +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNodeTitle.d.ts +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNodeTitle.js +0 -0
- package/{dist/diagrams → diagrams}/CardNode/index.d.ts +0 -0
- package/{dist/diagrams → diagrams}/CardNode/index.js +0 -0
- package/{dist/diagrams → diagrams}/Edge/Edge.d.ts +0 -0
- package/{dist/diagrams → diagrams}/Edge/Edge.js +0 -0
- package/{dist/diagrams → diagrams}/Edge/index.d.ts +0 -0
- package/{dist/diagrams → diagrams}/Edge/index.js +0 -0
- package/{dist/diagrams → diagrams}/Marker/Marker.d.ts +0 -0
- package/{dist/diagrams → diagrams}/Marker/Marker.js +0 -0
- package/{dist/diagrams → diagrams}/Marker/index.d.ts +0 -0
- package/{dist/diagrams → diagrams}/Marker/index.js +0 -0
- package/{dist/diagrams → diagrams}/ShapeNode/ShapeNode.d.ts +0 -0
- package/{dist/diagrams → diagrams}/ShapeNode/ShapeNode.js +0 -0
- package/{dist/diagrams → diagrams}/ShapeNode/index.d.ts +0 -0
- package/{dist/diagrams → diagrams}/ShapeNode/index.js +0 -0
- package/{dist/diagrams → diagrams}/configs.d.ts +0 -0
- package/{dist/diagrams → diagrams}/configs.js +0 -0
- package/{dist/donut-chart.d.ts → donut-chart.d.ts} +0 -0
- package/{dist/donut-chart.js → donut-chart.js} +0 -0
- package/{dist/gauge-chart.d.ts → gauge-chart.d.ts} +0 -0
- package/{dist/gauge-chart.js → gauge-chart.js} +0 -0
- package/{dist/heatmap-chart.d.ts → heatmap-chart.d.ts} +0 -0
- package/{dist/heatmap-chart.js → heatmap-chart.js} +0 -0
- package/{dist/histogram-chart.d.ts → histogram-chart.d.ts} +0 -0
- package/{dist/histogram-chart.js → histogram-chart.js} +0 -0
- package/{dist/index.d.ts → index.d.ts} +0 -0
- package/{dist/index.js → index.js} +0 -0
- package/{dist/line-chart.d.ts → line-chart.d.ts} +0 -0
- package/{dist/line-chart.js → line-chart.js} +0 -0
- package/{dist/lollipop-chart.d.ts → lollipop-chart.d.ts} +0 -0
- package/{dist/lollipop-chart.js → lollipop-chart.js} +0 -0
- package/{dist/meter-chart.d.ts → meter-chart.d.ts} +0 -0
- package/{dist/meter-chart.js → meter-chart.js} +0 -0
- package/package.json +106 -106
- package/{dist/pie-chart.d.ts → pie-chart.d.ts} +0 -0
- package/{dist/pie-chart.js → pie-chart.js} +0 -0
- package/{dist/radar-chart.d.ts → radar-chart.d.ts} +0 -0
- package/{dist/radar-chart.js → radar-chart.js} +0 -0
- package/{dist/scatter-chart.d.ts → scatter-chart.d.ts} +0 -0
- package/{dist/scatter-chart.js → scatter-chart.js} +0 -0
- package/{dist/tree-chart.d.ts → tree-chart.d.ts} +0 -0
- package/{dist/tree-chart.js → tree-chart.js} +0 -0
- package/{dist/treemap-chart.d.ts → treemap-chart.d.ts} +0 -0
- package/{dist/treemap-chart.js → treemap-chart.js} +0 -0
- package/{dist/utils.d.ts → utils.d.ts} +0 -0
- package/{dist/utils.js → utils.js} +0 -0
- package/{dist/wordcloud-chart.d.ts → wordcloud-chart.d.ts} +0 -0
- package/{dist/wordcloud-chart.js → wordcloud-chart.js} +0 -0
- package/.babelrc +0 -4
- package/.prettierignore +0 -1
- package/.storybook/addons.js +0 -2
- package/.storybook/assets/logo.svg +0 -1
- package/.storybook/assets/share.png +0 -0
- package/.storybook/assets/welcome.png +0 -0
- package/.storybook/config.js +0 -22
- package/.storybook/main.js +0 -24
- package/.storybook/manager-head.html +0 -42
- package/.storybook/preview-head.html +0 -10
- package/build.sh +0 -20
- package/carbon.yml +0 -275
- package/carbon__charts-react-tests.tsx +0 -83
- package/demo/bundle/favicon.ico +0 -0
- package/demo/bundle/index.html +0 -22
- package/demo/bundle/logo.svg +0 -1
- package/demo/bundle/main.4a87b5852cddf04c8e9a.bundle.js +0 -1
- package/demo/bundle/runtime~main.6b70b35614cf83eab770.bundle.js +0 -1
- package/demo/bundle/sb_dll/storybook_ui-manifest.json +0 -1
- package/demo/bundle/sb_dll/storybook_ui_dll.LICENCE +0 -113
- package/demo/bundle/sb_dll/storybook_ui_dll.js +0 -2
- package/demo/bundle/share.png +0 -0
- package/demo/bundle/vendors~main.9ceec0efe2f3ef413ade.bundle.js +0 -111
- package/demo/bundle/welcome.png +0 -0
- package/dist/CHANGELOG.md +0 -2150
- package/dist/README.md +0 -56
- package/dist/package.json +0 -107
- package/helpers/commons.js +0 -30
- package/rollup.config.js +0 -18
- package/src/alluvial-chart.tsx +0 -30
- package/src/area-chart-stacked.tsx +0 -33
- package/src/area-chart.tsx +0 -30
- package/src/bar-chart-grouped.tsx +0 -30
- package/src/bar-chart-simple.tsx +0 -30
- package/src/bar-chart-stacked.tsx +0 -30
- package/src/base-chart.tsx +0 -45
- package/src/boxplot-chart.tsx +0 -30
- package/src/bubble-chart.tsx +0 -30
- package/src/bullet-chart.tsx +0 -30
- package/src/circle-pack-chart.tsx +0 -30
- package/src/combo-chart.tsx +0 -30
- package/src/diagrams/CardNode/CardNode.tsx +0 -121
- package/src/diagrams/CardNode/CardNodeColumn.tsx +0 -38
- package/src/diagrams/CardNode/CardNodeLabel.tsx +0 -32
- package/src/diagrams/CardNode/CardNodeSubtitle.tsx +0 -32
- package/src/diagrams/CardNode/CardNodeTitle.tsx +0 -32
- package/src/diagrams/CardNode/index.tsx +0 -13
- package/src/diagrams/Edge/Edge.tsx +0 -137
- package/src/diagrams/Edge/index.tsx +0 -2
- package/src/diagrams/Marker/Marker.tsx +0 -121
- package/src/diagrams/Marker/index.tsx +0 -9
- package/src/diagrams/ShapeNode/ShapeNode.tsx +0 -153
- package/src/diagrams/ShapeNode/index.tsx +0 -2
- package/src/diagrams/configs.ts +0 -1
- package/src/donut-chart.tsx +0 -30
- package/src/gauge-chart.tsx +0 -30
- package/src/heatmap-chart.tsx +0 -30
- package/src/histogram-chart.tsx +0 -30
- package/src/index.ts +0 -51
- package/src/line-chart.tsx +0 -30
- package/src/lollipop-chart.tsx +0 -30
- package/src/meter-chart.tsx +0 -30
- package/src/pie-chart.tsx +0 -30
- package/src/radar-chart.tsx +0 -30
- package/src/scatter-chart.tsx +0 -30
- package/src/tree-chart.tsx +0 -30
- package/src/treemap-chart.tsx +0 -30
- package/src/utils.ts +0 -7
- package/src/wordcloud-chart.tsx +0 -30
- package/stories/0_intro.stories.js +0 -60
- package/stories/1_gettingStarted.stories.js +0 -74
- package/stories/1_gettingStarted_content.js +0 -121
- package/stories/all.stories.js +0 -110
- package/stories/diagrams/0_Diagrams.stories.js +0 -259
- package/stories/diagrams/CardNode.stories.js +0 -106
- package/stories/diagrams/Edge.stories.js +0 -94
- package/stories/diagrams/Marker.stories.js +0 -95
- package/stories/diagrams/ShapeNode.stories.js +0 -42
- package/tsconfig.json +0 -20
package/dist/README.md
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# `@carbon/charts-react`
|
|
2
|
-
|
|
3
|
-
> Carbon Charting React Wrappers
|
|
4
|
-
|
|
5
|
-
**[Storybook demos](https://carbon-design-system.github.io/carbon-charts/react)**
|
|
6
|
-
|
|
7
|
-
**[Storybook demo sources](https://github.com/carbon-design-system/carbon-charts/tree/master/packages/core/demo/data)**
|
|
8
|
-
|
|
9
|
-
## Getting started
|
|
10
|
-
|
|
11
|
-
Run the following command using [npm](https://www.npmjs.com/):
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install -S @carbon/charts @carbon/charts-react d3
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
If you prefer [Yarn](https://yarnpkg.com/en/), use the following command
|
|
18
|
-
instead:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
yarn add @carbon/charts @carbon/charts-react d3
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**Note:** you'd also need to install `carbon-components` if you're not using a
|
|
25
|
-
bundled version of the library.
|
|
26
|
-
|
|
27
|
-
## Step-by-step instructions
|
|
28
|
-
|
|
29
|
-
Read
|
|
30
|
-
[here](https://carbon-design-system.github.io/carbon-charts/?path=/story/docs-getting-started--react)
|
|
31
|
-
|
|
32
|
-
## Codesandbox examples
|
|
33
|
-
|
|
34
|
-
[Sample use cases can be seen here](https://carbon-design-system.github.io/carbon-charts/react).
|
|
35
|
-
|
|
36
|
-
**When opening the link above**, click on the **Edit on Codesandbox** button for
|
|
37
|
-
each demo to see an isolated project showing you how to reproduce the demo.
|
|
38
|
-
|
|
39
|
-
## Charting data & options
|
|
40
|
-
|
|
41
|
-
Although we will definitely introduce new models in the future as we start
|
|
42
|
-
shipping new components such as maps, Data and options follow the same model in
|
|
43
|
-
all charts, with minor exceptions and differences in specific components.
|
|
44
|
-
|
|
45
|
-
For instance in the case of a donut chart you're able to pass in an additional
|
|
46
|
-
field called `center` in your options configuring the donut center.
|
|
47
|
-
|
|
48
|
-
For instructions on using the **tabular data format**, see
|
|
49
|
-
[here](https://carbon-design-system.github.io/carbon-charts/?path=/story/docs-tutorials--tabular-data-format)
|
|
50
|
-
|
|
51
|
-
There are also additional options available depending on the chart type being
|
|
52
|
-
used,
|
|
53
|
-
[see our demo examples here](https://github.com/carbon-design-system/carbon-charts/tree/master/packages/core/demo/data).
|
|
54
|
-
|
|
55
|
-
Customizable options (specific to chart type) can be found
|
|
56
|
-
[here](https://carbon-design-system.github.io/carbon-charts/documentation/modules/_interfaces_charts_.html)
|
package/dist/package.json
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@carbon/charts-react",
|
|
3
|
-
"version": "0.58.1",
|
|
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
|
-
"postinstall": "carbon-telemetry collect --install"
|
|
16
|
-
},
|
|
17
|
-
"repository": {
|
|
18
|
-
"type": "git",
|
|
19
|
-
"url": "git@github.com:carbon-design-system/carbon-charts.git",
|
|
20
|
-
"homepage": "https://carbon-design-system.github.io/carbon-charts/react/"
|
|
21
|
-
},
|
|
22
|
-
"license": "Apache-2.0",
|
|
23
|
-
"author": "IBM",
|
|
24
|
-
"keywords": [
|
|
25
|
-
"carbon",
|
|
26
|
-
"charts",
|
|
27
|
-
"react",
|
|
28
|
-
"dataviz",
|
|
29
|
-
"data-visualization",
|
|
30
|
-
"visualizations",
|
|
31
|
-
"d3",
|
|
32
|
-
"svg",
|
|
33
|
-
"component",
|
|
34
|
-
"components",
|
|
35
|
-
"css",
|
|
36
|
-
"html",
|
|
37
|
-
"ibm",
|
|
38
|
-
"typescript",
|
|
39
|
-
"javascript",
|
|
40
|
-
"js",
|
|
41
|
-
"library",
|
|
42
|
-
"pattern",
|
|
43
|
-
"patterns",
|
|
44
|
-
"sass",
|
|
45
|
-
"scss"
|
|
46
|
-
],
|
|
47
|
-
"bugs": {
|
|
48
|
-
"url": "https://github.com/carbon-design-system/carbon-charts/issues"
|
|
49
|
-
},
|
|
50
|
-
"homepage": "https://github.com/carbon-design-system/carbon-charts#readme",
|
|
51
|
-
"dependencies": {
|
|
52
|
-
"@carbon/charts": "^0.58.1",
|
|
53
|
-
"@carbon/icons-react": "^10.49.0",
|
|
54
|
-
"@carbon/telemetry": "0.1.0"
|
|
55
|
-
},
|
|
56
|
-
"peerDependencies": {
|
|
57
|
-
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
58
|
-
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
|
|
59
|
-
},
|
|
60
|
-
"devDependencies": {
|
|
61
|
-
"@storybook/addon-knobs": "5.3.12",
|
|
62
|
-
"@storybook/addon-options": "5.3.12",
|
|
63
|
-
"@storybook/react": "5.3.12",
|
|
64
|
-
"@types/react": "17.0.0",
|
|
65
|
-
"@types/react-dom": "17.0.0",
|
|
66
|
-
"babel-cli": "6.26.0",
|
|
67
|
-
"babel-core": "6.26.0",
|
|
68
|
-
"babel-loader": "7.1.2",
|
|
69
|
-
"babel-plugin-external-helpers": "6.22.0",
|
|
70
|
-
"babel-plugin-transform-object-rest-spread": "6.26.0",
|
|
71
|
-
"babel-plugin-transform-react-jsx": "6.24.1",
|
|
72
|
-
"babel-preset-env": "1.6.1",
|
|
73
|
-
"babel-preset-react": "6.24.1",
|
|
74
|
-
"base64-inline-loader": "1.1.0",
|
|
75
|
-
"css-loader": "0.28.7",
|
|
76
|
-
"img-loader": "2.0.0",
|
|
77
|
-
"react": "17.0.2",
|
|
78
|
-
"react-dom": "17.0.2",
|
|
79
|
-
"rollup": "1.27.10",
|
|
80
|
-
"rollup-plugin-commonjs": "10.1.0",
|
|
81
|
-
"rollup-plugin-node-resolve": "5.2.0",
|
|
82
|
-
"rollup-plugin-terser": "5.1.2",
|
|
83
|
-
"sass": "1.49.9",
|
|
84
|
-
"sass-loader": "8.0.0",
|
|
85
|
-
"style-loader": "0.19.0",
|
|
86
|
-
"typescript": "4.1.2",
|
|
87
|
-
"url-loader": "0.6.2"
|
|
88
|
-
},
|
|
89
|
-
"publishConfig": {
|
|
90
|
-
"directory": "dist",
|
|
91
|
-
"access": "public"
|
|
92
|
-
},
|
|
93
|
-
"maintainers": [
|
|
94
|
-
{
|
|
95
|
-
"name": "Eliad Moosavi",
|
|
96
|
-
"email": "iliadm@ca.ibm.com",
|
|
97
|
-
"url": "https://github.com/theiliad"
|
|
98
|
-
}
|
|
99
|
-
],
|
|
100
|
-
"contributors": [
|
|
101
|
-
{
|
|
102
|
-
"name": "Eliad Moosavi",
|
|
103
|
-
"email": "iliadm@ca.ibm.com",
|
|
104
|
-
"url": "https://github.com/theiliad"
|
|
105
|
-
}
|
|
106
|
-
]
|
|
107
|
-
}
|
package/helpers/commons.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Function to be used to randomize a value
|
|
2
|
-
export const randomizeValue = (currentVal) => {
|
|
3
|
-
const firstTry = Math.max(
|
|
4
|
-
0.5 * currentVal,
|
|
5
|
-
currentVal * Math.random() * (Math.random() * 5)
|
|
6
|
-
);
|
|
7
|
-
const result =
|
|
8
|
-
currentVal > 0
|
|
9
|
-
? Math.min(2 * currentVal, firstTry)
|
|
10
|
-
: Math.max(2 * currentVal, firstTry);
|
|
11
|
-
|
|
12
|
-
return Math.floor(result);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const colors = [
|
|
16
|
-
'#6e32c9',
|
|
17
|
-
'#1191e6',
|
|
18
|
-
'#006161',
|
|
19
|
-
'#a11950',
|
|
20
|
-
'#fb4b53',
|
|
21
|
-
'#570408',
|
|
22
|
-
'#198038',
|
|
23
|
-
'#003d73',
|
|
24
|
-
'#ee538b',
|
|
25
|
-
'#b28600',
|
|
26
|
-
'#009c98',
|
|
27
|
-
'#002b50',
|
|
28
|
-
'#8a3800',
|
|
29
|
-
'#a66efa',
|
|
30
|
-
];
|
package/rollup.config.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
};
|
package/src/alluvial-chart.tsx
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
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
|
-
}
|
package/src/area-chart.tsx
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
}
|
package/src/bar-chart-simple.tsx
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
}
|
package/src/base-chart.tsx
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
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
|
-
}
|
package/src/boxplot-chart.tsx
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
}
|
package/src/bubble-chart.tsx
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
}
|
package/src/bullet-chart.tsx
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
}
|
package/src/combo-chart.tsx
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
}
|