@carbon/charts-angular 1.9.0-rc.1 → 1.9.0-rc.3

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.
Files changed (173) hide show
  1. package/.eslintrc.json +51 -0
  2. package/.storybook/carbon-charts-theme.ts +8 -0
  3. package/.storybook/main.ts +39 -0
  4. package/.storybook/manager-head.html +22 -0
  5. package/.storybook/manager.ts +6 -0
  6. package/.storybook/preview-head.html +6 -0
  7. package/.storybook/preview.ts +42 -0
  8. package/.storybook/tsconfig.json +21 -0
  9. package/.storybook/typings.d.ts +4 -0
  10. package/angular.json +91 -0
  11. package/carbon.yml +277 -0
  12. package/ng-package.json +14 -0
  13. package/package.json +71 -17
  14. package/src/index.ts +53 -0
  15. package/src/lib/charts/alluvial-chart.component.ts +30 -0
  16. package/src/lib/charts/area-chart-stacked.component.ts +30 -0
  17. package/src/lib/charts/area-chart.component.ts +30 -0
  18. package/src/lib/charts/bar-chart-grouped.component.ts +30 -0
  19. package/src/lib/charts/bar-chart-simple.component.ts +30 -0
  20. package/src/lib/charts/bar-chart-stacked.component.ts +30 -0
  21. package/src/lib/charts/base-chart.component.ts +91 -0
  22. package/src/lib/charts/boxplot-chart.component.ts +30 -0
  23. package/src/lib/charts/bubble-chart.component.ts +30 -0
  24. package/src/lib/charts/bullet-chart.component.ts +30 -0
  25. package/src/lib/charts/charts.module.ts +92 -0
  26. package/src/lib/charts/choropleth.component.ts +33 -0
  27. package/src/lib/charts/circle-pack-chart.component.ts +30 -0
  28. package/src/lib/charts/combo-chart.component.ts +30 -0
  29. package/src/lib/charts/donut-chart.component.ts +30 -0
  30. package/src/lib/charts/gauge-chart.component.ts +30 -0
  31. package/src/lib/charts/heatmap-chart.component.ts +30 -0
  32. package/src/lib/charts/histogram-chart.component.ts +30 -0
  33. package/{lib/charts/index.d.ts → src/lib/charts/index.ts} +28 -27
  34. package/src/lib/charts/line-chart.component.ts +30 -0
  35. package/src/lib/charts/lollipop-chart.component.ts +30 -0
  36. package/src/lib/charts/meter-chart.component.ts +30 -0
  37. package/src/lib/charts/pie-chart.component.ts +30 -0
  38. package/src/lib/charts/radar-chart.component.ts +30 -0
  39. package/src/lib/charts/scatter-chart.component.ts +30 -0
  40. package/src/lib/charts/tree-chart.component.ts +30 -0
  41. package/src/lib/charts/treemap-chart.component.ts +30 -0
  42. package/src/lib/charts/wordcloud-chart.component.ts +30 -0
  43. package/src/lib/diagrams/config.ts +1 -0
  44. package/src/lib/diagrams/edges/edge.component.ts +41 -0
  45. package/src/lib/diagrams/edges/edge.module.ts +11 -0
  46. package/src/lib/diagrams/edges/marker/marker.component.ts +112 -0
  47. package/src/lib/diagrams/edges/marker/marker.module.ts +43 -0
  48. package/src/lib/diagrams/index.ts +23 -0
  49. package/src/lib/diagrams/nodes/cards/card-node-column.component.ts +22 -0
  50. package/src/lib/diagrams/nodes/cards/card-node-label.component.ts +14 -0
  51. package/src/lib/diagrams/nodes/cards/card-node-subtitle.component.ts +14 -0
  52. package/src/lib/diagrams/nodes/cards/card-node-title.component.ts +14 -0
  53. package/src/lib/diagrams/nodes/cards/card-node.component.ts +98 -0
  54. package/src/lib/diagrams/nodes/cards/card-node.module.ts +32 -0
  55. package/src/lib/diagrams/nodes/shape/shape-node.component.ts +120 -0
  56. package/src/lib/diagrams/nodes/shape/shape-node.module.ts +11 -0
  57. package/src/lib/index.ts +50 -0
  58. package/src/stories/0-api.stories.mdx +69 -0
  59. package/src/stories/1-color-palette.stories.mdx +73 -0
  60. package/src/stories/2-combo-charts.stories.mdx +107 -0
  61. package/src/stories/3-dual-axes-charts.stories.mdx +51 -0
  62. package/src/stories/4-event-listeners.stories.mdx +26 -0
  63. package/src/stories/5-tabular-data-format.stories.mdx +132 -0
  64. package/src/stories/6-themes.stories.mdx +50 -0
  65. package/src/stories/all.stories.ts +104 -0
  66. package/src/stories/angular.stories.mdx +136 -0
  67. package/src/stories/diagrams/0-diagrams-start-here.stories.ts +219 -0
  68. package/src/stories/diagrams/diagrams-edges-marker.stories.ts +189 -0
  69. package/src/stories/diagrams/diagrams-edges.stories.ts +177 -0
  70. package/src/stories/diagrams/diagrams-nodes-card.stories.ts +245 -0
  71. package/src/stories/diagrams/diagrams-nodes-shape.stories.ts +141 -0
  72. package/src/stories/diagrams/utils.ts +5 -0
  73. package/src/test.ts +28 -0
  74. package/tsconfig.json +43 -0
  75. package/tsconfig.lib.json +14 -0
  76. package/tsconfig.lib.prod.json +11 -0
  77. package/tsconfig.spec.json +17 -0
  78. package/tsconfig.vite.json +13 -0
  79. package/vite.config.ts +22 -0
  80. package/esm2022/carbon-charts-angular.mjs +0 -5
  81. package/esm2022/index.mjs +0 -14
  82. package/esm2022/lib/charts/alluvial-chart.component.mjs +0 -32
  83. package/esm2022/lib/charts/area-chart-stacked.component.mjs +0 -32
  84. package/esm2022/lib/charts/area-chart.component.mjs +0 -32
  85. package/esm2022/lib/charts/bar-chart-grouped.component.mjs +0 -32
  86. package/esm2022/lib/charts/bar-chart-simple.component.mjs +0 -32
  87. package/esm2022/lib/charts/bar-chart-stacked.component.mjs +0 -32
  88. package/esm2022/lib/charts/base-chart.component.mjs +0 -75
  89. package/esm2022/lib/charts/boxplot-chart.component.mjs +0 -32
  90. package/esm2022/lib/charts/bubble-chart.component.mjs +0 -32
  91. package/esm2022/lib/charts/bullet-chart.component.mjs +0 -32
  92. package/esm2022/lib/charts/charts.module.mjs +0 -123
  93. package/esm2022/lib/charts/choropleth.component.mjs +0 -32
  94. package/esm2022/lib/charts/circle-pack-chart.component.mjs +0 -32
  95. package/esm2022/lib/charts/combo-chart.component.mjs +0 -32
  96. package/esm2022/lib/charts/donut-chart.component.mjs +0 -32
  97. package/esm2022/lib/charts/gauge-chart.component.mjs +0 -32
  98. package/esm2022/lib/charts/heatmap-chart.component.mjs +0 -32
  99. package/esm2022/lib/charts/histogram-chart.component.mjs +0 -32
  100. package/esm2022/lib/charts/index.mjs +0 -28
  101. package/esm2022/lib/charts/line-chart.component.mjs +0 -32
  102. package/esm2022/lib/charts/lollipop-chart.component.mjs +0 -32
  103. package/esm2022/lib/charts/meter-chart.component.mjs +0 -32
  104. package/esm2022/lib/charts/pie-chart.component.mjs +0 -32
  105. package/esm2022/lib/charts/radar-chart.component.mjs +0 -32
  106. package/esm2022/lib/charts/scatter-chart.component.mjs +0 -32
  107. package/esm2022/lib/charts/tree-chart.component.mjs +0 -32
  108. package/esm2022/lib/charts/treemap-chart.component.mjs +0 -32
  109. package/esm2022/lib/charts/wordcloud-chart.component.mjs +0 -32
  110. package/esm2022/lib/diagrams/config.mjs +0 -2
  111. package/esm2022/lib/diagrams/edges/edge.component.mjs +0 -73
  112. package/esm2022/lib/diagrams/edges/edge.module.mjs +0 -20
  113. package/esm2022/lib/diagrams/edges/marker/marker.component.mjs +0 -161
  114. package/esm2022/lib/diagrams/edges/marker/marker.module.mjs +0 -48
  115. package/esm2022/lib/diagrams/index.mjs +0 -5
  116. package/esm2022/lib/diagrams/nodes/cards/card-node-column.component.mjs +0 -38
  117. package/esm2022/lib/diagrams/nodes/cards/card-node-label.component.mjs +0 -28
  118. package/esm2022/lib/diagrams/nodes/cards/card-node-subtitle.component.mjs +0 -28
  119. package/esm2022/lib/diagrams/nodes/cards/card-node-title.component.mjs +0 -28
  120. package/esm2022/lib/diagrams/nodes/cards/card-node.component.mjs +0 -191
  121. package/esm2022/lib/diagrams/nodes/cards/card-node.module.mjs +0 -44
  122. package/esm2022/lib/diagrams/nodes/shape/shape-node.component.mjs +0 -241
  123. package/esm2022/lib/diagrams/nodes/shape/shape-node.module.mjs +0 -20
  124. package/esm2022/lib/index.mjs +0 -3
  125. package/fesm2022/carbon-charts-angular.mjs +0 -1728
  126. package/fesm2022/carbon-charts-angular.mjs.map +0 -1
  127. package/index.d.ts +0 -5
  128. package/lib/charts/alluvial-chart.component.d.ts +0 -16
  129. package/lib/charts/area-chart-stacked.component.d.ts +0 -16
  130. package/lib/charts/area-chart.component.d.ts +0 -16
  131. package/lib/charts/bar-chart-grouped.component.d.ts +0 -16
  132. package/lib/charts/bar-chart-simple.component.d.ts +0 -16
  133. package/lib/charts/bar-chart-stacked.component.d.ts +0 -16
  134. package/lib/charts/base-chart.component.d.ts +0 -46
  135. package/lib/charts/boxplot-chart.component.d.ts +0 -16
  136. package/lib/charts/bubble-chart.component.d.ts +0 -16
  137. package/lib/charts/bullet-chart.component.d.ts +0 -16
  138. package/lib/charts/charts.module.d.ts +0 -33
  139. package/lib/charts/choropleth.component.d.ts +0 -16
  140. package/lib/charts/circle-pack-chart.component.d.ts +0 -16
  141. package/lib/charts/combo-chart.component.d.ts +0 -16
  142. package/lib/charts/donut-chart.component.d.ts +0 -16
  143. package/lib/charts/gauge-chart.component.d.ts +0 -16
  144. package/lib/charts/heatmap-chart.component.d.ts +0 -16
  145. package/lib/charts/histogram-chart.component.d.ts +0 -16
  146. package/lib/charts/line-chart.component.d.ts +0 -16
  147. package/lib/charts/lollipop-chart.component.d.ts +0 -16
  148. package/lib/charts/meter-chart.component.d.ts +0 -16
  149. package/lib/charts/pie-chart.component.d.ts +0 -16
  150. package/lib/charts/radar-chart.component.d.ts +0 -16
  151. package/lib/charts/scatter-chart.component.d.ts +0 -16
  152. package/lib/charts/tree-chart.component.d.ts +0 -16
  153. package/lib/charts/treemap-chart.component.d.ts +0 -16
  154. package/lib/charts/wordcloud-chart.component.d.ts +0 -16
  155. package/lib/diagrams/config.d.ts +0 -1
  156. package/lib/diagrams/edges/edge.component.d.ts +0 -20
  157. package/lib/diagrams/edges/edge.module.d.ts +0 -9
  158. package/lib/diagrams/edges/marker/marker.component.d.ts +0 -52
  159. package/lib/diagrams/edges/marker/marker.module.d.ts +0 -10
  160. package/lib/diagrams/index.d.ts +0 -4
  161. package/lib/diagrams/nodes/cards/card-node-column.component.d.ts +0 -7
  162. package/lib/diagrams/nodes/cards/card-node-label.component.d.ts +0 -6
  163. package/lib/diagrams/nodes/cards/card-node-subtitle.component.d.ts +0 -6
  164. package/lib/diagrams/nodes/cards/card-node-title.component.d.ts +0 -6
  165. package/lib/diagrams/nodes/cards/card-node.component.d.ts +0 -20
  166. package/lib/diagrams/nodes/cards/card-node.module.d.ts +0 -18
  167. package/lib/diagrams/nodes/shape/shape-node.component.d.ts +0 -25
  168. package/lib/diagrams/nodes/shape/shape-node.module.d.ts +0 -9
  169. package/lib/index.d.ts +0 -2
  170. package/styles.css +0 -28264
  171. package/styles.css.map +0 -1
  172. package/styles.min.css +0 -1
  173. package/styles.min.css.map +0 -1
