@carbon/charts-angular 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.
Files changed (213) hide show
  1. package/.storybook/addons.js +2 -0
  2. package/.storybook/assets/logo.svg +1 -0
  3. package/.storybook/assets/share.png +0 -0
  4. package/.storybook/assets/welcome.png +0 -0
  5. package/.storybook/config.js +22 -0
  6. package/.storybook/manager-head.html +45 -0
  7. package/.storybook/preview-head.html +10 -0
  8. package/.storybook/tsconfig.json +10 -0
  9. package/angular.json +68 -0
  10. package/build.sh +13 -0
  11. package/carbon.yml +275 -0
  12. package/dist/CHANGELOG.md +3168 -0
  13. package/dist/README.md +40 -0
  14. package/{alluvial-chart.component.d.ts → dist/alluvial-chart.component.d.ts} +0 -0
  15. package/{area-chart-stacked.component.d.ts → dist/area-chart-stacked.component.d.ts} +0 -0
  16. package/{area-chart.component.d.ts → dist/area-chart.component.d.ts} +0 -0
  17. package/{bar-chart-grouped.component.d.ts → dist/bar-chart-grouped.component.d.ts} +0 -0
  18. package/{bar-chart-simple.component.d.ts → dist/bar-chart-simple.component.d.ts} +0 -0
  19. package/{bar-chart-stacked.component.d.ts → dist/bar-chart-stacked.component.d.ts} +0 -0
  20. package/{base-chart.component.d.ts → dist/base-chart.component.d.ts} +0 -0
  21. package/{boxplot-chart.component.d.ts → dist/boxplot-chart.component.d.ts} +0 -0
  22. package/{bubble-chart.component.d.ts → dist/bubble-chart.component.d.ts} +0 -0
  23. package/{bullet-chart.component.d.ts → dist/bullet-chart.component.d.ts} +0 -0
  24. package/{bundles → dist/bundles}/carbon-charts-angular.umd.js +21 -23
  25. package/dist/bundles/carbon-charts-angular.umd.js.map +1 -0
  26. package/dist/bundles/carbon-charts-angular.umd.min.js +16 -0
  27. package/dist/bundles/carbon-charts-angular.umd.min.js.map +1 -0
  28. package/{carbon-charts-angular.d.ts → dist/carbon-charts-angular.d.ts} +0 -0
  29. package/{carbon-charts-angular.metadata.json → dist/carbon-charts-angular.metadata.json} +1 -1
  30. package/{charts.module.d.ts → dist/charts.module.d.ts} +0 -0
  31. package/{circle-pack-chart.component.d.ts → dist/circle-pack-chart.component.d.ts} +0 -0
  32. package/{combo-chart.component.d.ts → dist/combo-chart.component.d.ts} +0 -0
  33. package/{diagrams → dist/diagrams}/card-node/card-node-column.component.d.ts +0 -0
  34. package/{diagrams → dist/diagrams}/card-node/card-node-label.component.d.ts +0 -0
  35. package/{diagrams → dist/diagrams}/card-node/card-node-subtitle.component.d.ts +0 -0
  36. package/{diagrams → dist/diagrams}/card-node/card-node-title.component.d.ts +0 -0
  37. package/{diagrams → dist/diagrams}/card-node/card-node.component.d.ts +0 -0
  38. package/{diagrams → dist/diagrams}/card-node/card-node.module.d.ts +0 -0
  39. package/dist/diagrams/configs.d.ts +1 -0
  40. package/{diagrams → dist/diagrams}/edge/edge.component.d.ts +0 -0
  41. package/{diagrams → dist/diagrams}/edge/edge.module.d.ts +0 -0
  42. package/{diagrams → dist/diagrams}/marker/marker.component.d.ts +0 -0
  43. package/{diagrams → dist/diagrams}/marker/marker.module.d.ts +0 -0
  44. package/{diagrams → dist/diagrams}/shape-node/shape-node.component.d.ts +0 -0
  45. package/{diagrams → dist/diagrams}/shape-node/shape-node.module.d.ts +0 -0
  46. package/{donut-chart.component.d.ts → dist/donut-chart.component.d.ts} +0 -0
  47. package/{esm2015 → dist/esm2015}/alluvial-chart.component.js +0 -0
  48. package/{esm2015 → dist/esm2015}/area-chart-stacked.component.js +0 -0
  49. package/{esm2015 → dist/esm2015}/area-chart.component.js +0 -0
  50. package/{esm2015 → dist/esm2015}/bar-chart-grouped.component.js +0 -0
  51. package/{esm2015 → dist/esm2015}/bar-chart-simple.component.js +0 -0
  52. package/{esm2015 → dist/esm2015}/bar-chart-stacked.component.js +0 -0
  53. package/{esm2015 → dist/esm2015}/base-chart.component.js +0 -0
  54. package/{esm2015 → dist/esm2015}/boxplot-chart.component.js +0 -0
  55. package/{esm2015 → dist/esm2015}/bubble-chart.component.js +0 -0
  56. package/{esm2015 → dist/esm2015}/bullet-chart.component.js +0 -0
  57. package/{esm2015 → dist/esm2015}/carbon-charts-angular.js +0 -0
  58. package/{esm2015 → dist/esm2015}/charts.module.js +0 -0
  59. package/{esm2015 → dist/esm2015}/circle-pack-chart.component.js +0 -0
  60. package/{esm2015 → dist/esm2015}/combo-chart.component.js +0 -0
  61. package/dist/esm2015/diagrams/card-node/card-node-column.component.js +41 -0
  62. package/dist/esm2015/diagrams/card-node/card-node-label.component.js +27 -0
  63. package/dist/esm2015/diagrams/card-node/card-node-subtitle.component.js +27 -0
  64. package/dist/esm2015/diagrams/card-node/card-node-title.component.js +27 -0
  65. package/dist/esm2015/diagrams/card-node/card-node.component.js +148 -0
  66. package/{esm2015 → dist/esm2015}/diagrams/card-node/card-node.module.js +0 -0
  67. package/dist/esm2015/diagrams/configs.js +8 -0
  68. package/dist/esm2015/diagrams/edge/edge.component.js +80 -0
  69. package/{esm2015 → dist/esm2015}/diagrams/edge/edge.module.js +0 -0
  70. package/dist/esm2015/diagrams/marker/marker.component.js +141 -0
  71. package/{esm2015 → dist/esm2015}/diagrams/marker/marker.module.js +0 -0
  72. package/dist/esm2015/diagrams/shape-node/shape-node.component.js +187 -0
  73. package/{esm2015 → dist/esm2015}/diagrams/shape-node/shape-node.module.js +0 -0
  74. package/{esm2015 → dist/esm2015}/donut-chart.component.js +0 -0
  75. package/{esm2015 → dist/esm2015}/gauge-chart.component.js +0 -0
  76. package/{esm2015 → dist/esm2015}/heatmap-chart.component.js +0 -0
  77. package/{esm2015 → dist/esm2015}/histogram-chart.component.js +0 -0
  78. package/{esm2015 → dist/esm2015}/index.js +0 -0
  79. package/{esm2015 → dist/esm2015}/line-chart.component.js +0 -0
  80. package/{esm2015 → dist/esm2015}/lollipop-chart.component.js +0 -0
  81. package/{esm2015 → dist/esm2015}/meter-chart.component.js +0 -0
  82. package/{esm2015 → dist/esm2015}/pie-chart.component.js +0 -0
  83. package/{esm2015 → dist/esm2015}/radar-chart.component.js +0 -0
  84. package/{esm2015 → dist/esm2015}/scatter-chart.component.js +0 -0
  85. package/{esm2015 → dist/esm2015}/tree-chart.component.js +0 -0
  86. package/{esm2015 → dist/esm2015}/treemap-chart.component.js +0 -0
  87. package/{esm2015 → dist/esm2015}/wordcloud-chart.component.js +0 -0
  88. package/{esm5 → dist/esm5}/alluvial-chart.component.js +0 -0
  89. package/{esm5 → dist/esm5}/area-chart-stacked.component.js +0 -0
  90. package/{esm5 → dist/esm5}/area-chart.component.js +0 -0
  91. package/{esm5 → dist/esm5}/bar-chart-grouped.component.js +0 -0
  92. package/{esm5 → dist/esm5}/bar-chart-simple.component.js +0 -0
  93. package/{esm5 → dist/esm5}/bar-chart-stacked.component.js +0 -0
  94. package/{esm5 → dist/esm5}/base-chart.component.js +0 -0
  95. package/{esm5 → dist/esm5}/boxplot-chart.component.js +0 -0
  96. package/{esm5 → dist/esm5}/bubble-chart.component.js +0 -0
  97. package/{esm5 → dist/esm5}/bullet-chart.component.js +0 -0
  98. package/{esm5 → dist/esm5}/carbon-charts-angular.js +0 -0
  99. package/{esm5 → dist/esm5}/charts.module.js +0 -0
  100. package/{esm5 → dist/esm5}/circle-pack-chart.component.js +0 -0
  101. package/{esm5 → dist/esm5}/combo-chart.component.js +0 -0
  102. package/{esm5 → dist/esm5}/diagrams/card-node/card-node-column.component.js +4 -5
  103. package/{esm5 → dist/esm5}/diagrams/card-node/card-node-label.component.js +3 -4
  104. package/{esm5 → dist/esm5}/diagrams/card-node/card-node-subtitle.component.js +3 -4
  105. package/{esm5 → dist/esm5}/diagrams/card-node/card-node-title.component.js +3 -4
  106. package/dist/esm5/diagrams/card-node/card-node.component.js +86 -0
  107. package/{esm5 → dist/esm5}/diagrams/card-node/card-node.module.js +0 -0
  108. package/dist/esm5/diagrams/configs.js +8 -0
  109. package/dist/esm5/diagrams/edge/edge.component.js +64 -0
  110. package/{esm5 → dist/esm5}/diagrams/edge/edge.module.js +0 -0
  111. package/{esm5 → dist/esm5}/diagrams/marker/marker.component.js +3 -4
  112. package/{esm5 → dist/esm5}/diagrams/marker/marker.module.js +0 -0
  113. package/dist/esm5/diagrams/shape-node/shape-node.component.js +104 -0
  114. package/{esm5 → dist/esm5}/diagrams/shape-node/shape-node.module.js +0 -0
  115. package/{esm5 → dist/esm5}/donut-chart.component.js +0 -0
  116. package/{esm5 → dist/esm5}/gauge-chart.component.js +0 -0
  117. package/{esm5 → dist/esm5}/heatmap-chart.component.js +0 -0
  118. package/{esm5 → dist/esm5}/histogram-chart.component.js +0 -0
  119. package/{esm5 → dist/esm5}/index.js +0 -0
  120. package/{esm5 → dist/esm5}/line-chart.component.js +0 -0
  121. package/{esm5 → dist/esm5}/lollipop-chart.component.js +0 -0
  122. package/{esm5 → dist/esm5}/meter-chart.component.js +0 -0
  123. package/{esm5 → dist/esm5}/pie-chart.component.js +0 -0
  124. package/{esm5 → dist/esm5}/radar-chart.component.js +0 -0
  125. package/{esm5 → dist/esm5}/scatter-chart.component.js +0 -0
  126. package/{esm5 → dist/esm5}/tree-chart.component.js +0 -0
  127. package/{esm5 → dist/esm5}/treemap-chart.component.js +0 -0
  128. package/{esm5 → dist/esm5}/wordcloud-chart.component.js +0 -0
  129. package/{fesm2015 → dist/fesm2015}/carbon-charts-angular.js +17 -18
  130. package/dist/fesm2015/carbon-charts-angular.js.map +1 -0
  131. package/{fesm5 → dist/fesm5}/carbon-charts-angular.js +17 -18
  132. package/dist/fesm5/carbon-charts-angular.js.map +1 -0
  133. package/{gauge-chart.component.d.ts → dist/gauge-chart.component.d.ts} +0 -0
  134. package/{heatmap-chart.component.d.ts → dist/heatmap-chart.component.d.ts} +0 -0
  135. package/{histogram-chart.component.d.ts → dist/histogram-chart.component.d.ts} +0 -0
  136. package/{index.d.ts → dist/index.d.ts} +0 -0
  137. package/{line-chart.component.d.ts → dist/line-chart.component.d.ts} +0 -0
  138. package/{lollipop-chart.component.d.ts → dist/lollipop-chart.component.d.ts} +0 -0
  139. package/{meter-chart.component.d.ts → dist/meter-chart.component.d.ts} +0 -0
  140. package/dist/package.json +109 -0
  141. package/{pie-chart.component.d.ts → dist/pie-chart.component.d.ts} +0 -0
  142. package/{radar-chart.component.d.ts → dist/radar-chart.component.d.ts} +0 -0
  143. package/{scatter-chart.component.d.ts → dist/scatter-chart.component.d.ts} +0 -0
  144. package/{tree-chart.component.d.ts → dist/tree-chart.component.d.ts} +0 -0
  145. package/{treemap-chart.component.d.ts → dist/treemap-chart.component.d.ts} +0 -0
  146. package/{wordcloud-chart.component.d.ts → dist/wordcloud-chart.component.d.ts} +0 -0
  147. package/ng-package.json +8 -0
  148. package/package.json +103 -108
  149. package/src/alluvial-chart.component.ts +34 -0
  150. package/src/area-chart-stacked.component.ts +34 -0
  151. package/src/area-chart.component.ts +37 -0
  152. package/src/bar-chart-grouped.component.ts +34 -0
  153. package/src/bar-chart-simple.component.ts +34 -0
  154. package/src/bar-chart-stacked.component.ts +34 -0
  155. package/src/base-chart.component.ts +102 -0
  156. package/src/boxplot-chart.component.ts +34 -0
  157. package/src/bubble-chart.component.ts +34 -0
  158. package/src/bullet-chart.component.ts +34 -0
  159. package/src/charts.module.ts +87 -0
  160. package/src/circle-pack-chart.component.ts +34 -0
  161. package/src/combo-chart.component.ts +33 -0
  162. package/src/diagrams/card-node/card-node-column.component.ts +22 -0
  163. package/src/diagrams/card-node/card-node-label.component.ts +15 -0
  164. package/src/diagrams/card-node/card-node-subtitle.component.ts +15 -0
  165. package/src/diagrams/card-node/card-node-title.component.ts +15 -0
  166. package/src/diagrams/card-node/card-node.component.ts +100 -0
  167. package/src/diagrams/card-node/card-node.module.ts +18 -0
  168. package/src/diagrams/configs.ts +1 -0
  169. package/src/diagrams/edge/edge.component.ts +45 -0
  170. package/src/diagrams/edge/edge.module.ts +11 -0
  171. package/src/diagrams/marker/marker.component.ts +68 -0
  172. package/src/diagrams/marker/marker.module.ts +43 -0
  173. package/src/diagrams/shape-node/shape-node.component.ts +133 -0
  174. package/src/diagrams/shape-node/shape-node.module.ts +11 -0
  175. package/src/donut-chart.component.ts +34 -0
  176. package/src/gauge-chart.component.ts +34 -0
  177. package/src/heatmap-chart.component.ts +34 -0
  178. package/src/histogram-chart.component.ts +34 -0
  179. package/src/index.ts +44 -0
  180. package/src/line-chart.component.ts +34 -0
  181. package/src/lollipop-chart.component.ts +34 -0
  182. package/src/meter-chart.component.ts +33 -0
  183. package/src/pie-chart.component.ts +34 -0
  184. package/src/radar-chart.component.ts +34 -0
  185. package/src/scatter-chart.component.ts +34 -0
  186. package/src/tree-chart.component.ts +34 -0
  187. package/src/treemap-chart.component.ts +34 -0
  188. package/src/wordcloud-chart.component.ts +34 -0
  189. package/stories/all.stories.ts +99 -0
  190. package/stories/diagrams/0_diagram.stories.ts +224 -0
  191. package/stories/diagrams/card-node.stories.ts +181 -0
  192. package/stories/diagrams/edge.stories.ts +127 -0
  193. package/stories/diagrams/marker.stories.ts +140 -0
  194. package/stories/diagrams/shape-node.stories.ts +98 -0
  195. package/tsconfig.json +30 -0
  196. package/tslint.json +95 -0
  197. package/LICENSE.md +0 -201
  198. package/bundles/carbon-charts-angular.umd.js.map +0 -1
  199. package/bundles/carbon-charts-angular.umd.min.js +0 -17
  200. package/bundles/carbon-charts-angular.umd.min.js.map +0 -1
  201. package/esm2015/diagrams/card-node/card-node-column.component.js +0 -42
  202. package/esm2015/diagrams/card-node/card-node-label.component.js +0 -28
  203. package/esm2015/diagrams/card-node/card-node-subtitle.component.js +0 -28
  204. package/esm2015/diagrams/card-node/card-node-title.component.js +0 -28
  205. package/esm2015/diagrams/card-node/card-node.component.js +0 -149
  206. package/esm2015/diagrams/edge/edge.component.js +0 -81
  207. package/esm2015/diagrams/marker/marker.component.js +0 -142
  208. package/esm2015/diagrams/shape-node/shape-node.component.js +0 -188
  209. package/esm5/diagrams/card-node/card-node.component.js +0 -87
  210. package/esm5/diagrams/edge/edge.component.js +0 -65
  211. package/esm5/diagrams/shape-node/shape-node.component.js +0 -105
  212. package/fesm2015/carbon-charts-angular.js.map +0 -1
  213. package/fesm5/carbon-charts-angular.js.map +0 -1
