@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,34 @@
1
+ import {
2
+ Component,
3
+ AfterViewInit
4
+ } from "@angular/core";
5
+
6
+ import { BaseChart } from "./base-chart.component";
7
+
8
+ import { ScatterChart } from "@carbon/charts";
9
+
10
+ /**
11
+ * Wrapper around `ScatterChart` in carbon charts library
12
+ *
13
+ * Most functions just call their equivalent from the chart library.
14
+ */
15
+ @Component({
16
+ selector: "ibm-scatter-chart",
17
+ template: ``
18
+ })
19
+ export class ScatterChartComponent 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 ScatterChart(
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 { TreeChart } from "@carbon/charts";
9
+
10
+ /**
11
+ * Wrapper around `TreeChart` in carbon charts library
12
+ *
13
+ * Most functions just call their equivalent from the chart library.
14
+ */
15
+ @Component({
16
+ selector: "ibm-tree-chart",
17
+ template: ``
18
+ })
19
+ export class TreeChartComponent 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 TreeChart(
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 { TreemapChart } from "@carbon/charts";
9
+
10
+ /**
11
+ * Wrapper around `TreemapChart` in carbon charts library
12
+ *
13
+ * Most functions just call their equivalent from the chart library.
14
+ */
15
+ @Component({
16
+ selector: "ibm-treemap-chart",
17
+ template: ``
18
+ })
19
+ export class TreemapChartComponent 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 TreemapChart(
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 { WordCloudChart } from "@carbon/charts";
9
+
10
+ /**
11
+ * Wrapper around `WordCloudChart` in carbon charts library
12
+ *
13
+ * Most functions just call their equivalent from the chart library.
14
+ */
15
+ @Component({
16
+ selector: "ibm-wordcloud-chart",
17
+ template: ``
18
+ })
19
+ export class WordCloudChartComponent 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 WordCloudChart(
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,99 @@
1
+ import { storiesOf } from '@storybook/angular';
2
+ import { withKnobs, object } from '@storybook/addon-knobs';
3
+
4
+ import { ChartsModule } from '../src/charts.module';
5
+
6
+ import { storybookDemoGroups } from '@carbon/charts/demo/data';
7
+
8
+ const getTemplate = (demo) => `
9
+ <div class="container theme--white">
10
+ <div class="v10-banner">
11
+ This version relies on <b>Carbon v11</b>. If you're using Carbon v10, <a href="https://carbon-charts-0x.netlify.app" target="_blank" rel="noreferrer">see the legacy demo site</a>
12
+ </div>
13
+
14
+ <h3>
15
+ <b>Component:</b>
16
+ <span class="cds--tag cds--tag--green component-name">${demo.chartType.angular}</span>
17
+ </h3>
18
+ <p class="props"><b>Props:</b> data, <a href="https://carbon-design-system.github.io/carbon-charts/documentation/modules/_interfaces_charts_.html" target="_blank">options</a></p>
19
+
20
+ <div class="marginTop-30" id="chart-demo">
21
+ <${demo.chartType.angular}
22
+ class="n-chart"
23
+ [data]="data"
24
+ [options]="options"
25
+ #${demo.chartType.vanilla}>
26
+ </${demo.chartType.angular}>
27
+ </div>
28
+
29
+
30
+ <h3 class="marginTop-30">Code sample</h3>
31
+
32
+ <div class="marginTop-30" *ngFor="let codeFile of codeFiles;">
33
+ <h5>{{codeFile}}</h5>
34
+
35
+ <div class="cds--snippet cds--snippet--multi cds--snippet--expand marginTop-15" data-code-snippet>
36
+ <div class="cds--snippet-container" aria-label="Code Snippet Text">
37
+ <pre><code>{{code[codeFile]}}</code></pre>
38
+ </div>
39
+ </div>
40
+ </div>
41
+ </div>
42
+ `;
43
+
44
+ const introStories = storiesOf('Intro', module).addDecorator(withKnobs);
45
+
46
+ // Loop through the demos for the group
47
+ introStories.add('Welcome', () => ({
48
+ template: `<div class="container intro">
49
+ <div
50
+ class="welcome__container"
51
+ style="
52
+ background: url(./welcome.png) no-repeat center center fixed;
53
+ background-size: cover;
54
+ ">
55
+ <div class="welcome__content">
56
+ <h2 class="welcome__heading">Carbon Charts</h2>
57
+ <h4 class="welcome__heading welcome__heading--subtitle">(Angular)</h4>
58
+
59
+ <h5 class="welcome__heading welcome__heading--other">Other versions</h5>
60
+ <ul>
61
+ <li><a href="https://charts.carbondesignsystem.com" class="welcome__heading welcome__heading--other">vanilla</a></li>
62
+ <li><a href="https://charts.carbondesignsystem.com/react" class="welcome__heading welcome__heading--other">React</a></li>
63
+ <li><a href="https://charts.carbondesignsystem.com/vue" class="welcome__heading welcome__heading--other">Vue</a></li>
64
+ <li><a href="https://charts.carbondesignsystem.com/svelte" class="welcome__heading welcome__heading--other">Svelte</a></li>
65
+ </ul>
66
+
67
+ <span class="netlify">Deploys by <a href="https://netlify.com" target="_blank">Netlify</a></span>
68
+ </div>
69
+ </div>
70
+ </div>`,
71
+ }));
72
+
73
+ // Loop through all demo groups
74
+ storybookDemoGroups.forEach((demoGroup) => {
75
+ // Create story group for each demo group
76
+ const groupStories = storiesOf(
77
+ `${demoGroup.storyGroupTitle}|${demoGroup.title}`,
78
+ module
79
+ ).addDecorator(withKnobs({ escapeHTML: false }));
80
+
81
+ // Loop through the demos for the group
82
+ demoGroup.demos.forEach((demo) => {
83
+ if (demo.isHighScale) {
84
+ return;
85
+ }
86
+ groupStories.add(demo.title, () => ({
87
+ template: getTemplate(demo),
88
+ moduleMetadata: {
89
+ imports: [ChartsModule],
90
+ },
91
+ props: {
92
+ data: object('Data', demo.data),
93
+ options: object('Options', demo.options),
94
+ codeFiles: Object.keys(demo.code.angular),
95
+ code: demo.code.angular,
96
+ },
97
+ }));
98
+ });
99
+ });
@@ -0,0 +1,224 @@
1
+ import { storiesOf, moduleMetadata } from '@storybook/angular';
2
+ import { ShapeNodeModule } from '../../src/diagrams/shape-node/shape-node.module';
3
+ import { CardNodeModule } from '../../src/diagrams/card-node/card-node.module';
4
+ import { EdgeModule } from '../../src/diagrams/edge/edge.module';
5
+ import { MarkerModule } from '../../src/diagrams/marker/marker.module';
6
+
7
+ import { UserModule, WikisModule } from '@carbon/icons-angular';
8
+ import { buildElbowPathString } from '@carbon/charts/components/diagrams/buildPaths';
9
+
10
+ const nodeHeight = 64;
11
+ const nodeWidth = 200;
12
+ const circleSize = 64;
13
+
14
+ const stories = storiesOf('Diagrams/', module);
15
+ stories.addDecorator(
16
+ moduleMetadata({
17
+ imports: [
18
+ ShapeNodeModule,
19
+ CardNodeModule,
20
+ EdgeModule,
21
+ MarkerModule,
22
+ UserModule,
23
+ WikisModule,
24
+ ],
25
+ })
26
+ );
27
+
28
+ const getTemplate = (demo) => `
29
+ <div class="container theme--white">
30
+ ${demo}
31
+ </div>
32
+ `;
33
+
34
+ stories.add('Start here', () => ({
35
+ template: getTemplate(`
36
+ <div>
37
+ <h1>Diagrams</h1>
38
+
39
+ <p style='max-width: 600px; font-size: 1rem; font-weight: 400; line-height: 1.5; letter-spacing: 0'>
40
+ Angular components for building diagram experiences, using the Carbon Design System.
41
+ </p>
42
+
43
+ <p style='max-width: 600px; font-size: 1rem; font-weight: 400; line-height: 1.5; letter-spacing: 0'>
44
+ <b>Note that Carbon Charts does not provide layouts for diagrams.
45
+ You can utilize these components alongside graphing libraries,
46
+ or by composing your own layouts (see section 3).</b>
47
+ </p>
48
+
49
+ <h2 style='padding-top: 2rem'>Examples</h2>
50
+
51
+ <h3 style='padding-top: 1rem'>1. Simple static layout</h3>
52
+
53
+ <p style='max-width: 600px; font-size: 1rem; font-weight: 400; line-height: 1.5; letter-spacing: 0'>
54
+ A simple composed diagram, using statically defined x and y
55
+ coordinates.
56
+ <a href="https://github.com/carbon-design-system/carbon-charts/tree/master/packages/angular/stories/diagrams/0_diagram.stories.ts">
57
+ View source
58
+ </a>
59
+ </p>
60
+
61
+ ${SimpleStatic}
62
+
63
+ <h3 style='padding-top: 1rem'>2. Programmatic static layout</h3>
64
+
65
+ <p style='max-width: 600px; font-size: 1rem; font-weight: 400; line-height: 1.5; letter-spacing: 0'>
66
+ A composed diagram, rendered using arrays of statically defined
67
+ x and y coordinates.
68
+ <a href="https://github.com/carbon-design-system/carbon-charts/tree/master/packages/angular/stories/diagrams/0_diagram.stories.ts">
69
+ View source
70
+ </a>
71
+ </p>
72
+
73
+ ${ProgrammaticStatic}
74
+
75
+ <h3 style='padding-top: 1rem'>3. Layouts using external dependencies</h3>
76
+
77
+ <p>Here's an example using <b>elkjs</b> in <b><u>react</u></b></p>
78
+
79
+ <iframe
80
+ src="https://codesandbox.io/embed/carbon-charts-react-elkjs-diagram-b9xyp?fontsize=14&hidenavigation=1&theme=dark&view=preview"
81
+ style="width: 100%; height: 500px; border: 0; border-radius: 4px; overflow: hidden; margin-top: 2em;"
82
+ title="carbon-charts-react-elkjs-diagram"
83
+ allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking"
84
+ sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"></iframe>
85
+ </div>
86
+ `),
87
+ props: {
88
+ source: { x: 0, y: 48 },
89
+ target: { x: 396, y: 48 },
90
+ markerEnd: 'marker',
91
+ nodeHeight,
92
+ nodeWidth,
93
+ circleSize,
94
+ nodeData,
95
+ edgeMapped,
96
+ },
97
+ }));
98
+
99
+ const SimpleStatic = `
100
+ <div class="demo-desktop-only">
101
+ <div class="cp-message">This is a desktop-only example</div>
102
+
103
+ <svg height="124" width="600" style="margin-top: 1em;" xmlns:xhtml="http://www.w3.org/1999/xhtml">
104
+ <svg:defs>
105
+ <svg:marker ibm-graph-marker-arrow-right [id]="markerEnd"></svg:marker>
106
+ </svg:defs>
107
+
108
+ <svg:g ibm-graph-edge [source]="source" [target]="target" variant="dash-sm" [markerEnd]="markerEnd" ></svg:g>
109
+
110
+ <svg:foreignObject style="overflow: visible" [attr.height]="nodeHeight" [attr.width]="nodeWidth" [attr.transform]="'translate(0, 16)'">
111
+ <xhtml:div>
112
+ <ibm-diagram-card-node as="button">
113
+ <ibm-diagram-card-node-column>
114
+ <svg ibmIconUser size="20"></svg>
115
+ </ibm-diagram-card-node-column>
116
+ <ibm-diagram-card-node-column>
117
+ <ibm-diagram-card-node-title>
118
+ Title
119
+ </ibm-diagram-card-node-title>
120
+ <ibm-diagram-card-node-subtitle>
121
+ Description
122
+ </ibm-diagram-card-node-subtitle>
123
+ </ibm-diagram-card-node-column>
124
+ </ibm-diagram-card-node>
125
+ </xhtml:div>
126
+ </svg:foreignObject>
127
+
128
+ <svg:foreignObject style="overflow: visible" [attr.height]="nodeHeight" [attr.width]="nodeWidth" [attr.transform]="'translate(400, 16)'">
129
+ <xhtml:div>
130
+ <ibm-diagram-shape-node as="button" title="Title" [size]="circleSize" [renderIcon]="wikiTemplate"></ibm-diagram-shape-node>
131
+ </xhtml:div>
132
+ </svg:foreignObject>
133
+ </svg>
134
+
135
+ <ng-template #wikiTemplate>
136
+ <svg ibmIconWikis size="20"></svg>
137
+ </ng-template>
138
+ </div>
139
+ `;
140
+
141
+ const nodeData = [
142
+ { id: 'a', x: 0, y: 16, icon: 'user', nodeWidth, nodeHeight },
143
+ { id: 'b', x: 250, y: 16, icon: 'wiki', nodeWidth, nodeHeight },
144
+ {
145
+ id: 'c',
146
+ x: 600,
147
+ y: 200,
148
+ icon: 'user',
149
+ circle: true,
150
+ nodeWidth: circleSize,
151
+ nodeHeight: circleSize,
152
+ },
153
+ { id: 'd', x: 0, y: 150, icon: 'wiki', nodeWidth, nodeHeight },
154
+ ];
155
+
156
+ const edgeData = [
157
+ { source: 'a', target: 'b', variant: 'dash-md' },
158
+ {
159
+ source: 'c',
160
+ target: 'b',
161
+ path: (source, target) => buildElbowPathString(source, target),
162
+ },
163
+ {
164
+ source: 'd',
165
+ target: 'c',
166
+ path: (source, target) => buildElbowPathString(source, target),
167
+ variant: 'tunnel',
168
+ },
169
+ ];
170
+
171
+ const edgeMapped = edgeData.map((link) => {
172
+ const sourceNode = nodeData.find((node) => node.id === link.source);
173
+ const targetNode = nodeData.find((node) => node.id === link.target);
174
+
175
+ return {
176
+ ...link,
177
+ source: {
178
+ x: sourceNode.x + sourceNode.nodeWidth / 2,
179
+ y: sourceNode.y + sourceNode.nodeHeight / 2,
180
+ },
181
+ target: {
182
+ x: targetNode.x + targetNode.nodeWidth / 2,
183
+ y: targetNode.y + targetNode.nodeHeight / 2,
184
+ },
185
+ };
186
+ });
187
+
188
+ const ProgrammaticStatic = `
189
+ <div class="demo-desktop-only">
190
+ <div class="cp-message">This is a desktop-only example</div>
191
+
192
+ <svg height="320" width="800" style="margin-top: 1.5em;" xmlns:xhtml="http://www.w3.org/1999/xhtml">
193
+ <svg:g ibm-graph-edge *ngFor="let edge of edgeMapped" [source]="edge.source" [target]="edge.target" [path]="edge.path && edge.path(edge.source, edge.target)" [variant]="edge.variant"></svg:g>
194
+ <svg:foreignObject *ngFor="let node of nodeData" style="overflow: visible" [attr.height]="node.nodeHeight" [attr.width]="node.nodeWidth" attr.transform="translate({{node.x}},{{node.y}})">
195
+ <xhtml:div *ngIf="node.circle">
196
+ <ibm-diagram-shape-node as="button" [title]="'Title'" [subtitle]="'Description'" [size]="circleSize" [renderIcon]="(node.icon === 'user') ? userTemplate : wikiTemplate"></ibm-diagram-shape-node>
197
+ </xhtml:div>
198
+ <xhtml:div *ngIf="!node.circle">
199
+ <ibm-diagram-card-node as="button">
200
+ <ibm-diagram-card-node-column>
201
+ <svg ibmIconUser size="20"></svg>
202
+ </ibm-diagram-card-node-column>
203
+ <ibm-diagram-card-node-column>
204
+ <ibm-diagram-card-node-title>
205
+ Title
206
+ </ibm-diagram-card-node-title>
207
+ <ibm-diagram-card-node-subtitle>
208
+ Description
209
+ </ibm-diagram-card-node-subtitle>
210
+ </ibm-diagram-card-node-column>
211
+ </ibm-diagram-card-node>
212
+ </xhtml:div>
213
+ </svg:foreignObject>
214
+ </svg>
215
+
216
+ <ng-template #userTemplate>
217
+ <svg ibmIconUser size="20"></svg>
218
+ </ng-template>
219
+
220
+ <ng-template #wikiTemplate>
221
+ <svg ibmIconWikis size="20"></svg>
222
+ </ng-template>
223
+ </div>
224
+ `;
@@ -0,0 +1,181 @@
1
+ import { storiesOf, moduleMetadata } from '@storybook/angular';
2
+ import { CardNodeModule } from '../../src/diagrams/card-node/card-node.module';
3
+ import { ScreenModule, ChevronDownModule } from '@carbon/icons-angular';
4
+
5
+ const getTemplate = (demo) => `
6
+ <div class="container theme--white" style="max-width: 400px;">
7
+ ${demo}
8
+ </div>
9
+ `;
10
+
11
+ storiesOf('Diagrams|Nodes/Card', module)
12
+ .addDecorator(
13
+ moduleMetadata({
14
+ imports: [CardNodeModule, ScreenModule, ChevronDownModule],
15
+ })
16
+ )
17
+ .add('Default', () => ({
18
+ template: getTemplate(`
19
+ <ibm-diagram-card-node>
20
+ <ibm-diagram-card-node-column>
21
+ <ibm-diagram-card-node-title>
22
+ {{ title }}
23
+ </ibm-diagram-card-node-title>
24
+ <ibm-diagram-card-node-subtitle>
25
+ {{ description }}
26
+ </ibm-diagram-card-node-subtitle>
27
+ </ibm-diagram-card-node-column>
28
+ </ibm-diagram-card-node>
29
+ `),
30
+ props: {
31
+ title: 'Title',
32
+ description: 'Description',
33
+ },
34
+ }))
35
+ .add('Stacked', () => ({
36
+ template: getTemplate(`
37
+ <ibm-diagram-card-node [stacked]="stacked">
38
+ <ibm-diagram-card-node-column>
39
+ <ibm-diagram-card-node-title>
40
+ {{ title }}
41
+ </ibm-diagram-card-node-title>
42
+ <ibm-diagram-card-node-subtitle>
43
+ {{ description }}
44
+ </ibm-diagram-card-node-subtitle>
45
+ </ibm-diagram-card-node-column>
46
+ </ibm-diagram-card-node>
47
+ `),
48
+ props: {
49
+ title: 'Title',
50
+ description: 'Description',
51
+ stacked: true,
52
+ },
53
+ }))
54
+ .add('Color', () => ({
55
+ template: getTemplate(`
56
+ <ibm-diagram-card-node [color]="color">
57
+ <ibm-diagram-card-node-column>
58
+ <ibm-diagram-card-node-title>
59
+ {{ title }}
60
+ </ibm-diagram-card-node-title>
61
+ <ibm-diagram-card-node-subtitle>
62
+ {{ description }}
63
+ </ibm-diagram-card-node-subtitle>
64
+ </ibm-diagram-card-node-column>
65
+ </ibm-diagram-card-node>
66
+ `),
67
+ props: {
68
+ title: 'Title',
69
+ description: 'Description',
70
+ color: '#8a3ffc',
71
+ },
72
+ }))
73
+ .add('With icon', () => ({
74
+ template: getTemplate(`
75
+ <ibm-diagram-card-node [color]="color">
76
+ <ibm-diagram-card-node-column>
77
+ <svg ibmIconScreen size="16"></svg>
78
+ </ibm-diagram-card-node-column>
79
+ <ibm-diagram-card-node-column>
80
+ <ibm-diagram-card-node-title>
81
+ {{ title }}
82
+ </ibm-diagram-card-node-title>
83
+ <ibm-diagram-card-node-subtitle>
84
+ {{ description }}
85
+ </ibm-diagram-card-node-subtitle>
86
+ </ibm-diagram-card-node-column>
87
+ </ibm-diagram-card-node>
88
+ `),
89
+ props: {
90
+ title: 'Title',
91
+ description: 'Description',
92
+ },
93
+ }))
94
+ .add('As button', () => ({
95
+ template: getTemplate(`
96
+ <ibm-diagram-card-node [as]="component">
97
+ <ibm-diagram-card-node-column>
98
+ <ibm-diagram-card-node-title>
99
+ {{ title }}
100
+ </ibm-diagram-card-node-title>
101
+ <ibm-diagram-card-node-subtitle>
102
+ {{ description }}
103
+ </ibm-diagram-card-node-subtitle>
104
+ </ibm-diagram-card-node-column>
105
+ </ibm-diagram-card-node>
106
+ `),
107
+ props: {
108
+ title: 'Title',
109
+ description: 'Description',
110
+ component: 'button',
111
+ },
112
+ }))
113
+ .add('As link', () => ({
114
+ template: getTemplate(`
115
+ <ibm-diagram-card-node [href]="href">
116
+ <ibm-diagram-card-node-column>
117
+ <ibm-diagram-card-node-title>
118
+ {{ title }}
119
+ </ibm-diagram-card-node-title>
120
+ <ibm-diagram-card-node-subtitle>
121
+ {{ description }}
122
+ </ibm-diagram-card-node-subtitle>
123
+ </ibm-diagram-card-node-column>
124
+ </ibm-diagram-card-node>
125
+ `),
126
+ props: {
127
+ title: 'Title',
128
+ description: 'Description',
129
+ href: '#',
130
+ },
131
+ }))
132
+ .add('With label', () => ({
133
+ template: getTemplate(`
134
+ <ibm-diagram-card-node [color]="color">
135
+ <ibm-diagram-card-node-column>
136
+ <svg ibmIconScreen size="16"></svg>
137
+ </ibm-diagram-card-node-column>
138
+ <ibm-diagram-card-node-column>
139
+ <ibm-diagram-card-node-title>
140
+ {{ title }}
141
+ </ibm-diagram-card-node-title>
142
+ <ibm-diagram-card-node-subtitle>
143
+ {{ description }}
144
+ </ibm-diagram-card-node-subtitle>
145
+ <ibm-diagram-card-node-label>
146
+ {{ label }}
147
+ </ibm-diagram-card-node-label>
148
+ </ibm-diagram-card-node-column>
149
+ </ibm-diagram-card-node>
150
+ `),
151
+ props: {
152
+ title: 'Title',
153
+ description: 'Description',
154
+ label: 'Label',
155
+ },
156
+ }))
157
+ .add('With action', () => ({
158
+ template: getTemplate(`
159
+ <ibm-diagram-card-node [color]="color">
160
+ <ibm-diagram-card-node-column>
161
+ <svg ibmIconScreen size="16"></svg>
162
+ </ibm-diagram-card-node-column>
163
+ <ibm-diagram-card-node-column>
164
+ <ibm-diagram-card-node-title>
165
+ {{ title }}
166
+ </ibm-diagram-card-node-title>
167
+ <ibm-diagram-card-node-subtitle>
168
+ {{ description }}
169
+ </ibm-diagram-card-node-subtitle>
170
+ </ibm-diagram-card-node-column>
171
+ <ibm-diagram-card-node-column [farsideColumn]="farsideColumn">
172
+ <svg ibmIconChevronDown size="16"></svg>
173
+ </ibm-diagram-card-node-column>
174
+ </ibm-diagram-card-node>
175
+ `),
176
+ props: {
177
+ title: 'Title',
178
+ description: 'Description',
179
+ farsideColumn: true,
180
+ },
181
+ }));