@carbon/charts-angular 0.58.0 → 0.59.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/addons.js +2 -0
- package/.storybook/assets/logo.svg +1 -0
- package/.storybook/assets/share.png +0 -0
- package/.storybook/assets/welcome.png +0 -0
- package/.storybook/config.js +22 -0
- package/.storybook/manager-head.html +45 -0
- package/.storybook/preview-head.html +10 -0
- package/.storybook/tsconfig.json +10 -0
- package/CHANGELOG.md +8 -0
- package/angular.json +68 -0
- package/build.sh +13 -0
- package/carbon.yml +275 -0
- package/dist/CHANGELOG.md +3168 -0
- package/dist/README.md +40 -0
- package/{alluvial-chart.component.d.ts → dist/alluvial-chart.component.d.ts} +0 -0
- package/{area-chart-stacked.component.d.ts → dist/area-chart-stacked.component.d.ts} +0 -0
- package/{area-chart.component.d.ts → dist/area-chart.component.d.ts} +0 -0
- package/{bar-chart-grouped.component.d.ts → dist/bar-chart-grouped.component.d.ts} +0 -0
- package/{bar-chart-simple.component.d.ts → dist/bar-chart-simple.component.d.ts} +0 -0
- package/{bar-chart-stacked.component.d.ts → dist/bar-chart-stacked.component.d.ts} +0 -0
- package/{base-chart.component.d.ts → dist/base-chart.component.d.ts} +0 -0
- package/{boxplot-chart.component.d.ts → dist/boxplot-chart.component.d.ts} +0 -0
- package/{bubble-chart.component.d.ts → dist/bubble-chart.component.d.ts} +0 -0
- package/{bullet-chart.component.d.ts → dist/bullet-chart.component.d.ts} +0 -0
- package/{bundles → dist/bundles}/carbon-charts-angular.umd.js +21 -23
- package/dist/bundles/carbon-charts-angular.umd.js.map +1 -0
- package/dist/bundles/carbon-charts-angular.umd.min.js +16 -0
- package/dist/bundles/carbon-charts-angular.umd.min.js.map +1 -0
- package/{carbon-charts-angular.d.ts → dist/carbon-charts-angular.d.ts} +0 -0
- package/{carbon-charts-angular.metadata.json → dist/carbon-charts-angular.metadata.json} +1 -1
- package/{charts.module.d.ts → dist/charts.module.d.ts} +0 -0
- package/{circle-pack-chart.component.d.ts → dist/circle-pack-chart.component.d.ts} +0 -0
- package/{combo-chart.component.d.ts → dist/combo-chart.component.d.ts} +0 -0
- package/{diagrams → dist/diagrams}/card-node/card-node-column.component.d.ts +0 -0
- package/{diagrams → dist/diagrams}/card-node/card-node-label.component.d.ts +0 -0
- package/{diagrams → dist/diagrams}/card-node/card-node-subtitle.component.d.ts +0 -0
- package/{diagrams → dist/diagrams}/card-node/card-node-title.component.d.ts +0 -0
- package/{diagrams → dist/diagrams}/card-node/card-node.component.d.ts +0 -0
- package/{diagrams → dist/diagrams}/card-node/card-node.module.d.ts +0 -0
- package/dist/diagrams/configs.d.ts +1 -0
- package/{diagrams → dist/diagrams}/edge/edge.component.d.ts +0 -0
- package/{diagrams → dist/diagrams}/edge/edge.module.d.ts +0 -0
- package/{diagrams → dist/diagrams}/marker/marker.component.d.ts +0 -0
- package/{diagrams → dist/diagrams}/marker/marker.module.d.ts +0 -0
- package/{diagrams → dist/diagrams}/shape-node/shape-node.component.d.ts +0 -0
- package/{diagrams → dist/diagrams}/shape-node/shape-node.module.d.ts +0 -0
- package/{donut-chart.component.d.ts → dist/donut-chart.component.d.ts} +0 -0
- package/{esm2015 → dist/esm2015}/alluvial-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/area-chart-stacked.component.js +0 -0
- package/{esm2015 → dist/esm2015}/area-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/bar-chart-grouped.component.js +0 -0
- package/{esm2015 → dist/esm2015}/bar-chart-simple.component.js +0 -0
- package/{esm2015 → dist/esm2015}/bar-chart-stacked.component.js +0 -0
- package/{esm2015 → dist/esm2015}/base-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/boxplot-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/bubble-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/bullet-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/carbon-charts-angular.js +0 -0
- package/{esm2015 → dist/esm2015}/charts.module.js +0 -0
- package/{esm2015 → dist/esm2015}/circle-pack-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/combo-chart.component.js +0 -0
- package/dist/esm2015/diagrams/card-node/card-node-column.component.js +41 -0
- package/dist/esm2015/diagrams/card-node/card-node-label.component.js +27 -0
- package/dist/esm2015/diagrams/card-node/card-node-subtitle.component.js +27 -0
- package/dist/esm2015/diagrams/card-node/card-node-title.component.js +27 -0
- package/dist/esm2015/diagrams/card-node/card-node.component.js +148 -0
- package/{esm2015 → dist/esm2015}/diagrams/card-node/card-node.module.js +0 -0
- package/dist/esm2015/diagrams/configs.js +8 -0
- package/dist/esm2015/diagrams/edge/edge.component.js +80 -0
- package/{esm2015 → dist/esm2015}/diagrams/edge/edge.module.js +0 -0
- package/dist/esm2015/diagrams/marker/marker.component.js +141 -0
- package/{esm2015 → dist/esm2015}/diagrams/marker/marker.module.js +0 -0
- package/dist/esm2015/diagrams/shape-node/shape-node.component.js +187 -0
- package/{esm2015 → dist/esm2015}/diagrams/shape-node/shape-node.module.js +0 -0
- package/{esm2015 → dist/esm2015}/donut-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/gauge-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/heatmap-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/histogram-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/index.js +0 -0
- package/{esm2015 → dist/esm2015}/line-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/lollipop-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/meter-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/pie-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/radar-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/scatter-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/tree-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/treemap-chart.component.js +0 -0
- package/{esm2015 → dist/esm2015}/wordcloud-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/alluvial-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/area-chart-stacked.component.js +0 -0
- package/{esm5 → dist/esm5}/area-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/bar-chart-grouped.component.js +0 -0
- package/{esm5 → dist/esm5}/bar-chart-simple.component.js +0 -0
- package/{esm5 → dist/esm5}/bar-chart-stacked.component.js +0 -0
- package/{esm5 → dist/esm5}/base-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/boxplot-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/bubble-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/bullet-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/carbon-charts-angular.js +0 -0
- package/{esm5 → dist/esm5}/charts.module.js +0 -0
- package/{esm5 → dist/esm5}/circle-pack-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/combo-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/diagrams/card-node/card-node-column.component.js +4 -5
- package/{esm5 → dist/esm5}/diagrams/card-node/card-node-label.component.js +3 -4
- package/{esm5 → dist/esm5}/diagrams/card-node/card-node-subtitle.component.js +3 -4
- package/{esm5 → dist/esm5}/diagrams/card-node/card-node-title.component.js +3 -4
- package/dist/esm5/diagrams/card-node/card-node.component.js +86 -0
- package/{esm5 → dist/esm5}/diagrams/card-node/card-node.module.js +0 -0
- package/dist/esm5/diagrams/configs.js +8 -0
- package/dist/esm5/diagrams/edge/edge.component.js +64 -0
- package/{esm5 → dist/esm5}/diagrams/edge/edge.module.js +0 -0
- package/{esm5 → dist/esm5}/diagrams/marker/marker.component.js +3 -4
- package/{esm5 → dist/esm5}/diagrams/marker/marker.module.js +0 -0
- package/dist/esm5/diagrams/shape-node/shape-node.component.js +104 -0
- package/{esm5 → dist/esm5}/diagrams/shape-node/shape-node.module.js +0 -0
- package/{esm5 → dist/esm5}/donut-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/gauge-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/heatmap-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/histogram-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/index.js +0 -0
- package/{esm5 → dist/esm5}/line-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/lollipop-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/meter-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/pie-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/radar-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/scatter-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/tree-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/treemap-chart.component.js +0 -0
- package/{esm5 → dist/esm5}/wordcloud-chart.component.js +0 -0
- package/{fesm2015 → dist/fesm2015}/carbon-charts-angular.js +17 -18
- package/dist/fesm2015/carbon-charts-angular.js.map +1 -0
- package/{fesm5 → dist/fesm5}/carbon-charts-angular.js +17 -18
- package/dist/fesm5/carbon-charts-angular.js.map +1 -0
- package/{gauge-chart.component.d.ts → dist/gauge-chart.component.d.ts} +0 -0
- package/{heatmap-chart.component.d.ts → dist/heatmap-chart.component.d.ts} +0 -0
- package/{histogram-chart.component.d.ts → dist/histogram-chart.component.d.ts} +0 -0
- package/{index.d.ts → dist/index.d.ts} +0 -0
- package/{line-chart.component.d.ts → dist/line-chart.component.d.ts} +0 -0
- package/{lollipop-chart.component.d.ts → dist/lollipop-chart.component.d.ts} +0 -0
- package/{meter-chart.component.d.ts → dist/meter-chart.component.d.ts} +0 -0
- package/dist/package.json +109 -0
- package/{pie-chart.component.d.ts → dist/pie-chart.component.d.ts} +0 -0
- package/{radar-chart.component.d.ts → dist/radar-chart.component.d.ts} +0 -0
- package/{scatter-chart.component.d.ts → dist/scatter-chart.component.d.ts} +0 -0
- package/{tree-chart.component.d.ts → dist/tree-chart.component.d.ts} +0 -0
- package/{treemap-chart.component.d.ts → dist/treemap-chart.component.d.ts} +0 -0
- package/{wordcloud-chart.component.d.ts → dist/wordcloud-chart.component.d.ts} +0 -0
- package/ng-package.json +8 -0
- package/package.json +103 -108
- package/src/alluvial-chart.component.ts +34 -0
- package/src/area-chart-stacked.component.ts +34 -0
- package/src/area-chart.component.ts +37 -0
- package/src/bar-chart-grouped.component.ts +34 -0
- package/src/bar-chart-simple.component.ts +34 -0
- package/src/bar-chart-stacked.component.ts +34 -0
- package/src/base-chart.component.ts +102 -0
- package/src/boxplot-chart.component.ts +34 -0
- package/src/bubble-chart.component.ts +34 -0
- package/src/bullet-chart.component.ts +34 -0
- package/src/charts.module.ts +87 -0
- package/src/circle-pack-chart.component.ts +34 -0
- package/src/combo-chart.component.ts +33 -0
- package/src/diagrams/card-node/card-node-column.component.ts +22 -0
- package/src/diagrams/card-node/card-node-label.component.ts +15 -0
- package/src/diagrams/card-node/card-node-subtitle.component.ts +15 -0
- package/src/diagrams/card-node/card-node-title.component.ts +15 -0
- package/src/diagrams/card-node/card-node.component.ts +100 -0
- package/src/diagrams/card-node/card-node.module.ts +18 -0
- package/src/diagrams/configs.ts +1 -0
- package/src/diagrams/edge/edge.component.ts +45 -0
- package/src/diagrams/edge/edge.module.ts +11 -0
- package/src/diagrams/marker/marker.component.ts +68 -0
- package/src/diagrams/marker/marker.module.ts +43 -0
- package/src/diagrams/shape-node/shape-node.component.ts +133 -0
- package/src/diagrams/shape-node/shape-node.module.ts +11 -0
- package/src/donut-chart.component.ts +34 -0
- package/src/gauge-chart.component.ts +34 -0
- package/src/heatmap-chart.component.ts +34 -0
- package/src/histogram-chart.component.ts +34 -0
- package/src/index.ts +44 -0
- package/src/line-chart.component.ts +34 -0
- package/src/lollipop-chart.component.ts +34 -0
- package/src/meter-chart.component.ts +33 -0
- package/src/pie-chart.component.ts +34 -0
- package/src/radar-chart.component.ts +34 -0
- package/src/scatter-chart.component.ts +34 -0
- package/src/tree-chart.component.ts +34 -0
- package/src/treemap-chart.component.ts +34 -0
- package/src/wordcloud-chart.component.ts +34 -0
- package/stories/all.stories.ts +99 -0
- package/stories/diagrams/0_diagram.stories.ts +224 -0
- package/stories/diagrams/card-node.stories.ts +181 -0
- package/stories/diagrams/edge.stories.ts +127 -0
- package/stories/diagrams/marker.stories.ts +140 -0
- package/stories/diagrams/shape-node.stories.ts +98 -0
- package/tsconfig.json +30 -0
- package/tslint.json +95 -0
- package/LICENSE.md +0 -201
- package/bundles/carbon-charts-angular.umd.js.map +0 -1
- package/bundles/carbon-charts-angular.umd.min.js +0 -17
- package/bundles/carbon-charts-angular.umd.min.js.map +0 -1
- package/esm2015/diagrams/card-node/card-node-column.component.js +0 -42
- package/esm2015/diagrams/card-node/card-node-label.component.js +0 -28
- package/esm2015/diagrams/card-node/card-node-subtitle.component.js +0 -28
- package/esm2015/diagrams/card-node/card-node-title.component.js +0 -28
- package/esm2015/diagrams/card-node/card-node.component.js +0 -149
- package/esm2015/diagrams/edge/edge.component.js +0 -81
- package/esm2015/diagrams/marker/marker.component.js +0 -142
- package/esm2015/diagrams/shape-node/shape-node.component.js +0 -188
- package/esm5/diagrams/card-node/card-node.component.js +0 -87
- package/esm5/diagrams/edge/edge.component.js +0 -65
- package/esm5/diagrams/shape-node/shape-node.component.js +0 -105
- package/fesm2015/carbon-charts-angular.js.map +0 -1
- 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 { GroupedBarChart } from "@carbon/charts";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wrapper around `GroupedBarChart` in carbon charts library
|
|
12
|
+
*
|
|
13
|
+
* Most functions just call their equivalent from the chart library.
|
|
14
|
+
*/
|
|
15
|
+
@Component({
|
|
16
|
+
selector: "ibm-grouped-bar-chart",
|
|
17
|
+
template: ``
|
|
18
|
+
})
|
|
19
|
+
export class GroupedBarChartComponent 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 GroupedBarChart(
|
|
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 { SimpleBarChart } from "@carbon/charts";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wrapper around `SimpleBarChart` in carbon charts library
|
|
12
|
+
*
|
|
13
|
+
* Most functions just call their equivalent from the chart library.
|
|
14
|
+
*/
|
|
15
|
+
@Component({
|
|
16
|
+
selector: "ibm-simple-bar-chart",
|
|
17
|
+
template: ``
|
|
18
|
+
})
|
|
19
|
+
export class SimpleBarChartComponent 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 SimpleBarChart(
|
|
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 { StackedBarChart } from "@carbon/charts";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wrapper around `StackedBarChart` in carbon charts library
|
|
12
|
+
*
|
|
13
|
+
* Most functions just call their equivalent from the chart library.
|
|
14
|
+
*/
|
|
15
|
+
@Component({
|
|
16
|
+
selector: "ibm-stacked-bar-chart",
|
|
17
|
+
template: ``
|
|
18
|
+
})
|
|
19
|
+
export class StackedBarChartComponent 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 StackedBarChart(
|
|
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,102 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
Input,
|
|
4
|
+
ViewChild,
|
|
5
|
+
OnInit,
|
|
6
|
+
AfterViewInit,
|
|
7
|
+
ElementRef
|
|
8
|
+
} from "@angular/core";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wrapper around `BaseChart` in carbon charts library
|
|
12
|
+
*
|
|
13
|
+
* Most functions just call their equivalent from the chart library.
|
|
14
|
+
*/
|
|
15
|
+
@Component({
|
|
16
|
+
selector: "ibm-base-chart",
|
|
17
|
+
template: ``
|
|
18
|
+
})
|
|
19
|
+
export class BaseChart implements AfterViewInit, OnInit {
|
|
20
|
+
constructor(protected elementRef: ElementRef) {}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Data passed to charts library for displaying
|
|
24
|
+
*/
|
|
25
|
+
@Input() set data(newData) {
|
|
26
|
+
// If data already exists, that means the chart has been initialized
|
|
27
|
+
const dataExistsAlready = this._data !== null && this._data !== undefined;
|
|
28
|
+
|
|
29
|
+
this._data = newData;
|
|
30
|
+
|
|
31
|
+
if (dataExistsAlready) {
|
|
32
|
+
this.chart.model.setData(newData);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get data() {
|
|
37
|
+
return this._data;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Options passed to charts library
|
|
42
|
+
*/
|
|
43
|
+
@Input() set options(newOptions) {
|
|
44
|
+
// If data already exists, that means the chart has been initialized
|
|
45
|
+
const optionsExistAlready = this._options !== null && this._options !== undefined;
|
|
46
|
+
|
|
47
|
+
this._options = newOptions;
|
|
48
|
+
|
|
49
|
+
if (optionsExistAlready) {
|
|
50
|
+
this.chart.model.setOptions(newOptions);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get options() {
|
|
55
|
+
return this._options;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Chart width
|
|
60
|
+
*/
|
|
61
|
+
@Input() width: any;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Chart height
|
|
65
|
+
*/
|
|
66
|
+
@Input() height: any;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Chart container element ref
|
|
70
|
+
*/
|
|
71
|
+
@ViewChild("nChart") chartRef;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Chart object instance
|
|
75
|
+
*
|
|
76
|
+
* You can use this to do whatever you would normally do with a chart if you used
|
|
77
|
+
* charts library directly.
|
|
78
|
+
*/
|
|
79
|
+
chart;
|
|
80
|
+
|
|
81
|
+
private _data: any;
|
|
82
|
+
private _options: any;
|
|
83
|
+
|
|
84
|
+
ngOnInit() {
|
|
85
|
+
// Width prop is mandatory for the wrappers
|
|
86
|
+
if (this.width) {
|
|
87
|
+
this.options.width = this.width;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Height prop is mandatory for the wrappers
|
|
91
|
+
if (this.height) {
|
|
92
|
+
this.options.height = this.height;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Runs after view init to create a chart, attach it to `chartRef` and draw it.
|
|
98
|
+
*/
|
|
99
|
+
ngAfterViewInit() {
|
|
100
|
+
console.log("You need to implement your own `ngAfterViewInit()` function");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -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 { BoxplotChart } from "@carbon/charts";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wrapper around `BoxplotChart` in carbon charts library
|
|
12
|
+
*
|
|
13
|
+
* Most functions just call their equivalent from the chart library.
|
|
14
|
+
*/
|
|
15
|
+
@Component({
|
|
16
|
+
selector: "ibm-boxplot-chart",
|
|
17
|
+
template: ``
|
|
18
|
+
})
|
|
19
|
+
export class BoxplotChartComponent 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 BoxplotChart(
|
|
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 { BubbleChart } from "@carbon/charts";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wrapper around `BubbleChart` in carbon charts library
|
|
12
|
+
*
|
|
13
|
+
* Most functions just call their equivalent from the chart library.
|
|
14
|
+
*/
|
|
15
|
+
@Component({
|
|
16
|
+
selector: "ibm-bubble-chart",
|
|
17
|
+
template: ``
|
|
18
|
+
})
|
|
19
|
+
export class BubbleChartComponent 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 BubbleChart(
|
|
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 { BulletChart } from "@carbon/charts";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wrapper around `BulletChart` in carbon charts library
|
|
12
|
+
*
|
|
13
|
+
* Most functions just call their equivalent from the chart library.
|
|
14
|
+
*/
|
|
15
|
+
@Component({
|
|
16
|
+
selector: "ibm-bullet-chart",
|
|
17
|
+
template: ``
|
|
18
|
+
})
|
|
19
|
+
export class BulletChartComponent 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 BulletChart(
|
|
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,87 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
|
|
4
|
+
import { BaseChart } from './base-chart.component';
|
|
5
|
+
import { AlluvialChartComponent } from './alluvial-chart.component';
|
|
6
|
+
import { AreaChartComponent } from './area-chart.component';
|
|
7
|
+
import { StackedAreaChartComponent } from './area-chart-stacked.component';
|
|
8
|
+
import { SimpleBarChartComponent } from './bar-chart-simple.component';
|
|
9
|
+
import { GroupedBarChartComponent } from './bar-chart-grouped.component';
|
|
10
|
+
import { StackedBarChartComponent } from './bar-chart-stacked.component';
|
|
11
|
+
import { BoxplotChartComponent } from './boxplot-chart.component';
|
|
12
|
+
import { BubbleChartComponent } from './bubble-chart.component';
|
|
13
|
+
import { BulletChartComponent } from './bullet-chart.component';
|
|
14
|
+
import { DonutChartComponent } from './donut-chart.component';
|
|
15
|
+
import { GaugeChartComponent } from './gauge-chart.component';
|
|
16
|
+
import { HistogramChartComponent } from './histogram-chart.component';
|
|
17
|
+
import { LineChartComponent } from './line-chart.component';
|
|
18
|
+
import { LollipopChartComponent } from './lollipop-chart.component';
|
|
19
|
+
import { PieChartComponent } from './pie-chart.component';
|
|
20
|
+
import { ScatterChartComponent } from './scatter-chart.component';
|
|
21
|
+
import { MeterChartComponent } from './meter-chart.component';
|
|
22
|
+
import { RadarChartComponent } from './radar-chart.component';
|
|
23
|
+
import { ComboChartComponent } from './combo-chart.component';
|
|
24
|
+
import { TreeChartComponent } from './tree-chart.component';
|
|
25
|
+
import { TreemapChartComponent } from './treemap-chart.component';
|
|
26
|
+
import { CirclePackChartComponent } from './circle-pack-chart.component';
|
|
27
|
+
import { WordCloudChartComponent } from './wordcloud-chart.component';
|
|
28
|
+
import { HeatmapChartComponent } from './heatmap-chart.component';
|
|
29
|
+
|
|
30
|
+
@NgModule({
|
|
31
|
+
imports: [CommonModule],
|
|
32
|
+
declarations: [
|
|
33
|
+
BaseChart,
|
|
34
|
+
AlluvialChartComponent,
|
|
35
|
+
AreaChartComponent,
|
|
36
|
+
StackedAreaChartComponent,
|
|
37
|
+
SimpleBarChartComponent,
|
|
38
|
+
GroupedBarChartComponent,
|
|
39
|
+
StackedBarChartComponent,
|
|
40
|
+
BoxplotChartComponent,
|
|
41
|
+
BubbleChartComponent,
|
|
42
|
+
BulletChartComponent,
|
|
43
|
+
DonutChartComponent,
|
|
44
|
+
GaugeChartComponent,
|
|
45
|
+
HeatmapChartComponent,
|
|
46
|
+
HistogramChartComponent,
|
|
47
|
+
LineChartComponent,
|
|
48
|
+
LollipopChartComponent,
|
|
49
|
+
PieChartComponent,
|
|
50
|
+
ScatterChartComponent,
|
|
51
|
+
MeterChartComponent,
|
|
52
|
+
RadarChartComponent,
|
|
53
|
+
ComboChartComponent,
|
|
54
|
+
TreeChartComponent,
|
|
55
|
+
TreemapChartComponent,
|
|
56
|
+
CirclePackChartComponent,
|
|
57
|
+
WordCloudChartComponent,
|
|
58
|
+
],
|
|
59
|
+
exports: [
|
|
60
|
+
BaseChart,
|
|
61
|
+
AlluvialChartComponent,
|
|
62
|
+
AreaChartComponent,
|
|
63
|
+
StackedAreaChartComponent,
|
|
64
|
+
SimpleBarChartComponent,
|
|
65
|
+
GroupedBarChartComponent,
|
|
66
|
+
StackedBarChartComponent,
|
|
67
|
+
BoxplotChartComponent,
|
|
68
|
+
BubbleChartComponent,
|
|
69
|
+
BulletChartComponent,
|
|
70
|
+
DonutChartComponent,
|
|
71
|
+
GaugeChartComponent,
|
|
72
|
+
HeatmapChartComponent,
|
|
73
|
+
HistogramChartComponent,
|
|
74
|
+
LineChartComponent,
|
|
75
|
+
LollipopChartComponent,
|
|
76
|
+
PieChartComponent,
|
|
77
|
+
ScatterChartComponent,
|
|
78
|
+
MeterChartComponent,
|
|
79
|
+
RadarChartComponent,
|
|
80
|
+
ComboChartComponent,
|
|
81
|
+
TreeChartComponent,
|
|
82
|
+
TreemapChartComponent,
|
|
83
|
+
CirclePackChartComponent,
|
|
84
|
+
WordCloudChartComponent
|
|
85
|
+
],
|
|
86
|
+
})
|
|
87
|
+
export class ChartsModule {}
|
|
@@ -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 { CirclePackChart } from "@carbon/charts";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wrapper around `BubbleChart` in carbon charts library
|
|
12
|
+
*
|
|
13
|
+
* Most functions just call their equivalent from the chart library.
|
|
14
|
+
*/
|
|
15
|
+
@Component({
|
|
16
|
+
selector: "ibm-circle-pack-chart",
|
|
17
|
+
template: ``
|
|
18
|
+
})
|
|
19
|
+
export class CirclePackChartComponent 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 CirclePackChart(
|
|
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 { ComboChart } from "@carbon/charts";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Wrapper around `ComboChart` in carbon charts library
|
|
11
|
+
*
|
|
12
|
+
* Most functions just call their equivalent from the chart library.
|
|
13
|
+
*/
|
|
14
|
+
@Component({
|
|
15
|
+
selector: "ibm-combo-chart",
|
|
16
|
+
template: ``
|
|
17
|
+
})
|
|
18
|
+
export class ComboChartComponent 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 ComboChart(
|
|
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,22 @@
|
|
|
1
|
+
import { Component, Input, HostBinding } from '@angular/core';
|
|
2
|
+
import { carbonPrefix } from '../configs';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'ibm-diagram-card-node-column',
|
|
6
|
+
template: `
|
|
7
|
+
<xhtml:div>
|
|
8
|
+
<ng-content></ng-content>
|
|
9
|
+
</xhtml:div>
|
|
10
|
+
`,
|
|
11
|
+
})
|
|
12
|
+
export class CardNodeColumnComponent {
|
|
13
|
+
@Input() farsideColumn = false;
|
|
14
|
+
|
|
15
|
+
@HostBinding('class') get class() {
|
|
16
|
+
const farsideClassName = this.farsideColumn
|
|
17
|
+
? `${carbonPrefix}--cc--card-node__column--farside`
|
|
18
|
+
: '';
|
|
19
|
+
|
|
20
|
+
return `${carbonPrefix}--cc--card-node__column ${farsideClassName}`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component } from "@angular/core";
|
|
2
|
+
import { carbonPrefix } from '../configs';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: "ibm-diagram-card-node-label",
|
|
6
|
+
template: `
|
|
7
|
+
<xhtml:label [ngClass]="namespace">
|
|
8
|
+
<ng-content></ng-content>
|
|
9
|
+
</xhtml:label>
|
|
10
|
+
`
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export class CardNodeLabelComponent {
|
|
14
|
+
namespace = `${carbonPrefix}--cc--card-node__label`;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component } from "@angular/core";
|
|
2
|
+
import { carbonPrefix } from '../configs';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: "ibm-diagram-card-node-subtitle",
|
|
6
|
+
template: `
|
|
7
|
+
<xhtml:div [ngClass]="namespace">
|
|
8
|
+
<ng-content></ng-content>
|
|
9
|
+
</xhtml:div>
|
|
10
|
+
`
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export class CardNodeSubtitleComponent {
|
|
14
|
+
namespace = `${carbonPrefix}--cc--card-node__subtitle`;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component } from "@angular/core";
|
|
2
|
+
import { carbonPrefix } from '../configs';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: "ibm-diagram-card-node-title",
|
|
6
|
+
template: `
|
|
7
|
+
<xhtml:div [ngClass]="namespace">
|
|
8
|
+
<ng-content></ng-content>
|
|
9
|
+
</xhtml:div>
|
|
10
|
+
`
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export class CardNodeTitleComponent {
|
|
14
|
+
namespace = `${carbonPrefix}--cc--card-node__title`;
|
|
15
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
|
|
2
|
+
import { carbonPrefix } from '../configs';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'ibm-diagram-card-node',
|
|
6
|
+
template: `
|
|
7
|
+
<ng-container [ngSwitch]="component">
|
|
8
|
+
<xhtml:div
|
|
9
|
+
*ngSwitchCase="'div'"
|
|
10
|
+
[ngClass]="[
|
|
11
|
+
namespace,
|
|
12
|
+
stacked ? namespace + '--stacked' : '',
|
|
13
|
+
namespace + '--' + component
|
|
14
|
+
]"
|
|
15
|
+
[ngStyle]="{
|
|
16
|
+
'border-color': color,
|
|
17
|
+
position: position
|
|
18
|
+
}"
|
|
19
|
+
(mouseenter)="mouseEnter.emit($event)"
|
|
20
|
+
(mouseover)="mouseOver.emit($event)"
|
|
21
|
+
(mouseout)="mouseOut.emit($event)"
|
|
22
|
+
(mouseleave)="mouseLeave.emit($event)"
|
|
23
|
+
(mousemove)="mouseMove.emit($event)"
|
|
24
|
+
tabindex="0"
|
|
25
|
+
>
|
|
26
|
+
<ng-container *ngTemplateOutlet="nodeTemplate"></ng-container>
|
|
27
|
+
</xhtml:div>
|
|
28
|
+
|
|
29
|
+
<xhtml:button
|
|
30
|
+
*ngSwitchCase="'button'"
|
|
31
|
+
[ngClass]="[
|
|
32
|
+
namespace,
|
|
33
|
+
stacked ? namespace + '--stacked' : '',
|
|
34
|
+
namespace + '--' + component
|
|
35
|
+
]"
|
|
36
|
+
[ngStyle]="{
|
|
37
|
+
'border-color': color,
|
|
38
|
+
position: position
|
|
39
|
+
}"
|
|
40
|
+
(click)="click.emit($event)"
|
|
41
|
+
(mouseenter)="mouseEnter.emit($event)"
|
|
42
|
+
(mouseover)="mouseOver.emit($event)"
|
|
43
|
+
(mouseout)="mouseOut.emit($event)"
|
|
44
|
+
(mouseleave)="mouseLeave.emit($event)"
|
|
45
|
+
(mousemove)="mouseMove.emit($event)"
|
|
46
|
+
tabindex="0"
|
|
47
|
+
>
|
|
48
|
+
<ng-container *ngTemplateOutlet="nodeTemplate"></ng-container>
|
|
49
|
+
</xhtml:button>
|
|
50
|
+
|
|
51
|
+
<xhtml:a
|
|
52
|
+
*ngSwitchCase="'a'"
|
|
53
|
+
[ngClass]="[
|
|
54
|
+
namespace,
|
|
55
|
+
stacked ? namespace + '--stacked' : '',
|
|
56
|
+
namespace + '--' + component
|
|
57
|
+
]"
|
|
58
|
+
[attr.href]="href"
|
|
59
|
+
[ngStyle]="{ 'border-color': color, position: position }"
|
|
60
|
+
(mouseenter)="mouseEnter.emit($event)"
|
|
61
|
+
(mouseover)="mouseOver.emit($event)"
|
|
62
|
+
(mouseout)="mouseOut.emit($event)"
|
|
63
|
+
(mouseleave)="mouseLeave.emit($event)"
|
|
64
|
+
(mousemove)="mouseMove.emit($event)"
|
|
65
|
+
tabindex="0"
|
|
66
|
+
>
|
|
67
|
+
<ng-container *ngTemplateOutlet="nodeTemplate"></ng-container>
|
|
68
|
+
</xhtml:a>
|
|
69
|
+
</ng-container>
|
|
70
|
+
<ng-template #nodeTemplate>
|
|
71
|
+
<ng-content></ng-content>
|
|
72
|
+
</ng-template>
|
|
73
|
+
`,
|
|
74
|
+
})
|
|
75
|
+
export class CardNodeComponent implements OnInit {
|
|
76
|
+
@Input() as = 'div';
|
|
77
|
+
@Input() href: string = null;
|
|
78
|
+
@Input() color;
|
|
79
|
+
@Input() stacked;
|
|
80
|
+
@Input() position: string = 'static';
|
|
81
|
+
|
|
82
|
+
@Output() click: EventEmitter<any> = new EventEmitter<any>();
|
|
83
|
+
@Output() mouseEnter: EventEmitter<any> = new EventEmitter<any>();
|
|
84
|
+
@Output() mouseOver: EventEmitter<any> = new EventEmitter<any>();
|
|
85
|
+
@Output() mouseOut: EventEmitter<any> = new EventEmitter<any>();
|
|
86
|
+
@Output() mouseLeave: EventEmitter<any> = new EventEmitter<any>();
|
|
87
|
+
@Output() mouseMove: EventEmitter<any> = new EventEmitter<any>();
|
|
88
|
+
|
|
89
|
+
namespace = `${carbonPrefix}--cc--card-node`;
|
|
90
|
+
|
|
91
|
+
component = 'div';
|
|
92
|
+
|
|
93
|
+
ngOnInit() {
|
|
94
|
+
if (this.href) {
|
|
95
|
+
this.component = 'a';
|
|
96
|
+
} else {
|
|
97
|
+
this.component = this.as;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NgModule } from "@angular/core";
|
|
2
|
+
import { CommonModule } from "@angular/common";
|
|
3
|
+
import { CardNodeComponent } from "./card-node.component";
|
|
4
|
+
import { CardNodeColumnComponent } from "./card-node-column.component";
|
|
5
|
+
import { CardNodeLabelComponent } from "./card-node-label.component";
|
|
6
|
+
import { CardNodeSubtitleComponent } from "./card-node-subtitle.component";
|
|
7
|
+
import { CardNodeTitleComponent } from "./card-node-title.component";
|
|
8
|
+
export { CardNodeComponent,
|
|
9
|
+
CardNodeColumnComponent,
|
|
10
|
+
CardNodeLabelComponent,
|
|
11
|
+
CardNodeSubtitleComponent,
|
|
12
|
+
CardNodeTitleComponent };
|
|
13
|
+
@NgModule({
|
|
14
|
+
declarations: [CardNodeComponent, CardNodeColumnComponent, CardNodeLabelComponent, CardNodeSubtitleComponent, CardNodeTitleComponent],
|
|
15
|
+
exports: [CardNodeComponent, CardNodeColumnComponent, CardNodeLabelComponent, CardNodeSubtitleComponent, CardNodeTitleComponent],
|
|
16
|
+
imports: [CommonModule]
|
|
17
|
+
})
|
|
18
|
+
export class CardNodeModule { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const carbonPrefix = 'cds';
|