package/package.json CHANGED
@@ -1,19 +1,30 @@
1
1
  {
2
2
  "name": "@carbon/charts-angular",
3
- "version": "1.9.0-rc.1",
3
+ "version": "1.9.0-rc.3",
4
4
  "description": "Carbon charting components for Angular",
5
5
  "exports": {
6
6
  "./styles.min.css": "./dist/styles.min.css",
7
- "./styles.css": "./dist/styles.css",
8
- "./package.json": {
9
- "default": "./package.json"
10
- },
11
- ".": {
12
- "types": "./index.d.ts",
13
- "esm2022": "./esm2022/carbon-charts-angular.mjs",
14
- "esm": "./esm2022/carbon-charts-angular.mjs",
15
- "default": "./fesm2022/carbon-charts-angular.mjs"
16
- }
7
+ "./styles.css": "./dist/styles.css"
8
+ },
9
+ "scripts": {
10
+ "ng": "ng",
11
+ "postinstall": "carbon-telemetry collect --install",
12
+ "file:md": "cp *.md dist",
13
+ "file:styles": "cp ../core/dist/styles.* dist",
14
+ "postbundle": "concurrently \"yarn:file:*\"",
15
+ "build:package:vite": "vite build && yarn postbundle",
16
+ "build:package": "ng build && yarn postbundle",
17
+ "demo:mdx:angular": "cp ../core/src/stories/getting-started/angular.stories.mdx src/stories",
18
+ "demo:mdx:tutorials": "cp ../core/src/stories/tutorials/* src/stories",
19
+ "demo:mdx": "concurrently \"yarn:demo:mdx:*\"",
20
+ "build:demo": "yarn demo:mdx && ng run charts-angular:build-storybook",
21
+ "build": "yarn build:package && yarn build:demo",
22
+ "storybook": "ng run charts-angular:storybook",
23
+ "start": "yarn storybook",
24
+ "lint:angular": "ng lint --ignore-path ../../.eslintignore",
25
+ "lint": "eslint . --ignore-path ../../.eslintignore",
26
+ "format": "prettier --write src/ --ignore-path ../../.eslintignore",
27
+ "clean": "rm -rf dist demo/bundle"
17
28
  },
18
29
  "peerDependencies": {
19
30
  "@angular/common": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
@@ -22,11 +33,57 @@
22
33
  "dependencies": {
23
34
  "@angular/common": "^16.0.4",
24
35
  "@angular/core": "^16.0.4",
25
- "@carbon/charts": "workspace:*",
36
+ "@carbon/charts": "1.9.0-rc.3",
26
37
  "@carbon/icons-angular": "^11.2.2",
27
38
  "@carbon/telemetry": "~0.1.0",
28
39
  "tslib": "^2.5.3"
29
40
  },
41
+ "devDependencies": {
42
+ "@angular-devkit/build-angular": "^16.0.4",
43
+ "@angular-eslint/builder": "16.0.3",
44
+ "@angular-eslint/eslint-plugin": "16.0.3",
45
+ "@angular-eslint/eslint-plugin-template": "16.0.3",
46
+ "@angular-eslint/schematics": "16.0.3",
47
+ "@angular-eslint/template-parser": "16.0.3",
48
+ "@angular/animations": "^16.0.4",
49
+ "@angular/cli": "^16.0.4",
50
+ "@angular/compiler": "^16.0.4",
51
+ "@angular/compiler-cli": "^16.0.4",
52
+ "@angular/forms": "^16.0.4",
53
+ "@angular/platform-browser": "^16.0.4",
54
+ "@angular/platform-browser-dynamic": "^16.0.4",
55
+ "@babel/core": "^7.22.1",
56
+ "@stackblitz/sdk": "^1.9.0",
57
+ "@storybook/addon-essentials": "^7.1.0-0",
58
+ "@storybook/addon-interactions": "^7.1.0-0",
59
+ "@storybook/addon-links": "^7.1.0-0",
60
+ "@storybook/angular": "^7.1.0-0",
61
+ "@storybook/blocks": "^7.1.0-0",
62
+ "@storybook/manager-api": "^7.1.0-0",
63
+ "@storybook/testing-library": "^0.1.0",
64
+ "@storybook/theming": "^7.1.0-0",
65
+ "@typescript-eslint/eslint-plugin": "^5.59.9",
66
+ "@typescript-eslint/parser": "^5.59.9",
67
+ "concurrently": "^8.1.0",
68
+ "eslint": "^8.42.0",
69
+ "eslint-config-prettier": "^8.8.0",
70
+ "eslint-plugin-prettier": "4.2.1",
71
+ "eslint-plugin-storybook": "^0.6.12",
72
+ "ng-packagr": "^16.0.1",
73
+ "prettier": "^2.8.8",
74
+ "prettier-eslint": "^15.0.1",
75
+ "react": "^18.2.0",
76
+ "react-dom": "^18.2.0",
77
+ "rxjs": "~7.8.1",
78
+ "storybook": "^7.1.0-0",
79
+ "style-loader": "3.3.3",
80
+ "typescript": "~5.0.4",
81
+ "vite": "^4.3.9",
82
+ "vite-plugin-dts": "^2.3.0",
83
+ "webpack": "5.85.1",
84
+ "zone.js": "~0.13.0"
85
+ },
86
+ "prettier": "../../prettier.config.cjs",
30
87
  "publishConfig": {
31
88
  "directory": "dist",
32
89
  "access": "public"
@@ -74,8 +131,5 @@
74
131
  "email": "iliadm@ca.ibm.com",
75
132
  "url": "https://github.com/theiliad"
76
133
  }
77
- ],
78
- "module": "fesm2022/carbon-charts-angular.mjs",
79
- "typings": "index.d.ts",
80
- "sideEffects": false
81
- }
134
+ ]
135
+ }
package/src/index.ts ADDED
@@ -0,0 +1,53 @@
1
+ /*
2
+ * Public API Surface of charts-angular
3
+ */
4
+
5
+ export {
6
+ // charts
7
+ AlluvialChartComponent,
8
+ AreaChartComponent,
9
+ BaseChartComponent,
10
+ BoxplotChartComponent,
11
+ BubbleChartComponent,
12
+ BulletChartComponent,
13
+ ChartsModule, // <-- Module
14
+ CirclePackChartComponent,
15
+ ComboChartComponent,
16
+ DonutChartComponent,
17
+ ExperimentalChoroplethChartComponent,
18
+ GaugeChartComponent,
19
+ GroupedBarChartComponent,
20
+ HeatmapChartComponent,
21
+ HistogramChartComponent,
22
+ LineChartComponent,
23
+ LollipopChartComponent,
24
+ MeterChartComponent,
25
+ PieChartComponent,
26
+ RadarChartComponent,
27
+ ScatterChartComponent,
28
+ SimpleBarChartComponent,
29
+ StackedAreaChartComponent,
30
+ StackedBarChartComponent,
31
+ TreeChartComponent,
32
+ TreemapChartComponent,
33
+ WordCloudChartComponent,
34
+ // diagrams
35
+ CardNodeColumnComponent,
36
+ CardNodeComponent,
37
+ CardNodeLabelComponent,
38
+ CardNodeSubtitleComponent,
39
+ CardNodeTitleComponent,
40
+ CardNodeModule, // <-- Module
41
+ EdgeComponent,
42
+ EdgeModule, // <-- Module
43
+ MarkerArrowLeftComponent,
44
+ MarkerArrowRightComponent,
45
+ MarkerComponent,
46
+ MarkerDiamondComponent,
47
+ MarkerModule, // <-- Module
48
+ MarkerShapeNodeComponent,
49
+ MarkerSquareComponent,
50
+ MarkerTeeComponent,
51
+ ShapeNodeComponent,
52
+ ShapeNodeModule // <-- Module
53
+ } from './lib'
@@ -0,0 +1,30 @@
1
+ import { Component, AfterViewInit } from '@angular/core'
2
+ import { BaseChartComponent } from './base-chart.component'
3
+ import {
4
+ AlluvialChart as AlluvialChartCore,
5
+ type AlluvialChartOptions,
6
+ type ChartTabularData
7
+ } from '@carbon/charts'
8
+
9
+ /**
10
+ * Wrapper around `Alluvial` in carbon charts library
11
+ *
12
+ * Most functions just call their equivalent from the chart library.
13
+ */
14
+ @Component({
15
+ selector: 'ibm-alluvial-chart',
16
+ template: ``
17
+ })
18
+ export class AlluvialChartComponent extends BaseChartComponent implements AfterViewInit {
19
+ /**
20
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
21
+ */
22
+ override ngAfterViewInit() {
23
+ this.chart = new AlluvialChartCore(this.elementRef.nativeElement, {
24
+ data: this.data as ChartTabularData,
25
+ options: this.options as AlluvialChartOptions
26
+ })
27
+
28
+ Object.assign(this, this.chart)
29
+ }
30
+ }
@@ -0,0 +1,30 @@
1
+ import { Component, AfterViewInit } from '@angular/core'
2
+ import { BaseChartComponent } from './base-chart.component'
3
+ import {
4
+ StackedAreaChart as StackedAreaChartCore,
5
+ type StackedAreaChartOptions,
6
+ type ChartTabularData
7
+ } from '@carbon/charts'
8
+
9
+ /**
10
+ * Wrapper around `StackedAreaChart` in carbon charts library
11
+ *
12
+ * Most functions just call their equivalent from the chart library.
13
+ */
14
+ @Component({
15
+ selector: 'ibm-stacked-area-chart',
16
+ template: ``
17
+ })
18
+ export class StackedAreaChartComponent extends BaseChartComponent implements AfterViewInit {
19
+ /**
20
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
21
+ */
22
+ override ngAfterViewInit() {
23
+ this.chart = new StackedAreaChartCore(this.elementRef.nativeElement, {
24
+ data: this.data as ChartTabularData,
25
+ options: this.options as StackedAreaChartOptions
26
+ })
27
+
28
+ Object.assign(this, this.chart)
29
+ }
30
+ }
@@ -0,0 +1,30 @@
1
+ import { Component, AfterViewInit } from '@angular/core'
2
+ import { BaseChartComponent } from './base-chart.component'
3
+ import {
4
+ AreaChart as AreaChartCore,
5
+ type AreaChartOptions,
6
+ type ChartTabularData
7
+ } from '@carbon/charts'
8
+
9
+ /**
10
+ * Wrapper around `AreaChart` in carbon charts library
11
+ *
12
+ * Most functions just call their equivalent from the chart library.
13
+ */
14
+ @Component({
15
+ selector: 'ibm-area-chart',
16
+ template: ``
17
+ })
18
+ export class AreaChartComponent extends BaseChartComponent implements AfterViewInit {
19
+ /**
20
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
21
+ */
22
+ override ngAfterViewInit() {
23
+ this.chart = new AreaChartCore(this.elementRef.nativeElement, {
24
+ data: this.data as ChartTabularData,
25
+ options: this.options as AreaChartOptions
26
+ })
27
+
28
+ Object.assign(this, this.chart)
29
+ }
30
+ }
@@ -0,0 +1,30 @@
1
+ import { Component, AfterViewInit } from '@angular/core'
2
+ import { BaseChartComponent } from './base-chart.component'
3
+ import {
4
+ GroupedBarChart as GroupedBarChartCore,
5
+ type ChartTabularData,
6
+ type BarChartOptions
7
+ } from '@carbon/charts'
8
+
9
+ /**
10
+ * Wrapper around `GroupedBarChart` in carbon charts library
11
+ *
12
+ * Most functions just call their equivalent from the chart library.
13
+ */
14
+ @Component({
15
+ selector: 'ibm-grouped-bar-chart',
16
+ template: ``
17
+ })
18
+ export class GroupedBarChartComponent extends BaseChartComponent implements AfterViewInit {
19
+ /**
20
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
21
+ */
22
+ override ngAfterViewInit() {
23
+ this.chart = new GroupedBarChartCore(this.elementRef.nativeElement, {
24
+ data: this.data as ChartTabularData,
25
+ options: this.options as BarChartOptions
26
+ })
27
+
28
+ Object.assign(this, this.chart)
29
+ }
30
+ }
@@ -0,0 +1,30 @@
1
+ import { Component, AfterViewInit } from '@angular/core'
2
+ import { BaseChartComponent } from './base-chart.component'
3
+ import {
4
+ SimpleBarChart as SimpleBarChartCore,
5
+ type ChartTabularData,
6
+ type BarChartOptions
7
+ } from '@carbon/charts'
8
+
9
+ /**
10
+ * Wrapper around `SimpleBarChart` in carbon charts library
11
+ *
12
+ * Most functions just call their equivalent from the chart library.
13
+ */
14
+ @Component({
15
+ selector: 'ibm-simple-bar-chart',
16
+ template: ``
17
+ })
18
+ export class SimpleBarChartComponent extends BaseChartComponent implements AfterViewInit {
19
+ /**
20
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
21
+ */
22
+ override ngAfterViewInit() {
23
+ this.chart = new SimpleBarChartCore(this.elementRef.nativeElement, {
24
+ data: this.data as ChartTabularData,
25
+ options: this.options as BarChartOptions
26
+ })
27
+
28
+ Object.assign(this, this.chart)
29
+ }
30
+ }
@@ -0,0 +1,30 @@
1
+ import { Component, AfterViewInit } from '@angular/core'
2
+ import { BaseChartComponent } from './base-chart.component'
3
+ import {
4
+ StackedBarChart as StackedBarChartCore,
5
+ type ChartTabularData,
6
+ type StackedBarChartOptions
7
+ } from '@carbon/charts'
8
+
9
+ /**
10
+ * Wrapper around `StackedBarChart` in carbon charts library
11
+ *
12
+ * Most functions just call their equivalent from the chart library.
13
+ */
14
+ @Component({
15
+ selector: 'ibm-stacked-bar-chart',
16
+ template: ``
17
+ })
18
+ export class StackedBarChartComponent extends BaseChartComponent implements AfterViewInit {
19
+ /**
20
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
21
+ */
22
+ override ngAfterViewInit() {
23
+ this.chart = new StackedBarChartCore(this.elementRef.nativeElement, {
24
+ data: this.data as ChartTabularData,
25
+ options: this.options as StackedBarChartOptions
26
+ })
27
+
28
+ Object.assign(this, this.chart)
29
+ }
30
+ }
@@ -0,0 +1,91 @@
1
+ import { Component, Input, OnInit, AfterViewInit, ElementRef } from '@angular/core'
2
+ import type { BaseChartOptions, ChartTabularData, Charts } from '@carbon/charts'
3
+
4
+ /**
5
+ * Wrapper around `BaseChart` in carbon charts library
6
+ *
7
+ * Most functions just call their equivalent from the chart library.
8
+ */
9
+ @Component({
10
+ selector: 'ibm-base-chart',
11
+ template: ``
12
+ })
13
+ export class BaseChartComponent implements AfterViewInit, OnInit {
14
+ /**
15
+ * Data passed to charts library for displaying
16
+ */
17
+ @Input() set data(newData: ChartTabularData) {
18
+ // If data already exists, that means the chart has been initialized
19
+ const dataExistsAlready = !!this._data
20
+
21
+ this._data = newData
22
+
23
+ if (dataExistsAlready) {
24
+ this.chart?.model.setData(newData)
25
+ }
26
+ }
27
+
28
+ get data(): ChartTabularData {
29
+ return this._data
30
+ }
31
+
32
+ /**
33
+ * Options passed to charts library
34
+ */
35
+ @Input() set options(newOptions: BaseChartOptions) {
36
+ // If data already exists, that means the chart has been initialized
37
+ const optionsExistAlready = !!this._options
38
+
39
+ this._options = newOptions
40
+
41
+ if (optionsExistAlready) {
42
+ this.chart?.model.setOptions(newOptions)
43
+ }
44
+ }
45
+
46
+ get options() {
47
+ return this._options
48
+ }
49
+
50
+ /**
51
+ * Chart width
52
+ */
53
+ @Input() width?: string
54
+
55
+ /**
56
+ * Chart height
57
+ */
58
+ @Input() height?: string
59
+
60
+ /**
61
+ * Chart object instance
62
+ *
63
+ * You can use this to do whatever you would normally do with a chart if you used
64
+ * charts library directly.
65
+ */
66
+ chart!: Charts
67
+
68
+ private _data!: ChartTabularData
69
+ private _options!: BaseChartOptions
70
+
71
+ constructor(protected elementRef: ElementRef) {}
72
+
73
+ ngOnInit() {
74
+ // Width prop is mandatory for the wrappers
75
+ if (this.width) {
76
+ this.options.width = this.width
77
+ }
78
+
79
+ // Height prop is mandatory for the wrappers
80
+ if (this.height) {
81
+ this.options.height = this.height
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
87
+ */
88
+ ngAfterViewInit() {
89
+ console.log('Class that extended BaseChartComponent did not implement ngAfterViewInit().')
90
+ }
91
+ }
@@ -0,0 +1,30 @@
1
+ import { Component, AfterViewInit } from '@angular/core'
2
+ import { BaseChartComponent } from './base-chart.component'
3
+ import {
4
+ BoxplotChart as BoxplotChartCore,
5
+ type ChartTabularData,
6
+ type BoxplotChartOptions
7
+ } from '@carbon/charts'
8
+
9
+ /**
10
+ * Wrapper around `BoxplotChart` in carbon charts library
11
+ *
12
+ * Most functions just call their equivalent from the chart library.
13
+ */
14
+ @Component({
15
+ selector: 'ibm-boxplot-chart',
16
+ template: ``
17
+ })
18
+ export class BoxplotChartComponent extends BaseChartComponent implements AfterViewInit {
19
+ /**
20
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
21
+ */
22
+ override ngAfterViewInit() {
23
+ this.chart = new BoxplotChartCore(this.elementRef.nativeElement, {
24
+ data: this.data as ChartTabularData,
25
+ options: this.options as BoxplotChartOptions
26
+ })
27
+
28
+ Object.assign(this, this.chart)
29
+ }
30
+ }
@@ -0,0 +1,30 @@
1
+ import { Component, AfterViewInit } from '@angular/core'
2
+ import { BaseChartComponent } from './base-chart.component'
3
+ import {
4
+ BubbleChart as BubbleChartCore,
5
+ type BubbleChartOptions,
6
+ type ChartTabularData
7
+ } from '@carbon/charts'
8
+
9
+ /**
10
+ * Wrapper around `BubbleChart` in carbon charts library
11
+ *
12
+ * Most functions just call their equivalent from the chart library.
13
+ */
14
+ @Component({
15
+ selector: 'ibm-bubble-chart',
16
+ template: ``
17
+ })
18
+ export class BubbleChartComponent extends BaseChartComponent implements AfterViewInit {
19
+ /**
20
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
21
+ */
22
+ override ngAfterViewInit() {
23
+ this.chart = new BubbleChartCore(this.elementRef.nativeElement, {
24
+ data: this.data as ChartTabularData,
25
+ options: this.options as BubbleChartOptions
26
+ })
27
+
28
+ Object.assign(this, this.chart)
29
+ }
30
+ }
@@ -0,0 +1,30 @@
1
+ import { Component, AfterViewInit } from '@angular/core'
2
+ import { BaseChartComponent } from './base-chart.component'
3
+ import {
4
+ BulletChart as BulletChartCore,
5
+ type BulletChartOptions,
6
+ type ChartTabularData
7
+ } from '@carbon/charts'
8
+
9
+ /**
10
+ * Wrapper around `BulletChart` in carbon charts library
11
+ *
12
+ * Most functions just call their equivalent from the chart library.
13
+ */
14
+ @Component({
15
+ selector: 'ibm-bullet-chart',
16
+ template: ``
17
+ })
18
+ export class BulletChartComponent extends BaseChartComponent implements AfterViewInit {
19
+ /**
20
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
21
+ */
22
+ override ngAfterViewInit() {
23
+ this.chart = new BulletChartCore(this.elementRef.nativeElement, {
24
+ data: this.data as ChartTabularData,
25
+ options: this.options as BulletChartOptions
26
+ })
27
+
28
+ Object.assign(this, this.chart)
29
+ }
30
+ }
@@ -0,0 +1,92 @@
1
+ import { NgModule } from '@angular/core'
2
+ import { CommonModule } from '@angular/common'
3
+
4
+ import {
5
+ AlluvialChartComponent,
6
+ AreaChartComponent,
7
+ BaseChartComponent,
8
+ BoxplotChartComponent,
9
+ BubbleChartComponent,
10
+ BulletChartComponent,
11
+ CirclePackChartComponent,
12
+ ComboChartComponent,
13
+ DonutChartComponent,
14
+ ExperimentalChoroplethChartComponent,
15
+ GaugeChartComponent,
16
+ GroupedBarChartComponent,
17
+ HeatmapChartComponent,
18
+ HistogramChartComponent,
19
+ LineChartComponent,
20
+ LollipopChartComponent,
21
+ MeterChartComponent,
22
+ PieChartComponent,
23
+ RadarChartComponent,
24
+ ScatterChartComponent,
25
+ SimpleBarChartComponent,
26
+ StackedAreaChartComponent,
27
+ StackedBarChartComponent,
28
+ TreeChartComponent,
29
+ TreemapChartComponent,
30
+ WordCloudChartComponent
31
+ } from './index'
32
+
33
+ @NgModule({
34
+ declarations: [
35
+ BaseChartComponent,
36
+ AlluvialChartComponent,
37
+ AreaChartComponent,
38
+ StackedAreaChartComponent,
39
+ SimpleBarChartComponent,
40
+ GroupedBarChartComponent,
41
+ StackedBarChartComponent,
42
+ BoxplotChartComponent,
43
+ BubbleChartComponent,
44
+ BulletChartComponent,
45
+ DonutChartComponent,
46
+ ExperimentalChoroplethChartComponent,
47
+ GaugeChartComponent,
48
+ HeatmapChartComponent,
49
+ HistogramChartComponent,
50
+ LineChartComponent,
51
+ LollipopChartComponent,
52
+ PieChartComponent,
53
+ ScatterChartComponent,
54
+ MeterChartComponent,
55
+ RadarChartComponent,
56
+ ComboChartComponent,
57
+ TreeChartComponent,
58
+ TreemapChartComponent,
59
+ CirclePackChartComponent,
60
+ WordCloudChartComponent
61
+ ],
62
+ imports: [CommonModule],
63
+ exports: [
64
+ BaseChartComponent,
65
+ AlluvialChartComponent,
66
+ AreaChartComponent,
67
+ StackedAreaChartComponent,
68
+ SimpleBarChartComponent,
69
+ GroupedBarChartComponent,
70
+ StackedBarChartComponent,
71
+ BoxplotChartComponent,
72
+ BubbleChartComponent,
73
+ BulletChartComponent,
74
+ DonutChartComponent,
75
+ ExperimentalChoroplethChartComponent,
76
+ GaugeChartComponent,
77
+ HeatmapChartComponent,
78
+ HistogramChartComponent,
79
+ LineChartComponent,
80
+ LollipopChartComponent,
81
+ PieChartComponent,
82
+ ScatterChartComponent,
83
+ MeterChartComponent,
84
+ RadarChartComponent,
85
+ ComboChartComponent,
86
+ TreeChartComponent,
87
+ TreemapChartComponent,
88
+ CirclePackChartComponent,
89
+ WordCloudChartComponent
90
+ ]
91
+ })
92
+ export class ChartsModule {}
@@ -0,0 +1,33 @@
1
+ import { Component, AfterViewInit } from '@angular/core'
2
+ import { BaseChartComponent } from './base-chart.component'
3
+ import {
4
+ ExperimentalChoroplethChart as ChoroplethChartCore,
5
+ type ChoroplethChartOptions,
6
+ type ChartTabularData
7
+ } from '@carbon/charts'
8
+
9
+ /**
10
+ * Wrapper around `Choropleth` in carbon charts library
11
+ *
12
+ * Most functions just call their equivalent from the chart library.
13
+ */
14
+ @Component({
15
+ selector: 'ibm-experimental-choropleth-chart',
16
+ template: ``
17
+ })
18
+ export class ExperimentalChoroplethChartComponent
19
+ extends BaseChartComponent
20
+ implements AfterViewInit
21
+ {
22
+ /**
23
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
24
+ */
25
+ override ngAfterViewInit() {
26
+ this.chart = new ChoroplethChartCore(this.elementRef.nativeElement, {
27
+ data: this.data as ChartTabularData,
28
+ options: this.options as ChoroplethChartOptions
29
+ })
30
+
31
+ Object.assign(this, this.chart)
32
+ }
33
+ }