@@ -0,0 +1,45 @@
1
+ import { Component, Input } from "@angular/core";
2
+ import { buildStraightPathString } from "@carbon/charts/components/diagrams/buildPaths";
3
+
4
+ import { carbonPrefix } from '../configs';
5
+
6
+ interface Coordinates {
7
+ x: number;
8
+ y: number;
9
+ }
10
+ @Component({
11
+ selector: "[ibm-graph-edge]",
12
+ template: `
13
+ <svg:g [ngClass]="[namespace, variant ? namespace + '--' + variant : '']">
14
+ <svg:path
15
+ [ngClass]="namespace + '__container'"
16
+ [attr.d]="path ? path : straight(source, target)"
17
+ />
18
+ <svg:path
19
+ [ngClass]="namespace + '__outer'"
20
+ [attr.d]="path ? path : straight(source, target)"
21
+ />
22
+ <svg:path
23
+ [ngClass]="namespace + '__inner'"
24
+ [attr.d]="path ? path : straight(source, target)"
25
+ [ngStyle]="{'stroke': color}"
26
+ [attr.marker-start]="markerStart ? 'url(#' + markerStart + ')' : ''"
27
+ [attr.marker-end]="markerEnd ? 'url(#' + markerEnd + ')' : ''"
28
+ />
29
+ </svg:g>
30
+ `
31
+ })
32
+
33
+ export class EdgeComponent {
34
+ @Input() color: string;
35
+ @Input() markerEnd: string;
36
+ @Input() markerStart: string;
37
+ @Input() source: Coordinates;
38
+ @Input() target: Coordinates;
39
+ @Input() variant: "dash-sm" | "dash-md" | "dash-lg" | "dash-xl" | "double" | "tunnel";
40
+ @Input() path: string;
41
+
42
+ pathClasses;
43
+ namespace = `${carbonPrefix}--cc--edge`;
44
+ straight = buildStraightPathString;
45
+ }
@@ -0,0 +1,11 @@
1
+ import { NgModule } from "@angular/core";
2
+ import { CommonModule } from "@angular/common";
3
+ import { EdgeComponent } from "./edge.component";
4
+ export { EdgeComponent } from "./edge.component";
5
+
6
+ @NgModule({
7
+ declarations: [EdgeComponent],
8
+ exports: [EdgeComponent],
9
+ imports: [CommonModule]
10
+ })
11
+ export class EdgeModule { }
@@ -0,0 +1,68 @@
1
+ import { Component, Input, OnInit } from "@angular/core";
2
+ import {
3
+ arrowLeft,
4
+ arrowRight,
5
+ circle,
6
+ diamond,
7
+ square,
8
+ tee,
9
+ } from "@carbon/charts/components/diagrams/markerDefinitions";
10
+
11
+ import { carbonPrefix } from '../configs';
12
+
13
+ const template = `
14
+ <svg:marker
15
+ [ngClass]="namespace"
16
+ [attr.markerHeight]="height"
17
+ [attr.markerWidth]="width"
18
+ [attr.orient]="orient"
19
+ [attr.id]="id"
20
+ [attr.refX]="refX"
21
+ [attr.refY]="refY"
22
+ markerUnits="userSpaceOnUse">
23
+ <svg:path [attr.d]="d" [ngStyle]="{'fill': color}" ></svg:path>
24
+ </svg:marker>
25
+ `;
26
+
27
+ @Component({
28
+ selector: "[ibm-graph-marker]",
29
+ template
30
+ })
31
+ export class MarkerComponent {
32
+ @Input() d: string;
33
+ @Input() color: string;
34
+ @Input() id: string;
35
+ @Input() orient: string | number = "auto";
36
+ @Input() height: string | number;
37
+ @Input() width: string | number;
38
+ @Input() refX: string | number;
39
+ @Input() refY: string | number;
40
+ @Input() position: "start" | "end" = "end";
41
+
42
+ namespace = `${carbonPrefix}--cc--marker`;
43
+
44
+ setAttributes = ({d, id, height, width}) => {
45
+ const xPos = (this.position === "end") ? (width / 2) + 0.5 : 0.5;
46
+ const yPos = height / 2;
47
+
48
+ this.d = this.d || d;
49
+ this.id = this.id || id;
50
+ this.height = this.height || height;
51
+ this.width = this.width || width;
52
+ this.refX = this.refX || xPos;
53
+ this.refY = this.refY || yPos;
54
+ }
55
+ }
56
+
57
+ @Component({ selector: "[ibm-graph-marker-arrow-left]", template})
58
+ export class MarkerArrowLeftComponent extends MarkerComponent implements OnInit { ngOnInit() {this.setAttributes({...arrowLeft}); } }
59
+ @Component({ selector: "[ibm-graph-marker-arrow-right]", template})
60
+ export class MarkerArrowRightComponent extends MarkerComponent implements OnInit { ngOnInit() {this.setAttributes({...arrowRight}); } }
61
+ @Component({ selector: "[ibm-graph-marker-circle]", template})
62
+ export class MarkerShapeNodeComponent extends MarkerComponent implements OnInit { ngOnInit() {this.setAttributes({...circle}); } }
63
+ @Component({ selector: "[ibm-graph-marker-diamond]", template})
64
+ export class MarkerDiamondComponent extends MarkerComponent implements OnInit { ngOnInit() {this.setAttributes({...diamond}); } }
65
+ @Component({ selector: "[ibm-graph-marker-square]", template})
66
+ export class MarkerSquareComponent extends MarkerComponent implements OnInit { ngOnInit() {this.setAttributes({...square}); } }
67
+ @Component({ selector: "[ibm-graph-marker-tee]", template})
68
+ export class MarkerTeeComponent extends MarkerComponent implements OnInit { ngOnInit() {this.setAttributes({...tee}); } }
@@ -0,0 +1,43 @@
1
+ import { NgModule } from "@angular/core";
2
+ import { CommonModule } from "@angular/common";
3
+ import {
4
+ MarkerComponent,
5
+ MarkerArrowLeftComponent,
6
+ MarkerArrowRightComponent,
7
+ MarkerShapeNodeComponent,
8
+ MarkerDiamondComponent,
9
+ MarkerSquareComponent,
10
+ MarkerTeeComponent
11
+ } from "./marker.component";
12
+
13
+ export {
14
+ MarkerComponent,
15
+ MarkerArrowLeftComponent,
16
+ MarkerArrowRightComponent,
17
+ MarkerShapeNodeComponent,
18
+ MarkerDiamondComponent,
19
+ MarkerSquareComponent,
20
+ MarkerTeeComponent
21
+ };
22
+ @NgModule({
23
+ declarations: [
24
+ MarkerComponent,
25
+ MarkerArrowLeftComponent,
26
+ MarkerArrowRightComponent,
27
+ MarkerShapeNodeComponent,
28
+ MarkerDiamondComponent,
29
+ MarkerSquareComponent,
30
+ MarkerTeeComponent
31
+ ],
32
+ exports: [
33
+ MarkerComponent,
34
+ MarkerArrowLeftComponent,
35
+ MarkerArrowRightComponent,
36
+ MarkerShapeNodeComponent,
37
+ MarkerDiamondComponent,
38
+ MarkerSquareComponent,
39
+ MarkerTeeComponent
40
+ ],
41
+ imports: [CommonModule]
42
+ })
43
+ export class MarkerModule { }
@@ -0,0 +1,133 @@
1
+ import {
2
+ Component,
3
+ Input,
4
+ Output,
5
+ EventEmitter,
6
+ TemplateRef,
7
+ OnInit,
8
+ } from '@angular/core';
9
+
10
+ import { carbonPrefix } from '../configs';
11
+
12
+ @Component({
13
+ selector: 'ibm-diagram-shape-node',
14
+ template: `
15
+ <ng-container [ngSwitch]="component">
16
+ <xhtml:div
17
+ *ngSwitchCase="'div'"
18
+ [ngClass]="[
19
+ namespace,
20
+ stacked ? namespace + '--stacked' : '',
21
+ shape ? namespace + '--' + shape : '',
22
+ namespace + '--' + component
23
+ ]"
24
+ [ngStyle]="{
25
+ 'height.px': size,
26
+ 'width.px': size,
27
+ position: position
28
+ }"
29
+ (mouseenter)="mouseEnter.emit($event)"
30
+ (mouseover)="mouseOver.emit($event)"
31
+ (mouseout)="mouseOut.emit($event)"
32
+ (mouseleave)="mouseLeave.emit($event)"
33
+ (mousemove)="mouseMove.emit($event)"
34
+ tabindex="0"
35
+ >
36
+ <ng-container *ngTemplateOutlet="nodeTemplate"></ng-container>
37
+ </xhtml:div>
38
+
39
+ <xhtml:button
40
+ *ngSwitchCase="'button'"
41
+ [ngClass]="[
42
+ namespace,
43
+ stacked ? namespace + '--stacked' : '',
44
+ shape ? namespace + '--' + shape : '',
45
+ namespace + '--' + component
46
+ ]"
47
+ [ngStyle]="{
48
+ 'height.px': size,
49
+ 'width.px': size,
50
+ position: position
51
+ }"
52
+ (click)="click.emit($event)"
53
+ (mouseenter)="mouseEnter.emit($event)"
54
+ (mouseover)="mouseOver.emit($event)"
55
+ (mouseout)="mouseOut.emit($event)"
56
+ (mouseleave)="mouseLeave.emit($event)"
57
+ (mousemove)="mouseMove.emit($event)"
58
+ tabindex="0"
59
+ >
60
+ <ng-container *ngTemplateOutlet="nodeTemplate"></ng-container>
61
+ </xhtml:button>
62
+
63
+ <xhtml:a
64
+ *ngSwitchCase="'a'"
65
+ [ngClass]="[
66
+ namespace,
67
+ stacked ? namespace + '--stacked' : '',
68
+ shape ? namespace + '--' + shape : '',
69
+ namespace + '--' + component
70
+ ]"
71
+ [attr.href]="href"
72
+ [ngStyle]="{
73
+ 'height.px': size,
74
+ 'width.px': size,
75
+ position: position
76
+ }"
77
+ (mouseenter)="mouseEnter.emit($event)"
78
+ (mouseover)="mouseOver.emit($event)"
79
+ (mouseout)="mouseOut.emit($event)"
80
+ (mouseleave)="mouseLeave.emit($event)"
81
+ (mousemove)="mouseMove.emit($event)"
82
+ tabindex="0"
83
+ >
84
+ <ng-container *ngTemplateOutlet="nodeTemplate"></ng-container>
85
+ </xhtml:a>
86
+ </ng-container>
87
+
88
+ <ng-template #nodeTemplate>
89
+ <div *ngIf="renderIcon" attr.class="{{ namespace + '__icon' }}">
90
+ <ng-container *ngTemplateOutlet="renderIcon"></ng-container>
91
+ </div>
92
+ <div
93
+ attr.class="{{ namespace + '__body' }}"
94
+ [ngStyle]="{ position: bodyPosition }"
95
+ >
96
+ <div attr.class="{{ namespace + '__title' }}">{{ title }}</div>
97
+ <div attr.class="{{ namespace + '__subtitle' }}">
98
+ {{ subtitle }}
99
+ </div>
100
+ </div>
101
+ </ng-template>
102
+ `,
103
+ })
104
+ export class ShapeNodeComponent implements OnInit {
105
+ @Input() as = 'div';
106
+ @Input() href: string = null;
107
+ @Input() renderIcon: TemplateRef<any>;
108
+ @Input() size = 48;
109
+ @Input() stacked: boolean;
110
+ @Input() shape: 'circle' | 'square' | 'rounded-square' = 'circle';
111
+ @Input() subtitle: string;
112
+ @Input() title: string;
113
+ @Input() position: string = 'fixed';
114
+ @Input() bodyPosition: string = 'absolute';
115
+
116
+ @Output() click: EventEmitter<any> = new EventEmitter<any>();
117
+ @Output() mouseEnter: EventEmitter<any> = new EventEmitter<any>();
118
+ @Output() mouseOver: EventEmitter<any> = new EventEmitter<any>();
119
+ @Output() mouseOut: EventEmitter<any> = new EventEmitter<any>();
120
+ @Output() mouseLeave: EventEmitter<any> = new EventEmitter<any>();
121
+ @Output() mouseMove: EventEmitter<any> = new EventEmitter<any>();
122
+
123
+ namespace = `${carbonPrefix}--cc--shape-node`;
124
+ component = 'div';
125
+
126
+ ngOnInit() {
127
+ if (this.href) {
128
+ this.component = 'a';
129
+ } else {
130
+ this.component = this.as;
131
+ }
132
+ }
133
+ }
@@ -0,0 +1,11 @@
1
+ import { NgModule } from "@angular/core";
2
+ import { CommonModule } from "@angular/common";
3
+ import { ShapeNodeComponent } from "./shape-node.component";
4
+ export { ShapeNodeComponent } from "./shape-node.component";
5
+
6
+ @NgModule({
7
+ declarations: [ShapeNodeComponent],
8
+ exports: [ShapeNodeComponent],
9
+ imports: [CommonModule]
10
+ })
11
+ export class ShapeNodeModule { }
@@ -0,0 +1,34 @@
1
+ import {
2
+ Component,
3
+ AfterViewInit
4
+ } from "@angular/core";
5
+
6
+ import { BaseChart } from "./base-chart.component";
7
+
8
+ import { DonutChart } from "@carbon/charts";
9
+
10
+ /**
11
+ * Wrapper around `DonutChart` in carbon charts library
12
+ *
13
+ * Most functions just call their equivalent from the chart library.
14
+ */
15
+ @Component({
16
+ selector: "ibm-donut-chart",
17
+ template: ``
18
+ })
19
+ export class DonutChartComponent extends BaseChart implements AfterViewInit {
20
+ /**
21
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
22
+ */
23
+ ngAfterViewInit() {
24
+ this.chart = new DonutChart(
25
+ this.elementRef.nativeElement,
26
+ {
27
+ data: this.data,
28
+ options: this.options
29
+ }
30
+ );
31
+
32
+ Object.assign(this, this.chart);
33
+ }
34
+ }
@@ -0,0 +1,34 @@
1
+ import {
2
+ Component,
3
+ AfterViewInit
4
+ } from "@angular/core";
5
+
6
+ import { BaseChart } from "./base-chart.component";
7
+
8
+ import { GaugeChart } from "@carbon/charts";
9
+
10
+ /**
11
+ * Wrapper around `GaugeChart` in carbon charts library
12
+ *
13
+ * Most functions just call their equivalent from the chart library.
14
+ */
15
+ @Component({
16
+ selector: "ibm-gauge-chart",
17
+ template: ``
18
+ })
19
+ export class GaugeChartComponent extends BaseChart implements AfterViewInit {
20
+ /**
21
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
22
+ */
23
+ ngAfterViewInit() {
24
+ this.chart = new GaugeChart(
25
+ this.elementRef.nativeElement,
26
+ {
27
+ data: this.data,
28
+ options: this.options
29
+ }
30
+ );
31
+
32
+ Object.assign(this, this.chart);
33
+ }
34
+ }
@@ -0,0 +1,34 @@
1
+ import {
2
+ Component,
3
+ AfterViewInit
4
+ } from "@angular/core";
5
+
6
+ import { BaseChart } from "./base-chart.component";
7
+
8
+ import { HeatmapChart } from "@carbon/charts";
9
+
10
+ /**
11
+ * Wrapper around `Heatmap` in carbon charts library
12
+ *
13
+ * Most functions just call their equivalent from the chart library.
14
+ */
15
+ @Component({
16
+ selector: "ibm-heatmap-chart",
17
+ template: ``
18
+ })
19
+ export class HeatmapChartComponent extends BaseChart implements AfterViewInit {
20
+ /**
21
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
22
+ */
23
+ ngAfterViewInit() {
24
+ this.chart = new HeatmapChart(
25
+ this.elementRef.nativeElement,
26
+ {
27
+ data: this.data,
28
+ options: this.options
29
+ }
30
+ );
31
+
32
+ Object.assign(this, this.chart);
33
+ }
34
+ }
@@ -0,0 +1,34 @@
1
+ import {
2
+ Component,
3
+ AfterViewInit
4
+ } from "@angular/core";
5
+
6
+ import { BaseChart } from "./base-chart.component";
7
+
8
+ import { HistogramChart } from "@carbon/charts";
9
+
10
+ /**
11
+ * Wrapper around `HistogramChart` in carbon charts library
12
+ *
13
+ * Most functions just call their equivalent from the chart library.
14
+ */
15
+ @Component({
16
+ selector: "ibm-histogram-chart",
17
+ template: ``
18
+ })
19
+ export class HistogramChartComponent extends BaseChart implements AfterViewInit {
20
+ /**
21
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
22
+ */
23
+ ngAfterViewInit() {
24
+ this.chart = new HistogramChart(
25
+ this.elementRef.nativeElement,
26
+ {
27
+ data: this.data,
28
+ options: this.options
29
+ }
30
+ );
31
+
32
+ Object.assign(this, this.chart);
33
+ }
34
+ }
package/src/index.ts ADDED
@@ -0,0 +1,44 @@
1
+ export * from './charts.module';
2
+
3
+ export * from './base-chart.component';
4
+ export * from './area-chart.component';
5
+ export * from './area-chart-stacked.component';
6
+ export * from './bar-chart-simple.component';
7
+ export * from './bar-chart-grouped.component';
8
+ export * from './bar-chart-stacked.component';
9
+ export * from './boxplot-chart.component';
10
+ export * from './bubble-chart.component';
11
+ export * from './bullet-chart.component';
12
+ export * from './donut-chart.component';
13
+ export * from './gauge-chart.component';
14
+ export * from './histogram-chart.component';
15
+ export * from './line-chart.component';
16
+ export * from './lollipop-chart.component';
17
+ export * from './pie-chart.component';
18
+ export * from './scatter-chart.component';
19
+ export * from './meter-chart.component';
20
+ export * from './radar-chart.component';
21
+ export * from './combo-chart.component';
22
+ export * from './tree-chart.component';
23
+ export * from './treemap-chart.component';
24
+ export * from './circle-pack-chart.component';
25
+ export * from './wordcloud-chart.component';
26
+ export * from './alluvial-chart.component';
27
+ export * from './heatmap-chart.component';
28
+
29
+ // Diagrams
30
+ export * from './diagrams/card-node/card-node.module';
31
+ export * from './diagrams/card-node/card-node-column.component';
32
+ export * from './diagrams/card-node/card-node-label.component';
33
+ export * from './diagrams/card-node/card-node-subtitle.component';
34
+ export * from './diagrams/card-node/card-node-title.component';
35
+ export * from './diagrams/card-node/card-node.component';
36
+
37
+ export * from './diagrams/edge/edge.module';
38
+ export * from './diagrams/edge/edge.component';
39
+
40
+ export * from './diagrams/marker/marker.module';
41
+ export * from './diagrams/marker/marker.component';
42
+
43
+ export * from './diagrams/shape-node/shape-node.module';
44
+ export * from './diagrams/shape-node/shape-node.component';
@@ -0,0 +1,34 @@
1
+ import {
2
+ Component,
3
+ AfterViewInit
4
+ } from "@angular/core";
5
+
6
+ import { BaseChart } from "./base-chart.component";
7
+
8
+ import { LineChart } from "@carbon/charts";
9
+
10
+ /**
11
+ * Wrapper around `LineChart` in carbon charts library
12
+ *
13
+ * Most functions just call their equivalent from the chart library.
14
+ */
15
+ @Component({
16
+ selector: "ibm-line-chart",
17
+ template: ``
18
+ })
19
+ export class LineChartComponent extends BaseChart implements AfterViewInit {
20
+ /**
21
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
22
+ */
23
+ ngAfterViewInit() {
24
+ this.chart = new LineChart(
25
+ this.elementRef.nativeElement,
26
+ {
27
+ data: this.data,
28
+ options: this.options
29
+ }
30
+ );
31
+
32
+ Object.assign(this, this.chart);
33
+ }
34
+ }
@@ -0,0 +1,34 @@
1
+ import {
2
+ Component,
3
+ AfterViewInit
4
+ } from "@angular/core";
5
+
6
+ import { BaseChart } from "./base-chart.component";
7
+
8
+ import { LollipopChart } from "@carbon/charts";
9
+
10
+ /**
11
+ * Wrapper around `LollipopChart` in carbon charts library
12
+ *
13
+ * Most functions just call their equivalent from the chart library.
14
+ */
15
+ @Component({
16
+ selector: "ibm-lollipop-chart",
17
+ template: ``
18
+ })
19
+ export class LollipopChartComponent extends BaseChart implements AfterViewInit {
20
+ /**
21
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
22
+ */
23
+ ngAfterViewInit() {
24
+ this.chart = new LollipopChart(
25
+ this.elementRef.nativeElement,
26
+ {
27
+ data: this.data,
28
+ options: this.options
29
+ }
30
+ );
31
+
32
+ Object.assign(this, this.chart);
33
+ }
34
+ }
@@ -0,0 +1,33 @@
1
+ import {
2
+ Component,
3
+ AfterViewInit
4
+ } from "@angular/core";
5
+
6
+ import { BaseChart } from "./base-chart.component";
7
+ import { MeterChart } from "@carbon/charts";
8
+
9
+ /**
10
+ * Wrapper around `MeterChart` in carbon charts library
11
+ *
12
+ * Most functions just call their equivalent from the chart library.
13
+ */
14
+ @Component({
15
+ selector: "ibm-meter-chart",
16
+ template: ``
17
+ })
18
+ export class MeterChartComponent extends BaseChart implements AfterViewInit {
19
+ /**
20
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
21
+ */
22
+ ngAfterViewInit() {
23
+ this.chart = new MeterChart(
24
+ this.elementRef.nativeElement,
25
+ {
26
+ data: this.data,
27
+ options: this.options
28
+ }
29
+ );
30
+
31
+ Object.assign(this, this.chart);
32
+ }
33
+ }
@@ -0,0 +1,34 @@
1
+ import {
2
+ Component,
3
+ AfterViewInit
4
+ } from "@angular/core";
5
+
6
+ import { BaseChart } from "./base-chart.component";
7
+
8
+ import { PieChart } from "@carbon/charts";
9
+
10
+ /**
11
+ * Wrapper around `PieChart` in carbon charts library
12
+ *
13
+ * Most functions just call their equivalent from the chart library.
14
+ */
15
+ @Component({
16
+ selector: "ibm-pie-chart",
17
+ template: ``
18
+ })
19
+ export class PieChartComponent extends BaseChart implements AfterViewInit {
20
+ /**
21
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
22
+ */
23
+ ngAfterViewInit() {
24
+ this.chart = new PieChart(
25
+ this.elementRef.nativeElement,
26
+ {
27
+ data: this.data,
28
+ options: this.options
29
+ }
30
+ );
31
+
32
+ Object.assign(this, this.chart);
33
+ }
34
+ }
@@ -0,0 +1,34 @@
1
+ import {
2
+ Component,
3
+ AfterViewInit
4
+ } from "@angular/core";
5
+
6
+ import { BaseChart } from "./base-chart.component";
7
+
8
+ import { RadarChart } from "@carbon/charts";
9
+
10
+ /**
11
+ * Wrapper around `RadarChart` in carbon charts library
12
+ *
13
+ * Most functions just call their equivalent from the chart library.
14
+ */
15
+ @Component({
16
+ selector: "ibm-radar-chart",
17
+ template: ``
18
+ })
19
+ export class RadarChartComponent extends BaseChart implements AfterViewInit {
20
+ /**
21
+ * Runs after view init to create a chart, attach it to `elementRef` and draw it.
22
+ */
23
+ ngAfterViewInit() {
24
+ this.chart = new RadarChart(
25
+ this.elementRef.nativeElement,
26
+ {
27
+ data: this.data,
28
+ options: this.options
29
+ }
30
+ );
31
+
32
+ Object.assign(this, this.chart);
33
+ }
34
+ }