@carbon/charts-angular 1.9.0-rc.1 → 1.9.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/angular.json +91 -0
- package/carbon.yml +277 -0
- package/ng-package.json +14 -0
- package/package.json +71 -17
- 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/{lib/charts/index.d.ts → src/lib/charts/index.ts} +28 -27
- 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/esm2022/carbon-charts-angular.mjs +0 -5
- package/esm2022/index.mjs +0 -14
- package/esm2022/lib/charts/alluvial-chart.component.mjs +0 -32
- package/esm2022/lib/charts/area-chart-stacked.component.mjs +0 -32
- package/esm2022/lib/charts/area-chart.component.mjs +0 -32
- package/esm2022/lib/charts/bar-chart-grouped.component.mjs +0 -32
- package/esm2022/lib/charts/bar-chart-simple.component.mjs +0 -32
- package/esm2022/lib/charts/bar-chart-stacked.component.mjs +0 -32
- package/esm2022/lib/charts/base-chart.component.mjs +0 -75
- package/esm2022/lib/charts/boxplot-chart.component.mjs +0 -32
- package/esm2022/lib/charts/bubble-chart.component.mjs +0 -32
- package/esm2022/lib/charts/bullet-chart.component.mjs +0 -32
- package/esm2022/lib/charts/charts.module.mjs +0 -123
- package/esm2022/lib/charts/choropleth.component.mjs +0 -32
- package/esm2022/lib/charts/circle-pack-chart.component.mjs +0 -32
- package/esm2022/lib/charts/combo-chart.component.mjs +0 -32
- package/esm2022/lib/charts/donut-chart.component.mjs +0 -32
- package/esm2022/lib/charts/gauge-chart.component.mjs +0 -32
- package/esm2022/lib/charts/heatmap-chart.component.mjs +0 -32
- package/esm2022/lib/charts/histogram-chart.component.mjs +0 -32
- package/esm2022/lib/charts/index.mjs +0 -28
- package/esm2022/lib/charts/line-chart.component.mjs +0 -32
- package/esm2022/lib/charts/lollipop-chart.component.mjs +0 -32
- package/esm2022/lib/charts/meter-chart.component.mjs +0 -32
- package/esm2022/lib/charts/pie-chart.component.mjs +0 -32
- package/esm2022/lib/charts/radar-chart.component.mjs +0 -32
- package/esm2022/lib/charts/scatter-chart.component.mjs +0 -32
- package/esm2022/lib/charts/tree-chart.component.mjs +0 -32
- package/esm2022/lib/charts/treemap-chart.component.mjs +0 -32
- package/esm2022/lib/charts/wordcloud-chart.component.mjs +0 -32
- package/esm2022/lib/diagrams/config.mjs +0 -2
- package/esm2022/lib/diagrams/edges/edge.component.mjs +0 -73
- package/esm2022/lib/diagrams/edges/edge.module.mjs +0 -20
- package/esm2022/lib/diagrams/edges/marker/marker.component.mjs +0 -161
- package/esm2022/lib/diagrams/edges/marker/marker.module.mjs +0 -48
- package/esm2022/lib/diagrams/index.mjs +0 -5
- package/esm2022/lib/diagrams/nodes/cards/card-node-column.component.mjs +0 -38
- package/esm2022/lib/diagrams/nodes/cards/card-node-label.component.mjs +0 -28
- package/esm2022/lib/diagrams/nodes/cards/card-node-subtitle.component.mjs +0 -28
- package/esm2022/lib/diagrams/nodes/cards/card-node-title.component.mjs +0 -28
- package/esm2022/lib/diagrams/nodes/cards/card-node.component.mjs +0 -191
- package/esm2022/lib/diagrams/nodes/cards/card-node.module.mjs +0 -44
- package/esm2022/lib/diagrams/nodes/shape/shape-node.component.mjs +0 -241
- package/esm2022/lib/diagrams/nodes/shape/shape-node.module.mjs +0 -20
- package/esm2022/lib/index.mjs +0 -3
- package/fesm2022/carbon-charts-angular.mjs +0 -1728
- package/fesm2022/carbon-charts-angular.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/charts/alluvial-chart.component.d.ts +0 -16
- package/lib/charts/area-chart-stacked.component.d.ts +0 -16
- package/lib/charts/area-chart.component.d.ts +0 -16
- package/lib/charts/bar-chart-grouped.component.d.ts +0 -16
- package/lib/charts/bar-chart-simple.component.d.ts +0 -16
- package/lib/charts/bar-chart-stacked.component.d.ts +0 -16
- package/lib/charts/base-chart.component.d.ts +0 -46
- package/lib/charts/boxplot-chart.component.d.ts +0 -16
- package/lib/charts/bubble-chart.component.d.ts +0 -16
- package/lib/charts/bullet-chart.component.d.ts +0 -16
- package/lib/charts/charts.module.d.ts +0 -33
- package/lib/charts/choropleth.component.d.ts +0 -16
- package/lib/charts/circle-pack-chart.component.d.ts +0 -16
- package/lib/charts/combo-chart.component.d.ts +0 -16
- package/lib/charts/donut-chart.component.d.ts +0 -16
- package/lib/charts/gauge-chart.component.d.ts +0 -16
- package/lib/charts/heatmap-chart.component.d.ts +0 -16
- package/lib/charts/histogram-chart.component.d.ts +0 -16
- package/lib/charts/line-chart.component.d.ts +0 -16
- package/lib/charts/lollipop-chart.component.d.ts +0 -16
- package/lib/charts/meter-chart.component.d.ts +0 -16
- package/lib/charts/pie-chart.component.d.ts +0 -16
- package/lib/charts/radar-chart.component.d.ts +0 -16
- package/lib/charts/scatter-chart.component.d.ts +0 -16
- package/lib/charts/tree-chart.component.d.ts +0 -16
- package/lib/charts/treemap-chart.component.d.ts +0 -16
- package/lib/charts/wordcloud-chart.component.d.ts +0 -16
- package/lib/diagrams/config.d.ts +0 -1
- package/lib/diagrams/edges/edge.component.d.ts +0 -20
- package/lib/diagrams/edges/edge.module.d.ts +0 -9
- package/lib/diagrams/edges/marker/marker.component.d.ts +0 -52
- package/lib/diagrams/edges/marker/marker.module.d.ts +0 -10
- package/lib/diagrams/index.d.ts +0 -4
- package/lib/diagrams/nodes/cards/card-node-column.component.d.ts +0 -7
- package/lib/diagrams/nodes/cards/card-node-label.component.d.ts +0 -6
- package/lib/diagrams/nodes/cards/card-node-subtitle.component.d.ts +0 -6
- package/lib/diagrams/nodes/cards/card-node-title.component.d.ts +0 -6
- package/lib/diagrams/nodes/cards/card-node.component.d.ts +0 -20
- package/lib/diagrams/nodes/cards/card-node.module.d.ts +0 -18
- package/lib/diagrams/nodes/shape/shape-node.component.d.ts +0 -25
- package/lib/diagrams/nodes/shape/shape-node.module.d.ts +0 -9
- package/lib/index.d.ts +0 -2
- package/styles.css +0 -28264
- package/styles.css.map +0 -1
- package/styles.min.css +0 -1
- package/styles.min.css.map +0 -1
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { storiesOf, moduleMetadata } from '@storybook/angular'
|
|
2
|
+
import { buildElbowPathString, type Coordinates } from '@carbon/charts'
|
|
3
|
+
import { UserModule, WikisModule } from '@carbon/icons-angular'
|
|
4
|
+
import { CardNodeModule, EdgeModule, MarkerModule, ShapeNodeModule } from '../../'
|
|
5
|
+
import { getTemplate } from './utils'
|
|
6
|
+
|
|
7
|
+
const nodeHeight = 64
|
|
8
|
+
const nodeWidth = 200
|
|
9
|
+
const circleSize = 64
|
|
10
|
+
|
|
11
|
+
const stories = storiesOf('Diagrams', module)
|
|
12
|
+
stories.addDecorator(
|
|
13
|
+
moduleMetadata({
|
|
14
|
+
imports: [ShapeNodeModule, CardNodeModule, EdgeModule, MarkerModule, UserModule, WikisModule]
|
|
15
|
+
})
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
stories.add(
|
|
19
|
+
'Start here',
|
|
20
|
+
() => ({
|
|
21
|
+
template: getTemplate(`
|
|
22
|
+
<div>
|
|
23
|
+
<h1>Diagrams</h1>
|
|
24
|
+
|
|
25
|
+
<p style='max-width: 600px; font-size: 1rem; font-weight: 400; line-height: 1.5; letter-spacing: 0'>
|
|
26
|
+
Angular components for building diagram experiences, using the Carbon Design System.
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
<p style='max-width: 600px; font-size: 1rem; font-weight: 400; line-height: 1.5; letter-spacing: 0'>
|
|
30
|
+
<b>Note that Carbon Charts does not provide layouts for diagrams.
|
|
31
|
+
You can utilize these components alongside graphing libraries,
|
|
32
|
+
or by composing your own layouts (see section 3).</b>
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
<h2 style='padding-top: 2rem'>Examples</h2>
|
|
36
|
+
|
|
37
|
+
<h3 style='padding-top: 1rem'>1. Simple static layout</h3>
|
|
38
|
+
|
|
39
|
+
<p style='max-width: 600px; font-size: 1rem; font-weight: 400; line-height: 1.5; letter-spacing: 0'>
|
|
40
|
+
A simple composed diagram, using statically defined x and y
|
|
41
|
+
coordinates.
|
|
42
|
+
<a href="https://github.com/carbon-design-system/carbon-charts/tree/master/packages/angular/stories/diagrams/0_diagram.stories.ts">
|
|
43
|
+
View source
|
|
44
|
+
</a>
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
${SimpleStatic}
|
|
48
|
+
|
|
49
|
+
<h3 style='padding-top: 1rem'>2. Programmatic static layout</h3>
|
|
50
|
+
|
|
51
|
+
<p style='max-width: 600px; font-size: 1rem; font-weight: 400; line-height: 1.5; letter-spacing: 0'>
|
|
52
|
+
A composed diagram, rendered using arrays of statically defined
|
|
53
|
+
x and y coordinates.
|
|
54
|
+
<a href="https://github.com/carbon-design-system/carbon-charts/tree/master/packages/angular/stories/diagrams/0_diagram.stories.ts">
|
|
55
|
+
View source
|
|
56
|
+
</a>
|
|
57
|
+
</p>
|
|
58
|
+
|
|
59
|
+
${ProgrammaticStatic}
|
|
60
|
+
|
|
61
|
+
<h3 style='padding-top: 1rem'>3. Layouts using external dependencies</h3>
|
|
62
|
+
|
|
63
|
+
<p>Here's an example using <b>elkjs</b> in <b><u>react</u></b></p>
|
|
64
|
+
|
|
65
|
+
<iframe
|
|
66
|
+
src="https://codesandbox.io/embed/carbon-charts-react-elkjs-diagram-b9xyp?fontsize=14&hidenavigation=1&theme=dark&view=preview"
|
|
67
|
+
style="width: 100%; height: 500px; border: 0; border-radius: 4px; overflow: hidden; margin-top: 2em;"
|
|
68
|
+
title="carbon-charts-react-elkjs-diagram"
|
|
69
|
+
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking"
|
|
70
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"></iframe>
|
|
71
|
+
</div>
|
|
72
|
+
`),
|
|
73
|
+
props: {
|
|
74
|
+
source: { x: 0, y: 48 },
|
|
75
|
+
target: { x: 396, y: 48 },
|
|
76
|
+
markerEnd: 'marker',
|
|
77
|
+
nodeHeight,
|
|
78
|
+
nodeWidth,
|
|
79
|
+
circleSize,
|
|
80
|
+
nodeData,
|
|
81
|
+
edgeMapped
|
|
82
|
+
}
|
|
83
|
+
}),
|
|
84
|
+
{
|
|
85
|
+
controls: {
|
|
86
|
+
hideNoControlsWarning: true
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
const SimpleStatic = `
|
|
92
|
+
<div class="demo-desktop-only">
|
|
93
|
+
<div class="cp-message">This is a desktop-only example</div>
|
|
94
|
+
|
|
95
|
+
<svg height="124" width="600" style="margin-top: 1em;" xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
|
96
|
+
<svg:defs>
|
|
97
|
+
<svg:marker ibm-graph-marker-arrow-right [id]="markerEnd"></svg:marker>
|
|
98
|
+
</svg:defs>
|
|
99
|
+
|
|
100
|
+
<svg:g ibm-graph-edge [source]="source" [target]="target" variant="dash-sm" [markerEnd]="markerEnd" ></svg:g>
|
|
101
|
+
|
|
102
|
+
<svg:foreignObject style="overflow: visible" [attr.height]="nodeHeight" [attr.width]="nodeWidth" [attr.transform]="'translate(0, 16)'">
|
|
103
|
+
<xhtml:div>
|
|
104
|
+
<ibm-diagram-card-node as="button">
|
|
105
|
+
<ibm-diagram-card-node-column>
|
|
106
|
+
<svg ibmIconUser size="20"></svg>
|
|
107
|
+
</ibm-diagram-card-node-column>
|
|
108
|
+
<ibm-diagram-card-node-column>
|
|
109
|
+
<ibm-diagram-card-node-title>
|
|
110
|
+
Title
|
|
111
|
+
</ibm-diagram-card-node-title>
|
|
112
|
+
<ibm-diagram-card-node-subtitle>
|
|
113
|
+
Description
|
|
114
|
+
</ibm-diagram-card-node-subtitle>
|
|
115
|
+
</ibm-diagram-card-node-column>
|
|
116
|
+
</ibm-diagram-card-node>
|
|
117
|
+
</xhtml:div>
|
|
118
|
+
</svg:foreignObject>
|
|
119
|
+
|
|
120
|
+
<svg:foreignObject style="overflow: visible" [attr.height]="nodeHeight" [attr.width]="nodeWidth" [attr.transform]="'translate(400, 16)'">
|
|
121
|
+
<xhtml:div>
|
|
122
|
+
<ibm-diagram-shape-node as="button" title="Title" [size]="circleSize" [renderIcon]="wikiTemplate"></ibm-diagram-shape-node>
|
|
123
|
+
</xhtml:div>
|
|
124
|
+
</svg:foreignObject>
|
|
125
|
+
</svg>
|
|
126
|
+
|
|
127
|
+
<ng-template #wikiTemplate>
|
|
128
|
+
<svg ibmIconWikis size="20"></svg>
|
|
129
|
+
</ng-template>
|
|
130
|
+
</div>
|
|
131
|
+
`
|
|
132
|
+
|
|
133
|
+
const nodeData = [
|
|
134
|
+
{ id: 'a', x: 0, y: 16, icon: 'user', nodeWidth, nodeHeight },
|
|
135
|
+
{ id: 'b', x: 250, y: 16, icon: 'wiki', nodeWidth, nodeHeight },
|
|
136
|
+
{
|
|
137
|
+
id: 'c',
|
|
138
|
+
x: 600,
|
|
139
|
+
y: 200,
|
|
140
|
+
icon: 'user',
|
|
141
|
+
circle: true,
|
|
142
|
+
nodeWidth: circleSize,
|
|
143
|
+
nodeHeight: circleSize
|
|
144
|
+
},
|
|
145
|
+
{ id: 'd', x: 0, y: 150, icon: 'wiki', nodeWidth, nodeHeight }
|
|
146
|
+
]
|
|
147
|
+
|
|
148
|
+
const edgeData = [
|
|
149
|
+
{ source: 'a', target: 'b', variant: 'dash-md' },
|
|
150
|
+
{
|
|
151
|
+
source: 'c',
|
|
152
|
+
target: 'b',
|
|
153
|
+
path: (source: Coordinates, target: Coordinates) => buildElbowPathString(source, target)
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
source: 'd',
|
|
157
|
+
target: 'c',
|
|
158
|
+
path: (source: Coordinates, target: Coordinates) => buildElbowPathString(source, target),
|
|
159
|
+
variant: 'tunnel'
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
|
|
163
|
+
const edgeMapped = edgeData.map((link) => {
|
|
164
|
+
const sourceNode = nodeData.find((node) => node.id === link.source)
|
|
165
|
+
const targetNode = nodeData.find((node) => node.id === link.target)
|
|
166
|
+
|
|
167
|
+
if (!sourceNode || !targetNode)
|
|
168
|
+
throw new Error('Either sourceNode or targetNode were not defined.')
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
...link,
|
|
172
|
+
source: {
|
|
173
|
+
x: sourceNode.x + sourceNode.nodeWidth / 2,
|
|
174
|
+
y: sourceNode.y + sourceNode.nodeHeight / 2
|
|
175
|
+
},
|
|
176
|
+
target: {
|
|
177
|
+
x: targetNode.x + targetNode.nodeWidth / 2,
|
|
178
|
+
y: targetNode.y + targetNode.nodeHeight / 2
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
const ProgrammaticStatic = `
|
|
184
|
+
<div class="demo-desktop-only">
|
|
185
|
+
<div class="cp-message">This is a desktop-only example</div>
|
|
186
|
+
|
|
187
|
+
<svg height="320" width="800" style="margin-top: 1.5em;" xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
|
188
|
+
<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>
|
|
189
|
+
<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}})">
|
|
190
|
+
<xhtml:div *ngIf="node.circle">
|
|
191
|
+
<ibm-diagram-shape-node as="button" [title]="'Title'" [subtitle]="'Description'" [size]="circleSize" [renderIcon]="(node.icon === 'user') ? userTemplate : wikiTemplate"></ibm-diagram-shape-node>
|
|
192
|
+
</xhtml:div>
|
|
193
|
+
<xhtml:div *ngIf="!node.circle">
|
|
194
|
+
<ibm-diagram-card-node as="button">
|
|
195
|
+
<ibm-diagram-card-node-column>
|
|
196
|
+
<svg ibmIconUser size="20"></svg>
|
|
197
|
+
</ibm-diagram-card-node-column>
|
|
198
|
+
<ibm-diagram-card-node-column>
|
|
199
|
+
<ibm-diagram-card-node-title>
|
|
200
|
+
Title
|
|
201
|
+
</ibm-diagram-card-node-title>
|
|
202
|
+
<ibm-diagram-card-node-subtitle>
|
|
203
|
+
Description
|
|
204
|
+
</ibm-diagram-card-node-subtitle>
|
|
205
|
+
</ibm-diagram-card-node-column>
|
|
206
|
+
</ibm-diagram-card-node>
|
|
207
|
+
</xhtml:div>
|
|
208
|
+
</svg:foreignObject>
|
|
209
|
+
</svg>
|
|
210
|
+
|
|
211
|
+
<ng-template #userTemplate>
|
|
212
|
+
<svg ibmIconUser size="20"></svg>
|
|
213
|
+
</ng-template>
|
|
214
|
+
|
|
215
|
+
<ng-template #wikiTemplate>
|
|
216
|
+
<svg ibmIconWikis size="20"></svg>
|
|
217
|
+
</ng-template>
|
|
218
|
+
</div>
|
|
219
|
+
`
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { storiesOf, moduleMetadata } from '@storybook/angular'
|
|
2
|
+
import { EdgeModule, MarkerModule } from '../../'
|
|
3
|
+
import { getTemplate } from './utils'
|
|
4
|
+
|
|
5
|
+
const linkSource = { x: 0, y: 0 }
|
|
6
|
+
const linkTarget = { x: 300, y: 0 }
|
|
7
|
+
|
|
8
|
+
storiesOf('Diagrams/Edges/Marker', module)
|
|
9
|
+
.addDecorator(
|
|
10
|
+
moduleMetadata({
|
|
11
|
+
imports: [MarkerModule, EdgeModule]
|
|
12
|
+
})
|
|
13
|
+
)
|
|
14
|
+
.add(
|
|
15
|
+
'Arrow left',
|
|
16
|
+
() => ({
|
|
17
|
+
template: getTemplate(`
|
|
18
|
+
<svg height="400" width="400">
|
|
19
|
+
<svg:defs>
|
|
20
|
+
<svg:marker ibm-graph-marker-arrow-left [id]="markerStart"></svg:marker>
|
|
21
|
+
</svg:defs>
|
|
22
|
+
<svg:g transform="translate(16,16)">
|
|
23
|
+
<svg:g ibm-graph-edge [source]="source" [target]="target" [markerStart]="markerStart"></svg:g>
|
|
24
|
+
</svg:g>
|
|
25
|
+
</svg>
|
|
26
|
+
`),
|
|
27
|
+
props: {
|
|
28
|
+
source: linkSource,
|
|
29
|
+
target: linkTarget,
|
|
30
|
+
markerStart: 'marker'
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
{
|
|
34
|
+
controls: {
|
|
35
|
+
hideNoControlsWarning: true
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
.add(
|
|
40
|
+
'Arrow Right',
|
|
41
|
+
() => ({
|
|
42
|
+
template: getTemplate(`
|
|
43
|
+
<svg height="400" width="400">
|
|
44
|
+
<svg:defs>
|
|
45
|
+
<svg:marker ibm-graph-marker-arrow-right [id]="markerEnd"></svg:marker>
|
|
46
|
+
</svg:defs>
|
|
47
|
+
<svg:g transform="translate(16,16)">
|
|
48
|
+
<svg:g ibm-graph-edge [source]="source" [target]="target" [markerEnd]="markerEnd"></svg:g>
|
|
49
|
+
</svg:g>
|
|
50
|
+
</svg>
|
|
51
|
+
`),
|
|
52
|
+
props: {
|
|
53
|
+
source: linkSource,
|
|
54
|
+
target: linkTarget,
|
|
55
|
+
markerEnd: 'marker'
|
|
56
|
+
}
|
|
57
|
+
}),
|
|
58
|
+
{
|
|
59
|
+
controls: {
|
|
60
|
+
hideNoControlsWarning: true
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
.add(
|
|
65
|
+
'Circle',
|
|
66
|
+
() => ({
|
|
67
|
+
template: getTemplate(`
|
|
68
|
+
<svg height="400" width="400">
|
|
69
|
+
<svg:defs>
|
|
70
|
+
<svg:marker ibm-graph-marker-circle [id]="markerStart"></svg:marker>
|
|
71
|
+
</svg:defs>
|
|
72
|
+
<svg:g transform="translate(16,16)">
|
|
73
|
+
<svg:g ibm-graph-edge [source]="source" [target]="target" [markerStart]="markerStart"></svg:g>
|
|
74
|
+
</svg:g>
|
|
75
|
+
</svg>
|
|
76
|
+
`),
|
|
77
|
+
props: {
|
|
78
|
+
source: linkSource,
|
|
79
|
+
target: linkTarget,
|
|
80
|
+
markerStart: 'marker'
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
83
|
+
{
|
|
84
|
+
controls: {
|
|
85
|
+
hideNoControlsWarning: true
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
.add(
|
|
90
|
+
'Diamond',
|
|
91
|
+
() => ({
|
|
92
|
+
template: getTemplate(`
|
|
93
|
+
<svg height="400" width="400">
|
|
94
|
+
<svg:defs>
|
|
95
|
+
<svg:marker ibm-graph-marker-diamond [id]="markerStart"></svg:marker>
|
|
96
|
+
</svg:defs>
|
|
97
|
+
<svg:g transform="translate(16,16)">
|
|
98
|
+
<svg:g ibm-graph-edge [source]="source" [target]="target" [markerStart]="markerStart"></svg:g>
|
|
99
|
+
</svg:g>
|
|
100
|
+
</svg>
|
|
101
|
+
`),
|
|
102
|
+
props: {
|
|
103
|
+
source: linkSource,
|
|
104
|
+
target: linkTarget,
|
|
105
|
+
markerStart: 'marker'
|
|
106
|
+
}
|
|
107
|
+
}),
|
|
108
|
+
{
|
|
109
|
+
controls: {
|
|
110
|
+
hideNoControlsWarning: true
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
.add(
|
|
115
|
+
'Square',
|
|
116
|
+
() => ({
|
|
117
|
+
template: getTemplate(`
|
|
118
|
+
<svg height="400" width="400">
|
|
119
|
+
<svg:defs>
|
|
120
|
+
<svg:marker ibm-graph-marker-square [id]="markerStart"></svg:marker>
|
|
121
|
+
</svg:defs>
|
|
122
|
+
<svg:g transform="translate(16,16)">
|
|
123
|
+
<svg:g ibm-graph-edge [source]="source" [target]="target" [markerStart]="markerStart"></svg:g>
|
|
124
|
+
</svg:g>
|
|
125
|
+
</svg>
|
|
126
|
+
`),
|
|
127
|
+
props: {
|
|
128
|
+
source: linkSource,
|
|
129
|
+
target: linkTarget,
|
|
130
|
+
markerStart: 'marker'
|
|
131
|
+
}
|
|
132
|
+
}),
|
|
133
|
+
{
|
|
134
|
+
controls: {
|
|
135
|
+
hideNoControlsWarning: true
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
.add(
|
|
140
|
+
'Tee',
|
|
141
|
+
() => ({
|
|
142
|
+
template: getTemplate(`
|
|
143
|
+
<svg height="400" width="400">
|
|
144
|
+
<svg:defs>
|
|
145
|
+
<svg:marker ibm-graph-marker-tee [id]="markerStart"></svg:marker>
|
|
146
|
+
</svg:defs>
|
|
147
|
+
<svg:g transform="translate(16,16)">
|
|
148
|
+
<svg:g ibm-graph-edge [source]="source" [target]="target" [markerStart]="markerStart"></svg:g>
|
|
149
|
+
</svg:g>
|
|
150
|
+
</svg>
|
|
151
|
+
`),
|
|
152
|
+
props: {
|
|
153
|
+
source: linkSource,
|
|
154
|
+
target: linkTarget,
|
|
155
|
+
markerStart: 'marker'
|
|
156
|
+
}
|
|
157
|
+
}),
|
|
158
|
+
{
|
|
159
|
+
controls: {
|
|
160
|
+
hideNoControlsWarning: true
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
.add(
|
|
165
|
+
'Color',
|
|
166
|
+
() => ({
|
|
167
|
+
template: getTemplate(`
|
|
168
|
+
<svg height="400" width="400">
|
|
169
|
+
<svg:defs>
|
|
170
|
+
<svg:marker ibm-graph-marker-tee [id]="markerStart" [color]="color" ></svg:marker>
|
|
171
|
+
</svg:defs>
|
|
172
|
+
<svg:g transform="translate(16,16)">
|
|
173
|
+
<svg:g ibm-graph-edge [source]="source" [target]="target" [markerStart]="markerStart" [color]="color"></svg:g>
|
|
174
|
+
</svg:g>
|
|
175
|
+
</svg>
|
|
176
|
+
`),
|
|
177
|
+
props: {
|
|
178
|
+
source: linkSource,
|
|
179
|
+
target: linkTarget,
|
|
180
|
+
markerStart: 'marker',
|
|
181
|
+
color: '#FB4B53'
|
|
182
|
+
}
|
|
183
|
+
}),
|
|
184
|
+
{
|
|
185
|
+
controls: {
|
|
186
|
+
hideNoControlsWarning: true
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
)
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { storiesOf, moduleMetadata } from '@storybook/angular'
|
|
2
|
+
import { EdgeModule } from '../../'
|
|
3
|
+
import { buildBezierPathString, buildElbowPathString } from '@carbon/charts'
|
|
4
|
+
import { getTemplate } from './utils'
|
|
5
|
+
|
|
6
|
+
const linkSource = { x: 0, y: 0 }
|
|
7
|
+
const linkTarget = { x: 400, y: 0 }
|
|
8
|
+
const linkTargetCurve = { x: 400, y: 200 }
|
|
9
|
+
|
|
10
|
+
storiesOf('Diagrams/Edges', module)
|
|
11
|
+
.addDecorator(
|
|
12
|
+
moduleMetadata({
|
|
13
|
+
imports: [EdgeModule]
|
|
14
|
+
})
|
|
15
|
+
)
|
|
16
|
+
.add(
|
|
17
|
+
'Default',
|
|
18
|
+
() => ({
|
|
19
|
+
template: getTemplate(`
|
|
20
|
+
<svg height="800" width="800">
|
|
21
|
+
<g transform="translate(16,16)">
|
|
22
|
+
<g ibm-graph-edge [source]="source" [target]="target"></g>
|
|
23
|
+
</g>
|
|
24
|
+
</svg>
|
|
25
|
+
`),
|
|
26
|
+
props: {
|
|
27
|
+
source: linkSource,
|
|
28
|
+
target: linkTarget
|
|
29
|
+
}
|
|
30
|
+
}),
|
|
31
|
+
{
|
|
32
|
+
controls: {
|
|
33
|
+
hideNoControlsWarning: true
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
.add(
|
|
38
|
+
'Color',
|
|
39
|
+
() => ({
|
|
40
|
+
template: getTemplate(`
|
|
41
|
+
<svg height="800" width="800">
|
|
42
|
+
<g transform="translate(16,16)">
|
|
43
|
+
<g ibm-graph-edge [color]="color" [source]="source" [target]="target"></g>
|
|
44
|
+
</g>
|
|
45
|
+
</svg>
|
|
46
|
+
`),
|
|
47
|
+
props: {
|
|
48
|
+
color: '#FB4B53',
|
|
49
|
+
source: linkSource,
|
|
50
|
+
target: linkTarget
|
|
51
|
+
}
|
|
52
|
+
}),
|
|
53
|
+
{
|
|
54
|
+
controls: {
|
|
55
|
+
hideNoControlsWarning: true
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
.add(
|
|
60
|
+
'Dashed',
|
|
61
|
+
() => ({
|
|
62
|
+
template: getTemplate(`
|
|
63
|
+
<svg height="800" width="800">
|
|
64
|
+
<g transform="translate(16,16)">
|
|
65
|
+
<g ibm-graph-edge [source]="source" [target]="target" variant='dash-sm' />
|
|
66
|
+
</g>
|
|
67
|
+
|
|
68
|
+
<g transform="translate(16,32)">
|
|
69
|
+
<g ibm-graph-edge [source]="source" [target]="target" variant='dash-md' />
|
|
70
|
+
</g>
|
|
71
|
+
|
|
72
|
+
<g transform="translate(16,48)">
|
|
73
|
+
<g ibm-graph-edge [source]="source" [target]="target" variant='dash-lg' />
|
|
74
|
+
</g>
|
|
75
|
+
|
|
76
|
+
<g transform="translate(16,64)">
|
|
77
|
+
<g ibm-graph-edge [source]="source" [target]="target" variant='dash-xl' />
|
|
78
|
+
</g>
|
|
79
|
+
</svg>
|
|
80
|
+
`),
|
|
81
|
+
props: {
|
|
82
|
+
source: linkSource,
|
|
83
|
+
target: linkTarget
|
|
84
|
+
}
|
|
85
|
+
}),
|
|
86
|
+
{
|
|
87
|
+
controls: {
|
|
88
|
+
hideNoControlsWarning: true
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
.add(
|
|
93
|
+
'Double',
|
|
94
|
+
() => ({
|
|
95
|
+
template: getTemplate(`
|
|
96
|
+
<svg height="800" width="800">
|
|
97
|
+
<g transform="translate(16,16)">
|
|
98
|
+
<g ibm-graph-edge [source]="source" [target]="target" variant='double' />
|
|
99
|
+
</g>
|
|
100
|
+
</svg>
|
|
101
|
+
`),
|
|
102
|
+
props: {
|
|
103
|
+
source: linkSource,
|
|
104
|
+
target: linkTarget
|
|
105
|
+
}
|
|
106
|
+
}),
|
|
107
|
+
{
|
|
108
|
+
controls: {
|
|
109
|
+
hideNoControlsWarning: true
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
.add(
|
|
114
|
+
'Tunnel',
|
|
115
|
+
() => ({
|
|
116
|
+
template: getTemplate(`
|
|
117
|
+
<svg height="800" width="800">
|
|
118
|
+
<g transform="translate(16,16)">
|
|
119
|
+
<g ibm-graph-edge [source]="source" [target]="target" variant='tunnel' />
|
|
120
|
+
</g>
|
|
121
|
+
</svg>
|
|
122
|
+
`),
|
|
123
|
+
props: {
|
|
124
|
+
source: linkSource,
|
|
125
|
+
target: linkTarget
|
|
126
|
+
}
|
|
127
|
+
}),
|
|
128
|
+
{
|
|
129
|
+
controls: {
|
|
130
|
+
hideNoControlsWarning: true
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
.add(
|
|
135
|
+
'Elbow',
|
|
136
|
+
() => ({
|
|
137
|
+
template: getTemplate(`
|
|
138
|
+
<svg height="800" width="800">
|
|
139
|
+
<g transform="translate(16,16)">
|
|
140
|
+
<g ibm-graph-edge [source]="source" [target]="target" [path]="path" />
|
|
141
|
+
</g>
|
|
142
|
+
</svg>
|
|
143
|
+
`),
|
|
144
|
+
props: {
|
|
145
|
+
source: linkSource,
|
|
146
|
+
target: linkTarget,
|
|
147
|
+
path: buildElbowPathString(linkSource, linkTargetCurve)
|
|
148
|
+
}
|
|
149
|
+
}),
|
|
150
|
+
{
|
|
151
|
+
controls: {
|
|
152
|
+
hideNoControlsWarning: true
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
.add(
|
|
157
|
+
'Bezier',
|
|
158
|
+
() => ({
|
|
159
|
+
template: getTemplate(`
|
|
160
|
+
<svg height="800" width="800">
|
|
161
|
+
<g transform="translate(16,16)">
|
|
162
|
+
<g ibm-graph-edge [source]="source" [target]="target" [path]="path" />
|
|
163
|
+
</g>
|
|
164
|
+
</svg>
|
|
165
|
+
`),
|
|
166
|
+
props: {
|
|
167
|
+
source: linkSource,
|
|
168
|
+
target: linkTarget,
|
|
169
|
+
path: buildBezierPathString(linkSource, linkTargetCurve, 150, 280, 150, 30)
|
|
170
|
+
}
|
|
171
|
+
}),
|
|
172
|
+
{
|
|
173
|
+
controls: {
|
|
174
|
+
hideNoControlsWarning: true
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
)
|