@carbon/charts-angular 1.8.0 → 1.9.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +51 -0
- package/.storybook/carbon-charts-theme.ts +8 -0
- package/.storybook/main.ts +39 -0
- package/.storybook/manager-head.html +22 -0
- package/.storybook/manager.ts +6 -0
- package/.storybook/preview-head.html +6 -0
- package/.storybook/preview.ts +42 -0
- package/.storybook/tsconfig.json +21 -0
- package/.storybook/typings.d.ts +4 -0
- package/README.md +0 -2
- package/angular.json +91 -0
- package/carbon.yml +277 -0
- package/ng-package.json +14 -0
- package/package.json +89 -63
- package/src/index.ts +53 -0
- package/src/lib/charts/alluvial-chart.component.ts +30 -0
- package/src/lib/charts/area-chart-stacked.component.ts +30 -0
- package/src/lib/charts/area-chart.component.ts +30 -0
- package/src/lib/charts/bar-chart-grouped.component.ts +30 -0
- package/src/lib/charts/bar-chart-simple.component.ts +30 -0
- package/src/lib/charts/bar-chart-stacked.component.ts +30 -0
- package/src/lib/charts/base-chart.component.ts +91 -0
- package/src/lib/charts/boxplot-chart.component.ts +30 -0
- package/src/lib/charts/bubble-chart.component.ts +30 -0
- package/src/lib/charts/bullet-chart.component.ts +30 -0
- package/src/lib/charts/charts.module.ts +92 -0
- package/src/lib/charts/choropleth.component.ts +33 -0
- package/src/lib/charts/circle-pack-chart.component.ts +30 -0
- package/src/lib/charts/combo-chart.component.ts +30 -0
- package/src/lib/charts/donut-chart.component.ts +30 -0
- package/src/lib/charts/gauge-chart.component.ts +30 -0
- package/src/lib/charts/heatmap-chart.component.ts +30 -0
- package/src/lib/charts/histogram-chart.component.ts +30 -0
- package/src/lib/charts/index.ts +28 -0
- package/src/lib/charts/line-chart.component.ts +30 -0
- package/src/lib/charts/lollipop-chart.component.ts +30 -0
- package/src/lib/charts/meter-chart.component.ts +30 -0
- package/src/lib/charts/pie-chart.component.ts +30 -0
- package/src/lib/charts/radar-chart.component.ts +30 -0
- package/src/lib/charts/scatter-chart.component.ts +30 -0
- package/src/lib/charts/tree-chart.component.ts +30 -0
- package/src/lib/charts/treemap-chart.component.ts +30 -0
- package/src/lib/charts/wordcloud-chart.component.ts +30 -0
- package/src/lib/diagrams/config.ts +1 -0
- package/src/lib/diagrams/edges/edge.component.ts +41 -0
- package/src/lib/diagrams/edges/edge.module.ts +11 -0
- package/src/lib/diagrams/edges/marker/marker.component.ts +112 -0
- package/src/lib/diagrams/edges/marker/marker.module.ts +43 -0
- package/src/lib/diagrams/index.ts +23 -0
- package/src/lib/diagrams/nodes/cards/card-node-column.component.ts +22 -0
- package/src/lib/diagrams/nodes/cards/card-node-label.component.ts +14 -0
- package/src/lib/diagrams/nodes/cards/card-node-subtitle.component.ts +14 -0
- package/src/lib/diagrams/nodes/cards/card-node-title.component.ts +14 -0
- package/src/lib/diagrams/nodes/cards/card-node.component.ts +98 -0
- package/src/lib/diagrams/nodes/cards/card-node.module.ts +32 -0
- package/src/lib/diagrams/nodes/shape/shape-node.component.ts +120 -0
- package/src/lib/diagrams/nodes/shape/shape-node.module.ts +11 -0
- package/src/lib/index.ts +50 -0
- package/src/stories/0-api.stories.mdx +69 -0
- package/src/stories/1-color-palette.stories.mdx +73 -0
- package/src/stories/2-combo-charts.stories.mdx +107 -0
- package/src/stories/3-dual-axes-charts.stories.mdx +51 -0
- package/src/stories/4-event-listeners.stories.mdx +26 -0
- package/src/stories/5-tabular-data-format.stories.mdx +132 -0
- package/src/stories/6-themes.stories.mdx +50 -0
- package/src/stories/all.stories.ts +104 -0
- package/src/stories/angular.stories.mdx +136 -0
- package/src/stories/diagrams/0-diagrams-start-here.stories.ts +219 -0
- package/src/stories/diagrams/diagrams-edges-marker.stories.ts +189 -0
- package/src/stories/diagrams/diagrams-edges.stories.ts +177 -0
- package/src/stories/diagrams/diagrams-nodes-card.stories.ts +245 -0
- package/src/stories/diagrams/diagrams-nodes-shape.stories.ts +141 -0
- package/src/stories/diagrams/utils.ts +5 -0
- package/src/test.ts +28 -0
- package/tsconfig.json +43 -0
- package/tsconfig.lib.json +14 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +17 -0
- package/tsconfig.vite.json +13 -0
- package/vite.config.ts +22 -0
- package/LICENSE.md +0 -201
- package/alluvial-chart.component.d.ts +0 -13
- package/area-chart-stacked.component.d.ts +0 -13
- package/area-chart.component.d.ts +0 -13
- package/bar-chart-grouped.component.d.ts +0 -13
- package/bar-chart-simple.component.d.ts +0 -13
- package/bar-chart-stacked.component.d.ts +0 -13
- package/base-chart.component.d.ts +0 -44
- package/boxplot-chart.component.d.ts +0 -13
- package/bubble-chart.component.d.ts +0 -13
- package/bullet-chart.component.d.ts +0 -13
- package/bundles/carbon-charts-angular.umd.js +0 -2156
- package/bundles/carbon-charts-angular.umd.js.map +0 -1
- package/bundles/carbon-charts-angular.umd.min.js +0 -16
- package/bundles/carbon-charts-angular.umd.min.js.map +0 -1
- package/carbon-charts-angular.d.ts +0 -5
- package/carbon-charts-angular.metadata.json +0 -1
- package/charts.module.d.ts +0 -2
- package/choropleth.component.d.ts +0 -13
- package/circle-pack-chart.component.d.ts +0 -13
- package/combo-chart.component.d.ts +0 -13
- package/diagrams/card-node/card-node-column.component.d.ts +0 -4
- package/diagrams/card-node/card-node-label.component.d.ts +0 -3
- package/diagrams/card-node/card-node-subtitle.component.d.ts +0 -3
- package/diagrams/card-node/card-node-title.component.d.ts +0 -3
- package/diagrams/card-node/card-node.component.d.ts +0 -17
- package/diagrams/card-node/card-node.module.d.ts +0 -8
- package/diagrams/configs.d.ts +0 -1
- package/diagrams/edge/edge.component.d.ts +0 -17
- package/diagrams/edge/edge.module.d.ts +0 -3
- package/diagrams/marker/marker.component.d.ts +0 -37
- package/diagrams/marker/marker.module.d.ts +0 -4
- package/diagrams/shape-node/shape-node.component.d.ts +0 -22
- package/diagrams/shape-node/shape-node.module.d.ts +0 -3
- package/donut-chart.component.d.ts +0 -13
- package/esm2015/alluvial-chart.component.js +0 -33
- package/esm2015/area-chart-stacked.component.js +0 -33
- package/esm2015/area-chart.component.js +0 -36
- package/esm2015/bar-chart-grouped.component.js +0 -33
- package/esm2015/bar-chart-simple.component.js +0 -33
- package/esm2015/bar-chart-stacked.component.js +0 -33
- package/esm2015/base-chart.component.js +0 -137
- package/esm2015/boxplot-chart.component.js +0 -33
- package/esm2015/bubble-chart.component.js +0 -33
- package/esm2015/bullet-chart.component.js +0 -33
- package/esm2015/carbon-charts-angular.js +0 -11
- package/esm2015/charts.module.js +0 -97
- package/esm2015/choropleth.component.js +0 -33
- package/esm2015/circle-pack-chart.component.js +0 -33
- package/esm2015/combo-chart.component.js +0 -33
- package/esm2015/diagrams/card-node/card-node-column.component.js +0 -41
- package/esm2015/diagrams/card-node/card-node-label.component.js +0 -27
- package/esm2015/diagrams/card-node/card-node-subtitle.component.js +0 -27
- package/esm2015/diagrams/card-node/card-node-title.component.js +0 -27
- package/esm2015/diagrams/card-node/card-node.component.js +0 -148
- package/esm2015/diagrams/card-node/card-node.module.js +0 -23
- package/esm2015/diagrams/configs.js +0 -8
- package/esm2015/diagrams/edge/edge.component.js +0 -80
- package/esm2015/diagrams/edge/edge.module.js +0 -19
- package/esm2015/diagrams/marker/marker.component.js +0 -141
- package/esm2015/diagrams/marker/marker.module.js +0 -35
- package/esm2015/diagrams/shape-node/shape-node.component.js +0 -187
- package/esm2015/diagrams/shape-node/shape-node.module.js +0 -19
- package/esm2015/donut-chart.component.js +0 -33
- package/esm2015/gauge-chart.component.js +0 -33
- package/esm2015/heatmap-chart.component.js +0 -33
- package/esm2015/histogram-chart.component.js +0 -33
- package/esm2015/index.js +0 -45
- package/esm2015/line-chart.component.js +0 -33
- package/esm2015/lollipop-chart.component.js +0 -33
- package/esm2015/meter-chart.component.js +0 -33
- package/esm2015/pie-chart.component.js +0 -33
- package/esm2015/radar-chart.component.js +0 -33
- package/esm2015/scatter-chart.component.js +0 -33
- package/esm2015/tree-chart.component.js +0 -33
- package/esm2015/treemap-chart.component.js +0 -33
- package/esm2015/wordcloud-chart.component.js +0 -33
- package/esm5/alluvial-chart.component.js +0 -47
- package/esm5/area-chart-stacked.component.js +0 -47
- package/esm5/area-chart.component.js +0 -47
- package/esm5/bar-chart-grouped.component.js +0 -47
- package/esm5/bar-chart-simple.component.js +0 -47
- package/esm5/bar-chart-stacked.component.js +0 -47
- package/esm5/base-chart.component.js +0 -160
- package/esm5/boxplot-chart.component.js +0 -47
- package/esm5/bubble-chart.component.js +0 -47
- package/esm5/bullet-chart.component.js +0 -47
- package/esm5/carbon-charts-angular.js +0 -11
- package/esm5/charts.module.js +0 -101
- package/esm5/choropleth.component.js +0 -47
- package/esm5/circle-pack-chart.component.js +0 -47
- package/esm5/combo-chart.component.js +0 -47
- package/esm5/diagrams/card-node/card-node-column.component.js +0 -43
- package/esm5/diagrams/card-node/card-node-label.component.js +0 -25
- package/esm5/diagrams/card-node/card-node-subtitle.component.js +0 -25
- package/esm5/diagrams/card-node/card-node-title.component.js +0 -25
- package/esm5/diagrams/card-node/card-node.component.js +0 -86
- package/esm5/diagrams/card-node/card-node.module.js +0 -27
- package/esm5/diagrams/configs.js +0 -8
- package/esm5/diagrams/edge/edge.component.js +0 -64
- package/esm5/diagrams/edge/edge.module.js +0 -23
- package/esm5/diagrams/marker/marker.component.js +0 -188
- package/esm5/diagrams/marker/marker.module.js +0 -39
- package/esm5/diagrams/shape-node/shape-node.component.js +0 -104
- package/esm5/diagrams/shape-node/shape-node.module.js +0 -23
- package/esm5/donut-chart.component.js +0 -47
- package/esm5/gauge-chart.component.js +0 -47
- package/esm5/heatmap-chart.component.js +0 -47
- package/esm5/histogram-chart.component.js +0 -47
- package/esm5/index.js +0 -45
- package/esm5/line-chart.component.js +0 -47
- package/esm5/lollipop-chart.component.js +0 -47
- package/esm5/meter-chart.component.js +0 -47
- package/esm5/pie-chart.component.js +0 -47
- package/esm5/radar-chart.component.js +0 -47
- package/esm5/scatter-chart.component.js +0 -47
- package/esm5/tree-chart.component.js +0 -47
- package/esm5/treemap-chart.component.js +0 -47
- package/esm5/wordcloud-chart.component.js +0 -47
- package/fesm2015/carbon-charts-angular.js +0 -1722
- package/fesm2015/carbon-charts-angular.js.map +0 -1
- package/fesm5/carbon-charts-angular.js +0 -1924
- package/fesm5/carbon-charts-angular.js.map +0 -1
- package/gauge-chart.component.d.ts +0 -13
- package/heatmap-chart.component.d.ts +0 -13
- package/histogram-chart.component.d.ts +0 -13
- package/index.d.ts +0 -38
- package/line-chart.component.d.ts +0 -13
- package/lollipop-chart.component.d.ts +0 -13
- package/meter-chart.component.d.ts +0 -13
- package/pie-chart.component.d.ts +0 -13
- package/radar-chart.component.d.ts +0 -13
- package/scatter-chart.component.d.ts +0 -13
- package/tree-chart.component.d.ts +0 -13
- package/treemap-chart.component.d.ts +0 -13
- package/wordcloud-chart.component.d.ts +0 -13
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Component, Input, OnInit } from '@angular/core'
|
|
2
|
+
import { arrowLeft, arrowRight, circle, diamond, square, tee } from '@carbon/charts'
|
|
3
|
+
import { carbonPrefix } from '../../config'
|
|
4
|
+
|
|
5
|
+
const template = `
|
|
6
|
+
<svg:marker
|
|
7
|
+
[ngClass]="namespace"
|
|
8
|
+
[attr.markerHeight]="height"
|
|
9
|
+
[attr.markerWidth]="width"
|
|
10
|
+
[attr.orient]="orient"
|
|
11
|
+
[attr.id]="id"
|
|
12
|
+
[attr.refX]="refX"
|
|
13
|
+
[attr.refY]="refY"
|
|
14
|
+
markerUnits="userSpaceOnUse">
|
|
15
|
+
<svg:path [attr.d]="d" [ngStyle]="{'fill': color}" ></svg:path>
|
|
16
|
+
</svg:marker>
|
|
17
|
+
`
|
|
18
|
+
|
|
19
|
+
@Component({
|
|
20
|
+
selector: 'ibm-graph-marker,[ibm-graph-marker]',
|
|
21
|
+
template
|
|
22
|
+
})
|
|
23
|
+
export class MarkerComponent {
|
|
24
|
+
@Input() d = ''
|
|
25
|
+
@Input() color = ''
|
|
26
|
+
@Input() id = ''
|
|
27
|
+
@Input() orient: string | number = 'auto'
|
|
28
|
+
@Input() height: string | number = ''
|
|
29
|
+
@Input() width: string | number = ''
|
|
30
|
+
@Input() refX: string | number = ''
|
|
31
|
+
@Input() refY: string | number = ''
|
|
32
|
+
@Input() position: 'start' | 'end' = 'end'
|
|
33
|
+
|
|
34
|
+
namespace = `${carbonPrefix}--cc--marker`
|
|
35
|
+
|
|
36
|
+
setAttributes = ({
|
|
37
|
+
d,
|
|
38
|
+
id,
|
|
39
|
+
height,
|
|
40
|
+
width
|
|
41
|
+
}: {
|
|
42
|
+
d: string
|
|
43
|
+
id: string
|
|
44
|
+
height: number
|
|
45
|
+
width: number
|
|
46
|
+
}) => {
|
|
47
|
+
const xPos = this.position === 'end' ? width / 2 + 0.5 : 0.5
|
|
48
|
+
const yPos = height / 2
|
|
49
|
+
|
|
50
|
+
this.d = this.d || d
|
|
51
|
+
this.id = this.id || id
|
|
52
|
+
this.height = this.height || height
|
|
53
|
+
this.width = this.width || width
|
|
54
|
+
this.refX = this.refX || xPos
|
|
55
|
+
this.refY = this.refY || yPos
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Component({
|
|
60
|
+
selector: 'ibm-graph-marker-arrow-left,[ibm-graph-marker-arrow-left]',
|
|
61
|
+
template
|
|
62
|
+
})
|
|
63
|
+
export class MarkerArrowLeftComponent extends MarkerComponent implements OnInit {
|
|
64
|
+
ngOnInit() {
|
|
65
|
+
this.setAttributes({ ...arrowLeft })
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
@Component({
|
|
69
|
+
selector: 'ibm-graph-marker-arrow-right,[ibm-graph-marker-arrow-right]',
|
|
70
|
+
template
|
|
71
|
+
})
|
|
72
|
+
export class MarkerArrowRightComponent extends MarkerComponent implements OnInit {
|
|
73
|
+
ngOnInit() {
|
|
74
|
+
this.setAttributes({ ...arrowRight })
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
@Component({
|
|
78
|
+
selector: 'ibm-graph-marker-circle,[ibm-graph-marker-circle]',
|
|
79
|
+
template
|
|
80
|
+
})
|
|
81
|
+
export class MarkerShapeNodeComponent extends MarkerComponent implements OnInit {
|
|
82
|
+
ngOnInit() {
|
|
83
|
+
this.setAttributes({ ...circle })
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
@Component({
|
|
87
|
+
selector: 'ibm-graph-marker-diamond,[ibm-graph-marker-diamond]',
|
|
88
|
+
template
|
|
89
|
+
})
|
|
90
|
+
export class MarkerDiamondComponent extends MarkerComponent implements OnInit {
|
|
91
|
+
ngOnInit() {
|
|
92
|
+
this.setAttributes({ ...diamond })
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
@Component({
|
|
96
|
+
selector: 'ibm-graph-marker-square,[ibm-graph-marker-square]',
|
|
97
|
+
template
|
|
98
|
+
})
|
|
99
|
+
export class MarkerSquareComponent extends MarkerComponent implements OnInit {
|
|
100
|
+
ngOnInit() {
|
|
101
|
+
this.setAttributes({ ...square })
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
@Component({
|
|
105
|
+
selector: 'ibm-graph-marker-tee,[ibm-graph-marker-tee]',
|
|
106
|
+
template
|
|
107
|
+
})
|
|
108
|
+
export class MarkerTeeComponent extends MarkerComponent implements OnInit {
|
|
109
|
+
ngOnInit() {
|
|
110
|
+
this.setAttributes({ ...tee })
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -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
|
+
imports: [CommonModule],
|
|
33
|
+
exports: [
|
|
34
|
+
MarkerComponent,
|
|
35
|
+
MarkerArrowLeftComponent,
|
|
36
|
+
MarkerArrowRightComponent,
|
|
37
|
+
MarkerShapeNodeComponent,
|
|
38
|
+
MarkerDiamondComponent,
|
|
39
|
+
MarkerSquareComponent,
|
|
40
|
+
MarkerTeeComponent
|
|
41
|
+
]
|
|
42
|
+
})
|
|
43
|
+
export class MarkerModule {}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export {
|
|
2
|
+
MarkerComponent,
|
|
3
|
+
MarkerArrowLeftComponent,
|
|
4
|
+
MarkerArrowRightComponent,
|
|
5
|
+
MarkerShapeNodeComponent,
|
|
6
|
+
MarkerDiamondComponent,
|
|
7
|
+
MarkerSquareComponent,
|
|
8
|
+
MarkerTeeComponent,
|
|
9
|
+
MarkerModule
|
|
10
|
+
} from './edges/marker/marker.module'
|
|
11
|
+
|
|
12
|
+
export { EdgeComponent, EdgeModule } from './edges/edge.module'
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
CardNodeComponent,
|
|
16
|
+
CardNodeColumnComponent,
|
|
17
|
+
CardNodeLabelComponent,
|
|
18
|
+
CardNodeSubtitleComponent,
|
|
19
|
+
CardNodeTitleComponent,
|
|
20
|
+
CardNodeModule
|
|
21
|
+
} from './nodes/cards/card-node.module'
|
|
22
|
+
|
|
23
|
+
export { ShapeNodeComponent, ShapeNodeModule } from './nodes/shape/shape-node.module'
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Component, Input, HostBinding } from '@angular/core'
|
|
2
|
+
import { carbonPrefix } from '../../config'
|
|
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,14 @@
|
|
|
1
|
+
import { Component } from '@angular/core'
|
|
2
|
+
import { carbonPrefix } from '../../config'
|
|
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
|
+
export class CardNodeLabelComponent {
|
|
13
|
+
namespace = `${carbonPrefix}--cc--card-node__label`
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component } from '@angular/core'
|
|
2
|
+
import { carbonPrefix } from '../../config'
|
|
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
|
+
export class CardNodeSubtitleComponent {
|
|
13
|
+
namespace = `${carbonPrefix}--cc--card-node__subtitle`
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component } from '@angular/core'
|
|
2
|
+
import { carbonPrefix } from '../../config'
|
|
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
|
+
export class CardNodeTitleComponent {
|
|
13
|
+
namespace = `${carbonPrefix}--cc--card-node__title`
|
|
14
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core'
|
|
2
|
+
import { carbonPrefix } from '../../config'
|
|
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
|
+
<ng-container *ngTemplateOutlet="nodeTemplate"></ng-container>
|
|
26
|
+
</xhtml:div>
|
|
27
|
+
|
|
28
|
+
<xhtml:button
|
|
29
|
+
*ngSwitchCase="'button'"
|
|
30
|
+
[ngClass]="[
|
|
31
|
+
namespace,
|
|
32
|
+
stacked ? namespace + '--stacked' : '',
|
|
33
|
+
namespace + '--' + component
|
|
34
|
+
]"
|
|
35
|
+
[ngStyle]="{
|
|
36
|
+
'border-color': color,
|
|
37
|
+
position: position
|
|
38
|
+
}"
|
|
39
|
+
(click)="click.emit($event)"
|
|
40
|
+
(mouseenter)="mouseEnter.emit($event)"
|
|
41
|
+
(mouseover)="mouseOver.emit($event)"
|
|
42
|
+
(mouseout)="mouseOut.emit($event)"
|
|
43
|
+
(mouseleave)="mouseLeave.emit($event)"
|
|
44
|
+
(mousemove)="mouseMove.emit($event)"
|
|
45
|
+
tabindex="0">
|
|
46
|
+
<ng-container *ngTemplateOutlet="nodeTemplate"></ng-container>
|
|
47
|
+
</xhtml:button>
|
|
48
|
+
|
|
49
|
+
<xhtml:a
|
|
50
|
+
*ngSwitchCase="'a'"
|
|
51
|
+
[ngClass]="[
|
|
52
|
+
namespace,
|
|
53
|
+
stacked ? namespace + '--stacked' : '',
|
|
54
|
+
namespace + '--' + component
|
|
55
|
+
]"
|
|
56
|
+
[attr.href]="href"
|
|
57
|
+
[ngStyle]="{ 'border-color': color, position: position }"
|
|
58
|
+
(mouseenter)="mouseEnter.emit($event)"
|
|
59
|
+
(mouseover)="mouseOver.emit($event)"
|
|
60
|
+
(mouseout)="mouseOut.emit($event)"
|
|
61
|
+
(mouseleave)="mouseLeave.emit($event)"
|
|
62
|
+
(mousemove)="mouseMove.emit($event)"
|
|
63
|
+
tabindex="0">
|
|
64
|
+
<ng-container *ngTemplateOutlet="nodeTemplate"></ng-container>
|
|
65
|
+
</xhtml:a>
|
|
66
|
+
</ng-container>
|
|
67
|
+
<ng-template #nodeTemplate>
|
|
68
|
+
<ng-content></ng-content>
|
|
69
|
+
</ng-template>
|
|
70
|
+
`
|
|
71
|
+
})
|
|
72
|
+
export class CardNodeComponent implements OnInit {
|
|
73
|
+
@Input() as = 'div'
|
|
74
|
+
@Input() href = ''
|
|
75
|
+
@Input() color = ''
|
|
76
|
+
@Input() stacked = false
|
|
77
|
+
@Input() position = 'static'
|
|
78
|
+
|
|
79
|
+
// eslint-disable-next-line @angular-eslint/no-output-native
|
|
80
|
+
@Output() click: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>()
|
|
81
|
+
@Output() mouseEnter: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>()
|
|
82
|
+
@Output() mouseOver: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>()
|
|
83
|
+
@Output() mouseOut: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>()
|
|
84
|
+
@Output() mouseLeave: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>()
|
|
85
|
+
@Output() mouseMove: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>()
|
|
86
|
+
|
|
87
|
+
namespace = `${carbonPrefix}--cc--card-node`
|
|
88
|
+
|
|
89
|
+
component = 'div'
|
|
90
|
+
|
|
91
|
+
ngOnInit() {
|
|
92
|
+
if (this.href) {
|
|
93
|
+
this.component = 'a'
|
|
94
|
+
} else {
|
|
95
|
+
this.component = this.as
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 {
|
|
9
|
+
CardNodeComponent,
|
|
10
|
+
CardNodeColumnComponent,
|
|
11
|
+
CardNodeLabelComponent,
|
|
12
|
+
CardNodeSubtitleComponent,
|
|
13
|
+
CardNodeTitleComponent
|
|
14
|
+
}
|
|
15
|
+
@NgModule({
|
|
16
|
+
declarations: [
|
|
17
|
+
CardNodeComponent,
|
|
18
|
+
CardNodeColumnComponent,
|
|
19
|
+
CardNodeLabelComponent,
|
|
20
|
+
CardNodeSubtitleComponent,
|
|
21
|
+
CardNodeTitleComponent
|
|
22
|
+
],
|
|
23
|
+
imports: [CommonModule],
|
|
24
|
+
exports: [
|
|
25
|
+
CardNodeComponent,
|
|
26
|
+
CardNodeColumnComponent,
|
|
27
|
+
CardNodeLabelComponent,
|
|
28
|
+
CardNodeSubtitleComponent,
|
|
29
|
+
CardNodeTitleComponent
|
|
30
|
+
]
|
|
31
|
+
})
|
|
32
|
+
export class CardNodeModule {}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, TemplateRef, OnInit } from '@angular/core'
|
|
2
|
+
import { carbonPrefix } from '../../config'
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'ibm-diagram-shape-node',
|
|
6
|
+
template: `
|
|
7
|
+
<ng-container [ngSwitch]="component">
|
|
8
|
+
<xhtml:div
|
|
9
|
+
*ngSwitchCase="'div'"
|
|
10
|
+
[ngClass]="[
|
|
11
|
+
namespace,
|
|
12
|
+
stacked ? namespace + '--stacked' : '',
|
|
13
|
+
shape ? namespace + '--' + shape : '',
|
|
14
|
+
namespace + '--' + component
|
|
15
|
+
]"
|
|
16
|
+
[ngStyle]="{
|
|
17
|
+
'height.px': size,
|
|
18
|
+
'width.px': size,
|
|
19
|
+
position: position
|
|
20
|
+
}"
|
|
21
|
+
(mouseenter)="mouseEnter.emit($event)"
|
|
22
|
+
(mouseover)="mouseOver.emit($event)"
|
|
23
|
+
(mouseout)="mouseOut.emit($event)"
|
|
24
|
+
(mouseleave)="mouseLeave.emit($event)"
|
|
25
|
+
(mousemove)="mouseMove.emit($event)"
|
|
26
|
+
tabindex="0">
|
|
27
|
+
<ng-container *ngTemplateOutlet="nodeTemplate"></ng-container>
|
|
28
|
+
</xhtml:div>
|
|
29
|
+
|
|
30
|
+
<xhtml:button
|
|
31
|
+
*ngSwitchCase="'button'"
|
|
32
|
+
[ngClass]="[
|
|
33
|
+
namespace,
|
|
34
|
+
stacked ? namespace + '--stacked' : '',
|
|
35
|
+
shape ? namespace + '--' + shape : '',
|
|
36
|
+
namespace + '--' + component
|
|
37
|
+
]"
|
|
38
|
+
[ngStyle]="{
|
|
39
|
+
'height.px': size,
|
|
40
|
+
'width.px': size,
|
|
41
|
+
position: position
|
|
42
|
+
}"
|
|
43
|
+
(click)="click.emit($event)"
|
|
44
|
+
(mouseenter)="mouseEnter.emit($event)"
|
|
45
|
+
(mouseover)="mouseOver.emit($event)"
|
|
46
|
+
(mouseout)="mouseOut.emit($event)"
|
|
47
|
+
(mouseleave)="mouseLeave.emit($event)"
|
|
48
|
+
(mousemove)="mouseMove.emit($event)"
|
|
49
|
+
tabindex="0">
|
|
50
|
+
<ng-container *ngTemplateOutlet="nodeTemplate"></ng-container>
|
|
51
|
+
</xhtml:button>
|
|
52
|
+
|
|
53
|
+
<xhtml:a
|
|
54
|
+
*ngSwitchCase="'a'"
|
|
55
|
+
[ngClass]="[
|
|
56
|
+
namespace,
|
|
57
|
+
stacked ? namespace + '--stacked' : '',
|
|
58
|
+
shape ? namespace + '--' + shape : '',
|
|
59
|
+
namespace + '--' + component
|
|
60
|
+
]"
|
|
61
|
+
[attr.href]="href"
|
|
62
|
+
[ngStyle]="{
|
|
63
|
+
'height.px': size,
|
|
64
|
+
'width.px': size,
|
|
65
|
+
position: position
|
|
66
|
+
}"
|
|
67
|
+
(mouseenter)="mouseEnter.emit($event)"
|
|
68
|
+
(mouseover)="mouseOver.emit($event)"
|
|
69
|
+
(mouseout)="mouseOut.emit($event)"
|
|
70
|
+
(mouseleave)="mouseLeave.emit($event)"
|
|
71
|
+
(mousemove)="mouseMove.emit($event)"
|
|
72
|
+
tabindex="0">
|
|
73
|
+
<ng-container *ngTemplateOutlet="nodeTemplate"></ng-container>
|
|
74
|
+
</xhtml:a>
|
|
75
|
+
</ng-container>
|
|
76
|
+
|
|
77
|
+
<ng-template #nodeTemplate>
|
|
78
|
+
<div *ngIf="renderIcon" attr.class="{{ namespace + '__icon' }}">
|
|
79
|
+
<ng-container *ngTemplateOutlet="renderIcon"></ng-container>
|
|
80
|
+
</div>
|
|
81
|
+
<div attr.class="{{ namespace + '__body' }}" [ngStyle]="{ position: bodyPosition }">
|
|
82
|
+
<div attr.class="{{ namespace + '__title' }}">{{ title }}</div>
|
|
83
|
+
<div attr.class="{{ namespace + '__subtitle' }}">
|
|
84
|
+
{{ subtitle }}
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
</ng-template>
|
|
88
|
+
`
|
|
89
|
+
})
|
|
90
|
+
export class ShapeNodeComponent implements OnInit {
|
|
91
|
+
@Input() as = 'div'
|
|
92
|
+
@Input() href = ''
|
|
93
|
+
@Input() renderIcon?: TemplateRef<void>
|
|
94
|
+
@Input() size = 48
|
|
95
|
+
@Input() stacked = false
|
|
96
|
+
@Input() shape: 'circle' | 'square' | 'rounded-square' = 'circle'
|
|
97
|
+
@Input() subtitle = ''
|
|
98
|
+
@Input() title = ''
|
|
99
|
+
@Input() position = 'fixed'
|
|
100
|
+
@Input() bodyPosition = 'absolute'
|
|
101
|
+
|
|
102
|
+
// eslint-disable-next-line @angular-eslint/no-output-native
|
|
103
|
+
@Output() click: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>()
|
|
104
|
+
@Output() mouseEnter: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>()
|
|
105
|
+
@Output() mouseOver: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>()
|
|
106
|
+
@Output() mouseOut: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>()
|
|
107
|
+
@Output() mouseLeave: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>()
|
|
108
|
+
@Output() mouseMove: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>()
|
|
109
|
+
|
|
110
|
+
namespace = `${carbonPrefix}--cc--shape-node`
|
|
111
|
+
component = 'div'
|
|
112
|
+
|
|
113
|
+
ngOnInit() {
|
|
114
|
+
if (this.href) {
|
|
115
|
+
this.component = 'a'
|
|
116
|
+
} else {
|
|
117
|
+
this.component = this.as
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -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
|
+
imports: [CommonModule],
|
|
9
|
+
exports: [ShapeNodeComponent]
|
|
10
|
+
})
|
|
11
|
+
export class ShapeNodeModule {}
|
package/src/lib/index.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export {
|
|
2
|
+
AlluvialChartComponent,
|
|
3
|
+
AreaChartComponent,
|
|
4
|
+
BaseChartComponent,
|
|
5
|
+
BoxplotChartComponent,
|
|
6
|
+
BubbleChartComponent,
|
|
7
|
+
BulletChartComponent,
|
|
8
|
+
ChartsModule,
|
|
9
|
+
CirclePackChartComponent,
|
|
10
|
+
ComboChartComponent,
|
|
11
|
+
DonutChartComponent,
|
|
12
|
+
ExperimentalChoroplethChartComponent,
|
|
13
|
+
GaugeChartComponent,
|
|
14
|
+
GroupedBarChartComponent,
|
|
15
|
+
HeatmapChartComponent,
|
|
16
|
+
HistogramChartComponent,
|
|
17
|
+
LineChartComponent,
|
|
18
|
+
LollipopChartComponent,
|
|
19
|
+
MeterChartComponent,
|
|
20
|
+
PieChartComponent,
|
|
21
|
+
RadarChartComponent,
|
|
22
|
+
ScatterChartComponent,
|
|
23
|
+
SimpleBarChartComponent,
|
|
24
|
+
StackedAreaChartComponent,
|
|
25
|
+
StackedBarChartComponent,
|
|
26
|
+
TreeChartComponent,
|
|
27
|
+
TreemapChartComponent,
|
|
28
|
+
WordCloudChartComponent
|
|
29
|
+
} from './charts'
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
CardNodeColumnComponent,
|
|
33
|
+
CardNodeComponent,
|
|
34
|
+
CardNodeLabelComponent,
|
|
35
|
+
CardNodeSubtitleComponent,
|
|
36
|
+
CardNodeTitleComponent,
|
|
37
|
+
CardNodeModule,
|
|
38
|
+
EdgeComponent,
|
|
39
|
+
EdgeModule,
|
|
40
|
+
MarkerArrowLeftComponent,
|
|
41
|
+
MarkerArrowRightComponent,
|
|
42
|
+
MarkerComponent,
|
|
43
|
+
MarkerDiamondComponent,
|
|
44
|
+
MarkerModule,
|
|
45
|
+
MarkerShapeNodeComponent,
|
|
46
|
+
MarkerSquareComponent,
|
|
47
|
+
MarkerTeeComponent,
|
|
48
|
+
ShapeNodeComponent,
|
|
49
|
+
ShapeNodeModule
|
|
50
|
+
} from './diagrams'
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Meta } from '@storybook/blocks'
|
|
2
|
+
|
|
3
|
+
<Meta title="Docs/Tutorials/API" />
|
|
4
|
+
|
|
5
|
+
# API (Vanilla JavaScript)
|
|
6
|
+
|
|
7
|
+
When initializing an object using any of our exposed chart types (e.g. PieChart), the object that you'll receive includes many useful elements inside it.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
const myChart = new PieChart({
|
|
11
|
+
data: ...,
|
|
12
|
+
options: ...
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
console.log(myChart)
|
|
16
|
+
|
|
17
|
+
// RESULT
|
|
18
|
+
{
|
|
19
|
+
model, // where we store charting data & options
|
|
20
|
+
services, // globalized functions that can affect charting behaviour. (e.g. event listener dispatching etc.)
|
|
21
|
+
components // internally used for arranging the charting layout, you can disregard this
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
<br/>
|
|
26
|
+
## Data updates
|
|
27
|
+
Data updates are done through the model.
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
const myChart = new PieChart({
|
|
31
|
+
data: ...,
|
|
32
|
+
options: ...
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
myChart.model.setData(...)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Similarly, `myChart.model.getData();` & `myChart.model.getDisplayData();` can provide you the full data that's stored or only the portion that's currently being displayed.
|
|
39
|
+
|
|
40
|
+
<br/>
|
|
41
|
+
## Option updates
|
|
42
|
+
Options updates are also done through the model.
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
const myChart = new PieChart({
|
|
46
|
+
data: ...,
|
|
47
|
+
options: ...
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
myChart.model.setOptions(...)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Similarly, `myChart.model.getOptions();` will provide you with the options that are stored.
|
|
54
|
+
|
|
55
|
+
## What are services?
|
|
56
|
+
Services are globalized functions that have proven useful across the board. General tasks such as event dispatching, transition handling, DOM-related activities etc. are handled by services.
|
|
57
|
+
|
|
58
|
+
**Example:**
|
|
59
|
+
|
|
60
|
+
Event listeners can be added through the events service:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
barChart.services.events.addEventListener("bar-mouseover", e => console.log(e.detail))
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## API Reference
|
|
67
|
+
Our full API reference docs can be found [here](https://carbon-design-system.github.io/carbon-charts/documentation/).
|
|
68
|
+
|
|
69
|
+
To get an idea of all the possible configurations in every chart type, see [here](https://carbon-design-system.github.io/carbon-charts/documentation/modules/_interfaces_charts_.html).
|