genesys-spark-chart-components 4.12.1-beta.1
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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/cjs/genesys-chart-webcomponents.cjs.js +23 -0
- package/dist/cjs/gux-chart-column-beta.cjs.entry.js +140 -0
- package/dist/cjs/gux-chart-donut-beta.cjs.entry.js +229 -0
- package/dist/cjs/gux-chart-line-beta.cjs.entry.js +135 -0
- package/dist/cjs/gux-chart-pie-beta.cjs.entry.js +113 -0
- package/dist/cjs/gux-chart-scatter-plot-beta.cjs.entry.js +143 -0
- package/dist/cjs/gux-visualization-beta.cjs.entry.js +71953 -0
- package/dist/cjs/index-1e13a15f.js +1647 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/log-error-c46b4b4c.js +21 -0
- package/dist/cjs/usage-30f04ec3.js +208 -0
- package/dist/collection/collection-manifest.json +17 -0
- package/dist/collection/components/beta/gux-chart-column/gux-chart-column.css +13 -0
- package/dist/collection/components/beta/gux-chart-column/gux-chart-column.js +343 -0
- package/dist/collection/components/beta/gux-chart-column/gux-chart-column.locale.js +92 -0
- package/dist/collection/components/beta/gux-chart-column/tests/gux-column-chart.spec.js +22 -0
- package/dist/collection/components/beta/gux-chart-donut/gux-chart-donut.css +4 -0
- package/dist/collection/components/beta/gux-chart-donut/gux-chart-donut.js +575 -0
- package/dist/collection/components/beta/gux-chart-donut/tests/gux-chart-donut.spec.js +11 -0
- package/dist/collection/components/beta/gux-chart-line/gux-chart-line.css +4 -0
- package/dist/collection/components/beta/gux-chart-line/gux-chart-line.js +391 -0
- package/dist/collection/components/beta/gux-chart-line/gux-chart-line.locale.js +92 -0
- package/dist/collection/components/beta/gux-chart-line/tests/gux-chart-line.e2e.js +17 -0
- package/dist/collection/components/beta/gux-chart-line/tests/gux-chart-line.spec.js +22 -0
- package/dist/collection/components/beta/gux-chart-pie/gux-chart-pie.css +4 -0
- package/dist/collection/components/beta/gux-chart-pie/gux-chart-pie.js +284 -0
- package/dist/collection/components/beta/gux-chart-pie/tests/gux-chart-pie.spec.js +11 -0
- package/dist/collection/components/beta/gux-chart-scatter-plot/gux-chart-scatter-plot.css +4 -0
- package/dist/collection/components/beta/gux-chart-scatter-plot/gux-chart-scatter-plot.js +365 -0
- package/dist/collection/components/beta/gux-chart-scatter-plot/tests/gux-chart-scatter-plot.spec.js +33 -0
- package/dist/collection/components/beta/gux-visualization/gux-visualization.css +19 -0
- package/dist/collection/components/beta/gux-visualization/gux-visualization.js +143 -0
- package/dist/collection/components/beta/gux-visualization/gux-visualization.locale.js +92 -0
- package/dist/collection/components/beta/gux-visualization/tests/gux-visualization.e2e.js +31 -0
- package/dist/collection/components/beta/gux-visualization/tests/gux-visualization.spec.js +35 -0
- package/dist/collection/i18n/fetchResources.js +12 -0
- package/dist/collection/i18n/index.js +73 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/test/axeConfig.js +7 -0
- package/dist/collection/test/e2eTestUtils.js +20 -0
- package/dist/collection/test/jestMatcherUtils.js +1 -0
- package/dist/collection/test/setupAxeTests.js +75 -0
- package/dist/collection/test/setupTests.js +9 -0
- package/dist/collection/test/specTestUtils.js +10 -0
- package/dist/collection/utils/dom/get-closest-element.js +15 -0
- package/dist/collection/utils/error/log-error.js +6 -0
- package/dist/collection/utils/theme/color-palette.js +12 -0
- package/dist/collection/utils/tracking/usage.js +81 -0
- package/dist/collection/utils/tracking/usage.spec.js +121 -0
- package/dist/component-specs.json +187 -0
- package/dist/esm/genesys-chart-webcomponents.js +18 -0
- package/dist/esm/gux-chart-column-beta.entry.js +136 -0
- package/dist/esm/gux-chart-donut-beta.entry.js +225 -0
- package/dist/esm/gux-chart-line-beta.entry.js +131 -0
- package/dist/esm/gux-chart-pie-beta.entry.js +109 -0
- package/dist/esm/gux-chart-scatter-plot-beta.entry.js +139 -0
- package/dist/esm/gux-visualization-beta.entry.js +71949 -0
- package/dist/esm/index-701d93cf.js +1619 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +9 -0
- package/dist/esm/log-error-0fc61f6f.js +18 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/usage-61eee3bd.js +206 -0
- package/dist/genesys-chart-webcomponents/genesys-chart-webcomponents.css +1 -0
- package/dist/genesys-chart-webcomponents/genesys-chart-webcomponents.esm.js +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.ar.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.cs.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.da.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.de.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.en.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.es-es.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.es.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.fi.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.fr-ca.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.fr.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.he.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.it.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.ja.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.ko.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.nl.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.no.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.pl.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.pt-br.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.pt-pt.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.ru.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.sv.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.th.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.tr.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.uk.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.zh-cn.json +1 -0
- package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.zh-tw.json +1 -0
- package/dist/genesys-chart-webcomponents/index.esm.js +0 -0
- package/dist/genesys-chart-webcomponents/p-137f5b8f.entry.js +1 -0
- package/dist/genesys-chart-webcomponents/p-3e4b3dbc.js +2 -0
- package/dist/genesys-chart-webcomponents/p-82f0ea01.js +1 -0
- package/dist/genesys-chart-webcomponents/p-97c45977.js +1 -0
- package/dist/genesys-chart-webcomponents/p-b5179379.entry.js +1 -0
- package/dist/genesys-chart-webcomponents/p-b901e9e0.entry.js +11 -0
- package/dist/genesys-chart-webcomponents/p-c3aa8578.entry.js +1 -0
- package/dist/genesys-chart-webcomponents/p-d4a346df.entry.js +1 -0
- package/dist/genesys-chart-webcomponents/p-d9928f8c.entry.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/loader/cdn.js +3 -0
- package/dist/loader/index.cjs.js +3 -0
- package/dist/loader/index.d.ts +21 -0
- package/dist/loader/index.es2017.js +3 -0
- package/dist/loader/index.js +4 -0
- package/dist/loader/package.json +11 -0
- package/dist/stencil-wrapper.js +58 -0
- package/dist/types/components/beta/gux-chart-column/gux-chart-column.d.ts +49 -0
- package/dist/types/components/beta/gux-chart-column/gux-chart-column.locale.d.ts +22 -0
- package/dist/types/components/beta/gux-chart-donut/gux-chart-donut.d.ts +34 -0
- package/dist/types/components/beta/gux-chart-line/gux-chart-line.d.ts +48 -0
- package/dist/types/components/beta/gux-chart-line/gux-chart-line.locale.d.ts +22 -0
- package/dist/types/components/beta/gux-chart-pie/gux-chart-pie.d.ts +23 -0
- package/dist/types/components/beta/gux-chart-scatter-plot/gux-chart-scatter-plot.d.ts +52 -0
- package/dist/types/components/beta/gux-visualization/gux-visualization.d.ts +17 -0
- package/dist/types/components/beta/gux-visualization/gux-visualization.locale.d.ts +22 -0
- package/dist/types/components.d.ts +480 -0
- package/dist/types/i18n/fetchResources.d.ts +11 -0
- package/dist/types/i18n/index.d.ts +9 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/stencil-public-runtime.d.ts +1671 -0
- package/dist/types/stencil-wrapper.d.ts +2 -0
- package/dist/types/test/axeConfig.d.ts +6 -0
- package/dist/types/test/e2eTestUtils.d.ts +9 -0
- package/dist/types/test/jestMatcherUtils.d.ts +8 -0
- package/dist/types/test/specTestUtils.d.ts +2 -0
- package/dist/types/typings.d.ts +4 -0
- package/dist/types/utils/dom/get-closest-element.d.ts +1 -0
- package/dist/types/utils/error/log-error.d.ts +2 -0
- package/dist/types/utils/theme/color-palette.d.ts +1 -0
- package/dist/types/utils/tracking/usage.d.ts +27 -0
- package/package.json +118 -0
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
2
|
+
import { h } from "@stencil/core";
|
|
3
|
+
import { trackComponent } from "../../../utils/tracking/usage";
|
|
4
|
+
import { VISUALIZATION_COLORS } from "../../../utils/theme/color-palette";
|
|
5
|
+
import { logError } from "../../../utils/error/log-error";
|
|
6
|
+
const DEFAULT_COLOR_FIELD_NAME = 'category';
|
|
7
|
+
export class GuxLineChart {
|
|
8
|
+
constructor() {
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
this.baseChartSpec = {
|
|
11
|
+
$schema: 'https://vega.github.io/schema/vega-lite/v5.json',
|
|
12
|
+
mark: {
|
|
13
|
+
type: 'line',
|
|
14
|
+
interpolate: 'linear',
|
|
15
|
+
point: false
|
|
16
|
+
},
|
|
17
|
+
config: {
|
|
18
|
+
axis: {
|
|
19
|
+
ticks: false,
|
|
20
|
+
titlePadding: 8
|
|
21
|
+
},
|
|
22
|
+
axisX: {
|
|
23
|
+
labelAngle: 0
|
|
24
|
+
},
|
|
25
|
+
legend: {
|
|
26
|
+
symbolType: 'circle'
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
encoding: {
|
|
30
|
+
x: { type: 'nominal' },
|
|
31
|
+
y: { type: 'quantitative' },
|
|
32
|
+
color: {
|
|
33
|
+
field: DEFAULT_COLOR_FIELD_NAME,
|
|
34
|
+
type: 'nominal',
|
|
35
|
+
scale: { range: VISUALIZATION_COLORS },
|
|
36
|
+
legend: null
|
|
37
|
+
},
|
|
38
|
+
tooltip: { aggregate: 'count', type: 'quantitative' }
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
this.chartData = undefined;
|
|
42
|
+
this.xTickLabelSlant = undefined;
|
|
43
|
+
this.includeLegend = undefined;
|
|
44
|
+
this.legendPosition = 'right';
|
|
45
|
+
this.includeDataPointMarkers = undefined;
|
|
46
|
+
this.xFieldName = undefined;
|
|
47
|
+
this.xAxisTitle = undefined;
|
|
48
|
+
this.yFieldName = undefined;
|
|
49
|
+
this.yAxisTitle = undefined;
|
|
50
|
+
this.legendTitle = undefined;
|
|
51
|
+
this.colorFieldName = undefined;
|
|
52
|
+
this.strokeDash = undefined;
|
|
53
|
+
this.interpolation = undefined;
|
|
54
|
+
this.embedOptions = undefined;
|
|
55
|
+
}
|
|
56
|
+
parseData() {
|
|
57
|
+
if (!this.xFieldName || !this.yFieldName) {
|
|
58
|
+
logError(this.root, 'requires x-field-name and y-field-name');
|
|
59
|
+
}
|
|
60
|
+
let chartData = {};
|
|
61
|
+
if (this.chartData) {
|
|
62
|
+
chartData = { data: this.chartData };
|
|
63
|
+
}
|
|
64
|
+
if (this.xTickLabelSlant) {
|
|
65
|
+
this.baseChartSpec.config.axisX.labelAngle = 45;
|
|
66
|
+
}
|
|
67
|
+
if (this.includeLegend) {
|
|
68
|
+
this.baseChartSpec.encoding.color.legend = true;
|
|
69
|
+
}
|
|
70
|
+
if (this.legendPosition) {
|
|
71
|
+
this.baseChartSpec.config.legend.orient = this.legendPosition;
|
|
72
|
+
}
|
|
73
|
+
const xFieldName = this.xFieldName;
|
|
74
|
+
const xAxisTitle = this.xAxisTitle;
|
|
75
|
+
const yFieldName = this.yFieldName;
|
|
76
|
+
const yAxisTitle = this.yAxisTitle;
|
|
77
|
+
const legendTitle = this.legendTitle;
|
|
78
|
+
const colorFieldName = this.colorFieldName || DEFAULT_COLOR_FIELD_NAME;
|
|
79
|
+
const interpolation = this.interpolation;
|
|
80
|
+
const strokeDash = this.strokeDash;
|
|
81
|
+
const includeDataPointMarkers = this.includeDataPointMarkers;
|
|
82
|
+
if (xFieldName) {
|
|
83
|
+
this.baseChartSpec.encoding.x.field = xFieldName;
|
|
84
|
+
}
|
|
85
|
+
if (xAxisTitle) {
|
|
86
|
+
this.baseChartSpec.encoding.x.title = xAxisTitle;
|
|
87
|
+
}
|
|
88
|
+
if (yFieldName) {
|
|
89
|
+
this.baseChartSpec.encoding.y.field = yFieldName;
|
|
90
|
+
}
|
|
91
|
+
if (yAxisTitle) {
|
|
92
|
+
this.baseChartSpec.encoding.y.title = yAxisTitle;
|
|
93
|
+
}
|
|
94
|
+
if (colorFieldName) {
|
|
95
|
+
this.baseChartSpec.encoding.color.field = colorFieldName;
|
|
96
|
+
}
|
|
97
|
+
if (legendTitle) {
|
|
98
|
+
this.baseChartSpec.encoding.color.title = legendTitle;
|
|
99
|
+
}
|
|
100
|
+
if (strokeDash) {
|
|
101
|
+
this.baseChartSpec.encoding.strokeDash = {
|
|
102
|
+
field: colorFieldName,
|
|
103
|
+
type: 'nominal'
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
if (interpolation) {
|
|
107
|
+
this.baseChartSpec.mark.interpolate = interpolation;
|
|
108
|
+
}
|
|
109
|
+
if (includeDataPointMarkers) {
|
|
110
|
+
this.baseChartSpec.mark.point = includeDataPointMarkers;
|
|
111
|
+
}
|
|
112
|
+
const spec = Object.assign(this.baseChartSpec, chartData);
|
|
113
|
+
this.visualizationSpec = spec;
|
|
114
|
+
}
|
|
115
|
+
componentWillLoad() {
|
|
116
|
+
trackComponent(this.root);
|
|
117
|
+
this.parseData();
|
|
118
|
+
}
|
|
119
|
+
render() {
|
|
120
|
+
return (h("gux-visualization-beta", { visualizationSpec: this.visualizationSpec }));
|
|
121
|
+
}
|
|
122
|
+
static get is() { return "gux-chart-line-beta"; }
|
|
123
|
+
static get encapsulation() { return "shadow"; }
|
|
124
|
+
static get originalStyleUrls() {
|
|
125
|
+
return {
|
|
126
|
+
"$": ["gux-chart-line.scss"]
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
static get styleUrls() {
|
|
130
|
+
return {
|
|
131
|
+
"$": ["gux-chart-line.css"]
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
static get properties() {
|
|
135
|
+
return {
|
|
136
|
+
"chartData": {
|
|
137
|
+
"type": "unknown",
|
|
138
|
+
"mutable": false,
|
|
139
|
+
"complexType": {
|
|
140
|
+
"original": "Record<string, any>",
|
|
141
|
+
"resolved": "{ [x: string]: any; }",
|
|
142
|
+
"references": {
|
|
143
|
+
"Record": {
|
|
144
|
+
"location": "global",
|
|
145
|
+
"id": "global::Record"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"required": false,
|
|
150
|
+
"optional": false,
|
|
151
|
+
"docs": {
|
|
152
|
+
"tags": [],
|
|
153
|
+
"text": "Data to be rendered in the chart.\nData field names must match the values you set in xFieldName and yFieldName"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"xTickLabelSlant": {
|
|
157
|
+
"type": "boolean",
|
|
158
|
+
"mutable": false,
|
|
159
|
+
"complexType": {
|
|
160
|
+
"original": "boolean",
|
|
161
|
+
"resolved": "boolean",
|
|
162
|
+
"references": {}
|
|
163
|
+
},
|
|
164
|
+
"required": false,
|
|
165
|
+
"optional": false,
|
|
166
|
+
"docs": {
|
|
167
|
+
"tags": [],
|
|
168
|
+
"text": "If true, then make Axis tick label 45 degrees"
|
|
169
|
+
},
|
|
170
|
+
"attribute": "x-tick-label-slant",
|
|
171
|
+
"reflect": false
|
|
172
|
+
},
|
|
173
|
+
"includeLegend": {
|
|
174
|
+
"type": "boolean",
|
|
175
|
+
"mutable": false,
|
|
176
|
+
"complexType": {
|
|
177
|
+
"original": "boolean",
|
|
178
|
+
"resolved": "boolean",
|
|
179
|
+
"references": {}
|
|
180
|
+
},
|
|
181
|
+
"required": false,
|
|
182
|
+
"optional": false,
|
|
183
|
+
"docs": {
|
|
184
|
+
"tags": [],
|
|
185
|
+
"text": ""
|
|
186
|
+
},
|
|
187
|
+
"attribute": "include-legend",
|
|
188
|
+
"reflect": false
|
|
189
|
+
},
|
|
190
|
+
"legendPosition": {
|
|
191
|
+
"type": "string",
|
|
192
|
+
"mutable": false,
|
|
193
|
+
"complexType": {
|
|
194
|
+
"original": "| 'left'\n | 'right'\n | 'top'\n | 'bottom'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right'\n | 'none'",
|
|
195
|
+
"resolved": "\"bottom\" | \"bottom-left\" | \"bottom-right\" | \"left\" | \"none\" | \"right\" | \"top\" | \"top-left\" | \"top-right\"",
|
|
196
|
+
"references": {}
|
|
197
|
+
},
|
|
198
|
+
"required": false,
|
|
199
|
+
"optional": false,
|
|
200
|
+
"docs": {
|
|
201
|
+
"tags": [],
|
|
202
|
+
"text": ""
|
|
203
|
+
},
|
|
204
|
+
"attribute": "legend-position",
|
|
205
|
+
"reflect": false,
|
|
206
|
+
"defaultValue": "'right'"
|
|
207
|
+
},
|
|
208
|
+
"includeDataPointMarkers": {
|
|
209
|
+
"type": "boolean",
|
|
210
|
+
"mutable": false,
|
|
211
|
+
"complexType": {
|
|
212
|
+
"original": "boolean",
|
|
213
|
+
"resolved": "boolean",
|
|
214
|
+
"references": {}
|
|
215
|
+
},
|
|
216
|
+
"required": false,
|
|
217
|
+
"optional": false,
|
|
218
|
+
"docs": {
|
|
219
|
+
"tags": [],
|
|
220
|
+
"text": ""
|
|
221
|
+
},
|
|
222
|
+
"attribute": "include-data-point-markers",
|
|
223
|
+
"reflect": false
|
|
224
|
+
},
|
|
225
|
+
"xFieldName": {
|
|
226
|
+
"type": "string",
|
|
227
|
+
"mutable": false,
|
|
228
|
+
"complexType": {
|
|
229
|
+
"original": "string",
|
|
230
|
+
"resolved": "string",
|
|
231
|
+
"references": {}
|
|
232
|
+
},
|
|
233
|
+
"required": false,
|
|
234
|
+
"optional": false,
|
|
235
|
+
"docs": {
|
|
236
|
+
"tags": [],
|
|
237
|
+
"text": "Name for the data field to use to populate the chart's x-axis\ne.g. xFieldName of \"category\" will map any \"category\" fields in chartData to the x-axis"
|
|
238
|
+
},
|
|
239
|
+
"attribute": "x-field-name",
|
|
240
|
+
"reflect": false
|
|
241
|
+
},
|
|
242
|
+
"xAxisTitle": {
|
|
243
|
+
"type": "string",
|
|
244
|
+
"mutable": false,
|
|
245
|
+
"complexType": {
|
|
246
|
+
"original": "string",
|
|
247
|
+
"resolved": "string",
|
|
248
|
+
"references": {}
|
|
249
|
+
},
|
|
250
|
+
"required": false,
|
|
251
|
+
"optional": false,
|
|
252
|
+
"docs": {
|
|
253
|
+
"tags": [],
|
|
254
|
+
"text": "Title to display along the x-axis"
|
|
255
|
+
},
|
|
256
|
+
"attribute": "x-axis-title",
|
|
257
|
+
"reflect": false
|
|
258
|
+
},
|
|
259
|
+
"yFieldName": {
|
|
260
|
+
"type": "string",
|
|
261
|
+
"mutable": false,
|
|
262
|
+
"complexType": {
|
|
263
|
+
"original": "string",
|
|
264
|
+
"resolved": "string",
|
|
265
|
+
"references": {}
|
|
266
|
+
},
|
|
267
|
+
"required": false,
|
|
268
|
+
"optional": false,
|
|
269
|
+
"docs": {
|
|
270
|
+
"tags": [],
|
|
271
|
+
"text": "Name for the data field to use to populate the chart's x-axis\ne.g. yFieldName of \"value\" will map any \"value\" fields in chartData to the y-axis"
|
|
272
|
+
},
|
|
273
|
+
"attribute": "y-field-name",
|
|
274
|
+
"reflect": false
|
|
275
|
+
},
|
|
276
|
+
"yAxisTitle": {
|
|
277
|
+
"type": "string",
|
|
278
|
+
"mutable": false,
|
|
279
|
+
"complexType": {
|
|
280
|
+
"original": "string",
|
|
281
|
+
"resolved": "string",
|
|
282
|
+
"references": {}
|
|
283
|
+
},
|
|
284
|
+
"required": false,
|
|
285
|
+
"optional": false,
|
|
286
|
+
"docs": {
|
|
287
|
+
"tags": [],
|
|
288
|
+
"text": "Title to display along the y-axis"
|
|
289
|
+
},
|
|
290
|
+
"attribute": "y-axis-title",
|
|
291
|
+
"reflect": false
|
|
292
|
+
},
|
|
293
|
+
"legendTitle": {
|
|
294
|
+
"type": "string",
|
|
295
|
+
"mutable": false,
|
|
296
|
+
"complexType": {
|
|
297
|
+
"original": "string",
|
|
298
|
+
"resolved": "string",
|
|
299
|
+
"references": {}
|
|
300
|
+
},
|
|
301
|
+
"required": false,
|
|
302
|
+
"optional": false,
|
|
303
|
+
"docs": {
|
|
304
|
+
"tags": [],
|
|
305
|
+
"text": "Title to display above the optional legend"
|
|
306
|
+
},
|
|
307
|
+
"attribute": "legend-title",
|
|
308
|
+
"reflect": false
|
|
309
|
+
},
|
|
310
|
+
"colorFieldName": {
|
|
311
|
+
"type": "string",
|
|
312
|
+
"mutable": false,
|
|
313
|
+
"complexType": {
|
|
314
|
+
"original": "string",
|
|
315
|
+
"resolved": "string",
|
|
316
|
+
"references": {}
|
|
317
|
+
},
|
|
318
|
+
"required": false,
|
|
319
|
+
"optional": false,
|
|
320
|
+
"docs": {
|
|
321
|
+
"tags": [],
|
|
322
|
+
"text": ""
|
|
323
|
+
},
|
|
324
|
+
"attribute": "color-field-name",
|
|
325
|
+
"reflect": false
|
|
326
|
+
},
|
|
327
|
+
"strokeDash": {
|
|
328
|
+
"type": "boolean",
|
|
329
|
+
"mutable": false,
|
|
330
|
+
"complexType": {
|
|
331
|
+
"original": "boolean",
|
|
332
|
+
"resolved": "boolean",
|
|
333
|
+
"references": {}
|
|
334
|
+
},
|
|
335
|
+
"required": false,
|
|
336
|
+
"optional": false,
|
|
337
|
+
"docs": {
|
|
338
|
+
"tags": [],
|
|
339
|
+
"text": ""
|
|
340
|
+
},
|
|
341
|
+
"attribute": "stroke-dash",
|
|
342
|
+
"reflect": false
|
|
343
|
+
},
|
|
344
|
+
"interpolation": {
|
|
345
|
+
"type": "string",
|
|
346
|
+
"mutable": false,
|
|
347
|
+
"complexType": {
|
|
348
|
+
"original": "string",
|
|
349
|
+
"resolved": "string",
|
|
350
|
+
"references": {}
|
|
351
|
+
},
|
|
352
|
+
"required": false,
|
|
353
|
+
"optional": false,
|
|
354
|
+
"docs": {
|
|
355
|
+
"tags": [],
|
|
356
|
+
"text": ""
|
|
357
|
+
},
|
|
358
|
+
"attribute": "interpolation",
|
|
359
|
+
"reflect": false
|
|
360
|
+
},
|
|
361
|
+
"embedOptions": {
|
|
362
|
+
"type": "unknown",
|
|
363
|
+
"mutable": false,
|
|
364
|
+
"complexType": {
|
|
365
|
+
"original": "EmbedOptions",
|
|
366
|
+
"resolved": "EmbedOptions<string, Renderers>",
|
|
367
|
+
"references": {
|
|
368
|
+
"EmbedOptions": {
|
|
369
|
+
"location": "import",
|
|
370
|
+
"path": "vega-embed",
|
|
371
|
+
"id": "../../node_modules/vega-embed/build/vega-embed.module.d.ts::EmbedOptions"
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
"required": false,
|
|
376
|
+
"optional": false,
|
|
377
|
+
"docs": {
|
|
378
|
+
"tags": [],
|
|
379
|
+
"text": ""
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
static get elementRef() { return "root"; }
|
|
385
|
+
static get watchers() {
|
|
386
|
+
return [{
|
|
387
|
+
"propName": "chartData",
|
|
388
|
+
"methodName": "parseData"
|
|
389
|
+
}];
|
|
390
|
+
}
|
|
391
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// https://github.com/d3/d3-time-format/tree/master/locale
|
|
2
|
+
// This is just a POC I would structure the files differently when implementing for production.
|
|
3
|
+
export const timeFormatLocale = {
|
|
4
|
+
en: {
|
|
5
|
+
dateTime: '%x, %X',
|
|
6
|
+
date: '%-m/%-d/%Y',
|
|
7
|
+
time: '%-I:%M:%S %p',
|
|
8
|
+
periods: ['AM', 'PM'],
|
|
9
|
+
days: [
|
|
10
|
+
'Sunday',
|
|
11
|
+
'Monday',
|
|
12
|
+
'Tuesday',
|
|
13
|
+
'Wednesday',
|
|
14
|
+
'Thursday',
|
|
15
|
+
'Friday',
|
|
16
|
+
'Saturday'
|
|
17
|
+
],
|
|
18
|
+
shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
19
|
+
months: [
|
|
20
|
+
'January',
|
|
21
|
+
'February',
|
|
22
|
+
'March',
|
|
23
|
+
'April',
|
|
24
|
+
'May',
|
|
25
|
+
'June',
|
|
26
|
+
'July',
|
|
27
|
+
'August',
|
|
28
|
+
'September',
|
|
29
|
+
'October',
|
|
30
|
+
'November',
|
|
31
|
+
'December'
|
|
32
|
+
],
|
|
33
|
+
shortMonths: [
|
|
34
|
+
'Jan',
|
|
35
|
+
'Feb',
|
|
36
|
+
'Mar',
|
|
37
|
+
'Apr',
|
|
38
|
+
'May',
|
|
39
|
+
'Jun',
|
|
40
|
+
'Jul',
|
|
41
|
+
'Aug',
|
|
42
|
+
'Sep',
|
|
43
|
+
'Oct',
|
|
44
|
+
'Nov',
|
|
45
|
+
'Dec'
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
de: {
|
|
49
|
+
dateTime: '%A, der %e. %B %Y, %X',
|
|
50
|
+
date: '%d.%m.%Y',
|
|
51
|
+
time: '%H:%M:%S',
|
|
52
|
+
periods: ['AM', 'PM'],
|
|
53
|
+
days: [
|
|
54
|
+
'Sonntag',
|
|
55
|
+
'Montag',
|
|
56
|
+
'Dienstag',
|
|
57
|
+
'Mittwoch',
|
|
58
|
+
'Donnerstag',
|
|
59
|
+
'Freitag',
|
|
60
|
+
'Samstag'
|
|
61
|
+
],
|
|
62
|
+
shortDays: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
|
|
63
|
+
months: [
|
|
64
|
+
'Januar',
|
|
65
|
+
'Februar',
|
|
66
|
+
'März',
|
|
67
|
+
'April',
|
|
68
|
+
'Mai',
|
|
69
|
+
'Juni',
|
|
70
|
+
'Juli',
|
|
71
|
+
'August',
|
|
72
|
+
'September',
|
|
73
|
+
'Oktober',
|
|
74
|
+
'November',
|
|
75
|
+
'Dezember'
|
|
76
|
+
],
|
|
77
|
+
shortMonths: [
|
|
78
|
+
'Jan',
|
|
79
|
+
'Feb',
|
|
80
|
+
'Mrz',
|
|
81
|
+
'Apr',
|
|
82
|
+
'Mai',
|
|
83
|
+
'Jun',
|
|
84
|
+
'Jul',
|
|
85
|
+
'Aug',
|
|
86
|
+
'Sep',
|
|
87
|
+
'Okt',
|
|
88
|
+
'Nov',
|
|
89
|
+
'Dez'
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { newE2EPage } from "@stencil/core/testing";
|
|
2
|
+
describe('gux-chart-line-beta', () => {
|
|
3
|
+
describe('#render', () => {
|
|
4
|
+
[
|
|
5
|
+
{
|
|
6
|
+
description: 'should render chart',
|
|
7
|
+
html: '<gux-chart-line-beta x-field-name="date" y-field-name="value"></gux-chart-line-beta>'
|
|
8
|
+
}
|
|
9
|
+
].forEach(({ description, html }) => {
|
|
10
|
+
it(description, async () => {
|
|
11
|
+
const page = await newE2EPage({ html });
|
|
12
|
+
const element = await page.find('gux-chart-line-beta');
|
|
13
|
+
expect(element.outerHTML).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { newSpecPage } from "../../../../test/specTestUtils";
|
|
2
|
+
import { GuxLineChart } from "../gux-chart-line";
|
|
3
|
+
const components = [GuxLineChart];
|
|
4
|
+
const language = 'en';
|
|
5
|
+
describe('gux-chart-line-beta', () => {
|
|
6
|
+
it('should build', async () => {
|
|
7
|
+
const html = '<gux-chart-line-beta x-field-name="date" y-field-name="value"></gux-chart-line-beta>';
|
|
8
|
+
const page = await newSpecPage({ components, html, language });
|
|
9
|
+
expect(page.rootInstance).toBeInstanceOf(GuxLineChart);
|
|
10
|
+
});
|
|
11
|
+
it('should reflect user option to make slant x axis tick labels', async () => {
|
|
12
|
+
let html = '<gux-chart-line-beta x-field-name="date" y-field-name="value"></gux-chart-line-beta>';
|
|
13
|
+
let page = await newSpecPage({ components, html, language });
|
|
14
|
+
expect(page.rootInstance.xTickLabelSlant).toBeUndefined();
|
|
15
|
+
expect(page.rootInstance.baseChartSpec.config.axisX.labelAngle).toBe(0);
|
|
16
|
+
html =
|
|
17
|
+
'<gux-chart-line-beta x-field-name="date" y-field-name="value" x-tick-label-slant="true"></gux-chart-line-beta>';
|
|
18
|
+
page = await newSpecPage({ components, html, language });
|
|
19
|
+
expect(page.rootInstance.xTickLabelSlant).toBeTruthy();
|
|
20
|
+
expect(page.rootInstance.baseChartSpec.config.axisX.labelAngle).toBe(45);
|
|
21
|
+
});
|
|
22
|
+
});
|