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.
Files changed (142) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/dist/cjs/genesys-chart-webcomponents.cjs.js +23 -0
  4. package/dist/cjs/gux-chart-column-beta.cjs.entry.js +140 -0
  5. package/dist/cjs/gux-chart-donut-beta.cjs.entry.js +229 -0
  6. package/dist/cjs/gux-chart-line-beta.cjs.entry.js +135 -0
  7. package/dist/cjs/gux-chart-pie-beta.cjs.entry.js +113 -0
  8. package/dist/cjs/gux-chart-scatter-plot-beta.cjs.entry.js +143 -0
  9. package/dist/cjs/gux-visualization-beta.cjs.entry.js +71953 -0
  10. package/dist/cjs/index-1e13a15f.js +1647 -0
  11. package/dist/cjs/index.cjs.js +2 -0
  12. package/dist/cjs/loader.cjs.js +13 -0
  13. package/dist/cjs/log-error-c46b4b4c.js +21 -0
  14. package/dist/cjs/usage-30f04ec3.js +208 -0
  15. package/dist/collection/collection-manifest.json +17 -0
  16. package/dist/collection/components/beta/gux-chart-column/gux-chart-column.css +13 -0
  17. package/dist/collection/components/beta/gux-chart-column/gux-chart-column.js +343 -0
  18. package/dist/collection/components/beta/gux-chart-column/gux-chart-column.locale.js +92 -0
  19. package/dist/collection/components/beta/gux-chart-column/tests/gux-column-chart.spec.js +22 -0
  20. package/dist/collection/components/beta/gux-chart-donut/gux-chart-donut.css +4 -0
  21. package/dist/collection/components/beta/gux-chart-donut/gux-chart-donut.js +575 -0
  22. package/dist/collection/components/beta/gux-chart-donut/tests/gux-chart-donut.spec.js +11 -0
  23. package/dist/collection/components/beta/gux-chart-line/gux-chart-line.css +4 -0
  24. package/dist/collection/components/beta/gux-chart-line/gux-chart-line.js +391 -0
  25. package/dist/collection/components/beta/gux-chart-line/gux-chart-line.locale.js +92 -0
  26. package/dist/collection/components/beta/gux-chart-line/tests/gux-chart-line.e2e.js +17 -0
  27. package/dist/collection/components/beta/gux-chart-line/tests/gux-chart-line.spec.js +22 -0
  28. package/dist/collection/components/beta/gux-chart-pie/gux-chart-pie.css +4 -0
  29. package/dist/collection/components/beta/gux-chart-pie/gux-chart-pie.js +284 -0
  30. package/dist/collection/components/beta/gux-chart-pie/tests/gux-chart-pie.spec.js +11 -0
  31. package/dist/collection/components/beta/gux-chart-scatter-plot/gux-chart-scatter-plot.css +4 -0
  32. package/dist/collection/components/beta/gux-chart-scatter-plot/gux-chart-scatter-plot.js +365 -0
  33. package/dist/collection/components/beta/gux-chart-scatter-plot/tests/gux-chart-scatter-plot.spec.js +33 -0
  34. package/dist/collection/components/beta/gux-visualization/gux-visualization.css +19 -0
  35. package/dist/collection/components/beta/gux-visualization/gux-visualization.js +143 -0
  36. package/dist/collection/components/beta/gux-visualization/gux-visualization.locale.js +92 -0
  37. package/dist/collection/components/beta/gux-visualization/tests/gux-visualization.e2e.js +31 -0
  38. package/dist/collection/components/beta/gux-visualization/tests/gux-visualization.spec.js +35 -0
  39. package/dist/collection/i18n/fetchResources.js +12 -0
  40. package/dist/collection/i18n/index.js +73 -0
  41. package/dist/collection/index.js +2 -0
  42. package/dist/collection/test/axeConfig.js +7 -0
  43. package/dist/collection/test/e2eTestUtils.js +20 -0
  44. package/dist/collection/test/jestMatcherUtils.js +1 -0
  45. package/dist/collection/test/setupAxeTests.js +75 -0
  46. package/dist/collection/test/setupTests.js +9 -0
  47. package/dist/collection/test/specTestUtils.js +10 -0
  48. package/dist/collection/utils/dom/get-closest-element.js +15 -0
  49. package/dist/collection/utils/error/log-error.js +6 -0
  50. package/dist/collection/utils/theme/color-palette.js +12 -0
  51. package/dist/collection/utils/tracking/usage.js +81 -0
  52. package/dist/collection/utils/tracking/usage.spec.js +121 -0
  53. package/dist/component-specs.json +187 -0
  54. package/dist/esm/genesys-chart-webcomponents.js +18 -0
  55. package/dist/esm/gux-chart-column-beta.entry.js +136 -0
  56. package/dist/esm/gux-chart-donut-beta.entry.js +225 -0
  57. package/dist/esm/gux-chart-line-beta.entry.js +131 -0
  58. package/dist/esm/gux-chart-pie-beta.entry.js +109 -0
  59. package/dist/esm/gux-chart-scatter-plot-beta.entry.js +139 -0
  60. package/dist/esm/gux-visualization-beta.entry.js +71949 -0
  61. package/dist/esm/index-701d93cf.js +1619 -0
  62. package/dist/esm/index.js +1 -0
  63. package/dist/esm/loader.js +9 -0
  64. package/dist/esm/log-error-0fc61f6f.js +18 -0
  65. package/dist/esm/polyfills/core-js.js +11 -0
  66. package/dist/esm/polyfills/dom.js +79 -0
  67. package/dist/esm/polyfills/es5-html-element.js +1 -0
  68. package/dist/esm/polyfills/index.js +34 -0
  69. package/dist/esm/polyfills/system.js +6 -0
  70. package/dist/esm/usage-61eee3bd.js +206 -0
  71. package/dist/genesys-chart-webcomponents/genesys-chart-webcomponents.css +1 -0
  72. package/dist/genesys-chart-webcomponents/genesys-chart-webcomponents.esm.js +1 -0
  73. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.ar.json +1 -0
  74. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.cs.json +1 -0
  75. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.da.json +1 -0
  76. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.de.json +1 -0
  77. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.en.json +1 -0
  78. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.es-es.json +1 -0
  79. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.es.json +1 -0
  80. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.fi.json +1 -0
  81. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.fr-ca.json +1 -0
  82. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.fr.json +1 -0
  83. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.he.json +1 -0
  84. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.it.json +1 -0
  85. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.ja.json +1 -0
  86. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.ko.json +1 -0
  87. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.nl.json +1 -0
  88. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.no.json +1 -0
  89. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.pl.json +1 -0
  90. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.pt-br.json +1 -0
  91. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.pt-pt.json +1 -0
  92. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.ru.json +1 -0
  93. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.sv.json +1 -0
  94. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.th.json +1 -0
  95. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.tr.json +1 -0
  96. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.uk.json +1 -0
  97. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.zh-cn.json +1 -0
  98. package/dist/genesys-chart-webcomponents/i18n/genesys-webcomponents.i18n.zh-tw.json +1 -0
  99. package/dist/genesys-chart-webcomponents/index.esm.js +0 -0
  100. package/dist/genesys-chart-webcomponents/p-137f5b8f.entry.js +1 -0
  101. package/dist/genesys-chart-webcomponents/p-3e4b3dbc.js +2 -0
  102. package/dist/genesys-chart-webcomponents/p-82f0ea01.js +1 -0
  103. package/dist/genesys-chart-webcomponents/p-97c45977.js +1 -0
  104. package/dist/genesys-chart-webcomponents/p-b5179379.entry.js +1 -0
  105. package/dist/genesys-chart-webcomponents/p-b901e9e0.entry.js +11 -0
  106. package/dist/genesys-chart-webcomponents/p-c3aa8578.entry.js +1 -0
  107. package/dist/genesys-chart-webcomponents/p-d4a346df.entry.js +1 -0
  108. package/dist/genesys-chart-webcomponents/p-d9928f8c.entry.js +1 -0
  109. package/dist/index.cjs.js +1 -0
  110. package/dist/index.js +1 -0
  111. package/dist/loader/cdn.js +3 -0
  112. package/dist/loader/index.cjs.js +3 -0
  113. package/dist/loader/index.d.ts +21 -0
  114. package/dist/loader/index.es2017.js +3 -0
  115. package/dist/loader/index.js +4 -0
  116. package/dist/loader/package.json +11 -0
  117. package/dist/stencil-wrapper.js +58 -0
  118. package/dist/types/components/beta/gux-chart-column/gux-chart-column.d.ts +49 -0
  119. package/dist/types/components/beta/gux-chart-column/gux-chart-column.locale.d.ts +22 -0
  120. package/dist/types/components/beta/gux-chart-donut/gux-chart-donut.d.ts +34 -0
  121. package/dist/types/components/beta/gux-chart-line/gux-chart-line.d.ts +48 -0
  122. package/dist/types/components/beta/gux-chart-line/gux-chart-line.locale.d.ts +22 -0
  123. package/dist/types/components/beta/gux-chart-pie/gux-chart-pie.d.ts +23 -0
  124. package/dist/types/components/beta/gux-chart-scatter-plot/gux-chart-scatter-plot.d.ts +52 -0
  125. package/dist/types/components/beta/gux-visualization/gux-visualization.d.ts +17 -0
  126. package/dist/types/components/beta/gux-visualization/gux-visualization.locale.d.ts +22 -0
  127. package/dist/types/components.d.ts +480 -0
  128. package/dist/types/i18n/fetchResources.d.ts +11 -0
  129. package/dist/types/i18n/index.d.ts +9 -0
  130. package/dist/types/index.d.ts +3 -0
  131. package/dist/types/stencil-public-runtime.d.ts +1671 -0
  132. package/dist/types/stencil-wrapper.d.ts +2 -0
  133. package/dist/types/test/axeConfig.d.ts +6 -0
  134. package/dist/types/test/e2eTestUtils.d.ts +9 -0
  135. package/dist/types/test/jestMatcherUtils.d.ts +8 -0
  136. package/dist/types/test/specTestUtils.d.ts +2 -0
  137. package/dist/types/typings.d.ts +4 -0
  138. package/dist/types/utils/dom/get-closest-element.d.ts +1 -0
  139. package/dist/types/utils/error/log-error.d.ts +2 -0
  140. package/dist/types/utils/theme/color-palette.d.ts +1 -0
  141. package/dist/types/utils/tracking/usage.d.ts +27 -0
  142. package/package.json +118 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Genesys Cloud Services, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # Genesys Spark Chart Components
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-1e13a15f.js');
6
+
7
+ /*
8
+ Stencil Client Patch Browser v4.5.0 | MIT Licensed | https://stenciljs.com
9
+ */
10
+ const patchBrowser = () => {
11
+ const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('genesys-chart-webcomponents.cjs.js', document.baseURI).href));
12
+ const opts = {};
13
+ if (importMeta !== '') {
14
+ opts.resourcesUrl = new URL('.', importMeta).href;
15
+ }
16
+ return index.promiseResolve(opts);
17
+ };
18
+
19
+ patchBrowser().then(options => {
20
+ return index.bootstrapLazy([["gux-visualization-beta.cjs",[[1,"gux-visualization-beta",{"visualizationSpec":[16],"embedOptions":[16]}]]],["gux-chart-column-beta.cjs",[[1,"gux-chart-column-beta",{"chartData":[16],"xTickLabelSlant":[4,"x-tick-label-slant"],"includeLegend":[4,"include-legend"],"xFieldName":[1,"x-field-name"],"yFieldName":[1,"y-field-name"],"xAxisTitle":[1,"x-axis-title"],"yAxisTitle":[1,"y-axis-title"],"legendTitle":[1,"legend-title"],"legendPosition":[1,"legend-position"],"chartLayers":[16],"embedOptions":[16]},null,{"chartData":["parseData"]}]]],["gux-chart-donut-beta.cjs",[[1,"gux-chart-donut-beta",{"chartData":[16],"includeLegend":[4,"include-legend"],"legendPosition":[1,"legend-position"],"legendTitle":[1,"legend-title"],"colorFieldName":[1,"color-field-name"],"outerRadius":[2,"outer-radius"],"innerRadius":[2,"inner-radius"],"labelRadius":[2,"label-radius"],"labelField":[1,"label-field"],"gauge":[4],"centerText":[1,"center-text"],"centerSubText":[1,"center-sub-text"],"showTooltip":[4,"show-tooltip"],"tooltipOptions":[16],"legendX":[2,"legend-x"],"legendY":[2,"legend-y"],"legendFontSize":[2,"legend-font-size"],"legendSymbolSize":[2,"legend-symbol-size"],"embedOptions":[16]},null,{"chartData":["parseData"]}]]],["gux-chart-line-beta.cjs",[[1,"gux-chart-line-beta",{"chartData":[16],"xTickLabelSlant":[4,"x-tick-label-slant"],"includeLegend":[4,"include-legend"],"legendPosition":[1,"legend-position"],"includeDataPointMarkers":[4,"include-data-point-markers"],"xFieldName":[1,"x-field-name"],"xAxisTitle":[1,"x-axis-title"],"yFieldName":[1,"y-field-name"],"yAxisTitle":[1,"y-axis-title"],"legendTitle":[1,"legend-title"],"colorFieldName":[1,"color-field-name"],"strokeDash":[4,"stroke-dash"],"interpolation":[1],"embedOptions":[16]},null,{"chartData":["parseData"]}]]],["gux-chart-pie-beta.cjs",[[1,"gux-chart-pie-beta",{"chartData":[16],"includeLegend":[4,"include-legend"],"legendPosition":[1,"legend-position"],"legendTitle":[1,"legend-title"],"colorFieldName":[1,"color-field-name"],"outerRadius":[2,"outer-radius"],"labelRadius":[2,"label-radius"],"labelField":[1,"label-field"],"embedOptions":[16]},null,{"chartData":["parseData"]}]]],["gux-chart-scatter-plot-beta.cjs",[[1,"gux-chart-scatter-plot-beta",{"chartData":[16],"xTickLabelSlant":[4,"x-tick-label-slant"],"includeLegend":[4,"include-legend"],"legendPosition":[1,"legend-position"],"xFieldName":[1,"x-field-name"],"xAxisTitle":[1,"x-axis-title"],"yFieldName":[1,"y-field-name"],"yAxisTitle":[1,"y-axis-title"],"legendTitle":[1,"legend-title"],"colorFieldName":[1,"color-field-name"],"useShape":[1,"use-shape"],"embedOptions":[16]},null,{"chartData":["parseData"]}]]]], options);
21
+ });
22
+
23
+ exports.setNonce = index.setNonce;
@@ -0,0 +1,140 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-1e13a15f.js');
6
+ const usage = require('./usage-30f04ec3.js');
7
+ const logError = require('./log-error-c46b4b4c.js');
8
+
9
+ const guxChartColumnCss = "gux-visualization-beta{height:fit-content;color:#2e394c;}gux-visualization-beta .mark-rect.layer_0_marks path{fill:url(#diagonalHatch0)}gux-visualization-beta .mark-rect.layer_1_marks path{fill:#1da8b3}";
10
+
11
+ const GuxColumnChart = class {
12
+ constructor(hostRef) {
13
+ index.registerInstance(this, hostRef);
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ this.baseChartSpec = {
16
+ $schema: 'https://vega.github.io/schema/vega-lite/v5.json',
17
+ mark: { type: 'bar' },
18
+ config: {
19
+ axis: {
20
+ ticks: false,
21
+ titlePadding: 8
22
+ },
23
+ axisX: {
24
+ labelAngle: 0
25
+ },
26
+ scale: {
27
+ bandPaddingInner: 0.4,
28
+ bandPaddingOuter: 0.4 // padding between leftmost/rightmost column/bar from axes
29
+ },
30
+ legend: {
31
+ symbolType: 'circle'
32
+ },
33
+ bar: {
34
+ color: logError.VISUALIZATION_COLORS[0]
35
+ }
36
+ },
37
+ encoding: {
38
+ x: { type: 'nominal' },
39
+ y: { type: 'quantitative' },
40
+ tooltip: { aggregate: 'count', type: 'quantitative' }
41
+ }
42
+ };
43
+ this.chartData = undefined;
44
+ this.xTickLabelSlant = undefined;
45
+ this.includeLegend = undefined;
46
+ this.xFieldName = undefined;
47
+ this.yFieldName = undefined;
48
+ this.xAxisTitle = undefined;
49
+ this.yAxisTitle = undefined;
50
+ this.legendTitle = undefined;
51
+ this.legendPosition = 'right';
52
+ this.chartLayers = undefined;
53
+ this.embedOptions = undefined;
54
+ }
55
+ parseData() {
56
+ if (!this.xFieldName || !this.yFieldName) {
57
+ logError.logError(this.root, 'requires x-field-name and y-field-name');
58
+ }
59
+ let chartData = {};
60
+ if (this.chartData) {
61
+ chartData = { data: this.chartData };
62
+ }
63
+ if (this.xTickLabelSlant) {
64
+ this.baseChartSpec.config.axisX.labelAngle = 45;
65
+ }
66
+ if (this.includeLegend) {
67
+ this.baseChartSpec.encoding.color = { field: 'category' };
68
+ }
69
+ if (this.legendPosition) {
70
+ this.baseChartSpec.config.legend.orient = this.legendPosition;
71
+ }
72
+ const xFieldName = this.xFieldName;
73
+ const yFieldName = this.yFieldName;
74
+ const xAxisTitle = this.xAxisTitle;
75
+ const yAxisTitle = this.yAxisTitle;
76
+ const legendTitle = this.legendTitle;
77
+ if (this.chartLayers) {
78
+ const layers = this.chartLayers.map(layerName => {
79
+ return {
80
+ mark: 'bar',
81
+ transform: [
82
+ {
83
+ filter: { field: 'series', equal: layerName }
84
+ }
85
+ ],
86
+ encoding: {
87
+ x: {
88
+ field: xFieldName,
89
+ type: 'nominal'
90
+ },
91
+ y: {
92
+ field: yFieldName,
93
+ type: 'quantitative'
94
+ }
95
+ }
96
+ };
97
+ });
98
+ this.baseChartSpec.layer = layers;
99
+ }
100
+ else {
101
+ if (xFieldName) {
102
+ this.baseChartSpec.encoding.x.field = xFieldName;
103
+ }
104
+ if (yFieldName) {
105
+ this.baseChartSpec.encoding.y.field = yFieldName;
106
+ }
107
+ if (xAxisTitle) {
108
+ this.baseChartSpec.encoding.x.title = xAxisTitle;
109
+ }
110
+ if (yAxisTitle) {
111
+ this.baseChartSpec.encoding.y.title = yAxisTitle;
112
+ }
113
+ if (legendTitle) {
114
+ this.baseChartSpec.encoding.color.title = legendTitle;
115
+ }
116
+ }
117
+ // Set up colors for legend and bars
118
+ const rangeField = xFieldName;
119
+ const rangeConfig = {
120
+ [rangeField]: logError.VISUALIZATION_COLORS
121
+ };
122
+ this.baseChartSpec.config.range = rangeConfig;
123
+ const spec = Object.assign(this.baseChartSpec, chartData);
124
+ this.visualizationSpec = spec;
125
+ }
126
+ componentWillLoad() {
127
+ usage.trackComponent(this.root);
128
+ this.parseData();
129
+ }
130
+ render() {
131
+ return (index.h("gux-visualization-beta", { visualizationSpec: this.visualizationSpec }));
132
+ }
133
+ get root() { return index.getElement(this); }
134
+ static get watchers() { return {
135
+ "chartData": ["parseData"]
136
+ }; }
137
+ };
138
+ GuxColumnChart.style = guxChartColumnCss;
139
+
140
+ exports.gux_chart_column_beta = GuxColumnChart;
@@ -0,0 +1,229 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-1e13a15f.js');
6
+ const usage = require('./usage-30f04ec3.js');
7
+ const logError = require('./log-error-c46b4b4c.js');
8
+
9
+ const guxChartDonutCss = "gux-visualization-beta{height:fit-content;color:#2e394c}";
10
+
11
+ const DEFAULT_COLOR_FIELD_NAME = 'category';
12
+ const DEFAULT_LABEL_FIELD_NAME = 'value';
13
+ const DEFAULT_RING_WIDTH = 32;
14
+ const GuxDonutChart = class {
15
+ constructor(hostRef) {
16
+ index.registerInstance(this, hostRef);
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+ this.baseChartSpec = {
19
+ $schema: 'https://vega.github.io/schema/vega-lite/v5.json',
20
+ config: {
21
+ legend: {
22
+ symbolType: 'circle'
23
+ }
24
+ },
25
+ encoding: {
26
+ theta: { field: 'value', type: 'quantitative', stack: true },
27
+ color: {
28
+ field: DEFAULT_COLOR_FIELD_NAME,
29
+ type: 'nominal',
30
+ scale: { range: logError.VISUALIZATION_COLORS },
31
+ legend: null
32
+ }
33
+ },
34
+ layer: [
35
+ {
36
+ mark: { type: 'arc', outerRadius: 80 }
37
+ },
38
+ {
39
+ mark: { type: 'text', radius: 90 },
40
+ encoding: {
41
+ text: { field: DEFAULT_LABEL_FIELD_NAME, type: 'quantitative' }
42
+ }
43
+ }
44
+ ],
45
+ view: { stroke: null }
46
+ };
47
+ this.chartData = undefined;
48
+ this.includeLegend = undefined;
49
+ this.legendPosition = 'right';
50
+ this.legendTitle = undefined;
51
+ this.colorFieldName = undefined;
52
+ this.outerRadius = undefined;
53
+ this.innerRadius = undefined;
54
+ this.labelRadius = undefined;
55
+ this.labelField = undefined;
56
+ this.gauge = undefined;
57
+ this.centerText = undefined;
58
+ this.centerSubText = undefined;
59
+ this.showTooltip = true;
60
+ this.tooltipOptions = undefined;
61
+ this.legendX = undefined;
62
+ this.legendY = undefined;
63
+ this.legendFontSize = undefined;
64
+ this.legendSymbolSize = undefined;
65
+ this.embedOptions = undefined;
66
+ }
67
+ parseData() {
68
+ if (!this.outerRadius && !this.innerRadius) {
69
+ logError.logError(this.root, 'requires at least one of outer-radius or inner-radius');
70
+ }
71
+ let chartData = {};
72
+ if (this.chartData) {
73
+ chartData = { data: this.chartData };
74
+ }
75
+ if (this.legendPosition) {
76
+ this.baseChartSpec.config.legend.orient = this.legendPosition;
77
+ }
78
+ if (this.includeLegend) {
79
+ this.baseChartSpec.encoding.color.legend = {};
80
+ if (this.legendX || this.legendY) {
81
+ this.baseChartSpec.config.legend.orient = 'none';
82
+ if (this.legendX) {
83
+ this.baseChartSpec.encoding.color.legend.legendX = this.legendX;
84
+ }
85
+ if (this.legendY) {
86
+ this.baseChartSpec.encoding.color.legend.legendY = this.legendY;
87
+ }
88
+ }
89
+ if (this.legendFontSize) {
90
+ this.baseChartSpec.encoding.color.legend.labelFontSize =
91
+ this.legendFontSize;
92
+ }
93
+ if (this.legendSymbolSize) {
94
+ this.baseChartSpec.encoding.color.legend.symbolSize =
95
+ this.legendSymbolSize;
96
+ }
97
+ }
98
+ else {
99
+ this.baseChartSpec.encoding.color.legend = null;
100
+ }
101
+ const colorFieldName = this.colorFieldName || DEFAULT_COLOR_FIELD_NAME;
102
+ if (colorFieldName) {
103
+ this.baseChartSpec.encoding.color.field = colorFieldName;
104
+ }
105
+ const legendTitle = this.legendTitle;
106
+ if (legendTitle) {
107
+ this.baseChartSpec.encoding.color.title = legendTitle;
108
+ }
109
+ else {
110
+ this.baseChartSpec.encoding.color.title = '';
111
+ }
112
+ let outerRadius = this.outerRadius;
113
+ let innerRadius = this.innerRadius;
114
+ if (!outerRadius) {
115
+ outerRadius = innerRadius + DEFAULT_RING_WIDTH;
116
+ }
117
+ if (!innerRadius) {
118
+ innerRadius = outerRadius - DEFAULT_RING_WIDTH;
119
+ }
120
+ let layerFiels = 1;
121
+ if (this.gauge) {
122
+ this.baseChartSpec.layer = [
123
+ {
124
+ data: { values: [{ progress: 'default', value: 100 }] },
125
+ mark: { type: 'arc', innerRadius },
126
+ encoding: {
127
+ theta: { field: 'value', type: 'quantitative' },
128
+ color: { value: '#E4E9F0' },
129
+ tooltip: null
130
+ }
131
+ },
132
+ {
133
+ mark: { type: 'arc', outerRadius, innerRadius, padAngle: 0.01 }
134
+ },
135
+ {
136
+ mark: { type: 'arc', innerRadius, padAngle: 0.01 }
137
+ }
138
+ ];
139
+ layerFiels = 2;
140
+ }
141
+ else {
142
+ this.baseChartSpec.layer = [
143
+ {
144
+ mark: { type: 'arc', outerRadius, innerRadius }
145
+ },
146
+ {
147
+ mark: { type: 'arc', innerRadius, stroke: '#fff' }
148
+ }
149
+ ];
150
+ }
151
+ const centerText = this.centerText;
152
+ if (centerText) {
153
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
154
+ this.baseChartSpec.layer.push({
155
+ data: { values: [{ centerText: centerText, value: 0 }] },
156
+ mark: { align: 'center', type: 'text', baseline: 'middle' },
157
+ encoding: {
158
+ color: { value: '#4C5054' },
159
+ text: { field: 'centerText' },
160
+ size: { value: { expr: 'height * 0.09' } },
161
+ tooltip: null
162
+ }
163
+ });
164
+ }
165
+ const centerSubText = this.centerSubText;
166
+ if (centerSubText) {
167
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
168
+ this.baseChartSpec.layer.push({
169
+ data: { values: [{ centerSubText: centerSubText, value: 0 }] },
170
+ mark: {
171
+ align: 'center',
172
+ type: 'text',
173
+ baseline: 'middle',
174
+ y: { expr: 'height/2 + 20' }
175
+ },
176
+ encoding: {
177
+ color: { value: '#6A6D70' },
178
+ text: { field: 'centerSubText' },
179
+ size: { value: { expr: 'height * 0.06' } },
180
+ tooltip: null
181
+ }
182
+ });
183
+ }
184
+ const labelRadius = this.labelRadius;
185
+ const labelField = this.labelField || DEFAULT_LABEL_FIELD_NAME;
186
+ if (labelRadius) {
187
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
188
+ this.baseChartSpec.layer.push({
189
+ mark: { type: 'text', radius: labelRadius },
190
+ encoding: {
191
+ text: { field: labelField, type: 'quantitative' }
192
+ }
193
+ });
194
+ }
195
+ if (this.showTooltip) {
196
+ if (this.tooltipOptions) {
197
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
198
+ this.baseChartSpec.layer[layerFiels].mark.tooltip = { content: 'data' };
199
+ this.tooltipSpec = {
200
+ actions: false,
201
+ tooltip: this.tooltipOptions
202
+ };
203
+ }
204
+ else {
205
+ this.baseChartSpec.encoding.tooltip = {
206
+ field: labelField,
207
+ aggregate: 'count',
208
+ type: 'quantitative'
209
+ };
210
+ }
211
+ }
212
+ const spec = Object.assign(this.baseChartSpec, chartData);
213
+ this.visualizationSpec = spec;
214
+ }
215
+ componentWillLoad() {
216
+ usage.trackComponent(this.root);
217
+ this.parseData();
218
+ }
219
+ render() {
220
+ return (index.h("gux-visualization-beta", { visualizationSpec: this.visualizationSpec, embedOptions: this.tooltipSpec }));
221
+ }
222
+ get root() { return index.getElement(this); }
223
+ static get watchers() { return {
224
+ "chartData": ["parseData"]
225
+ }; }
226
+ };
227
+ GuxDonutChart.style = guxChartDonutCss;
228
+
229
+ exports.gux_chart_donut_beta = GuxDonutChart;
@@ -0,0 +1,135 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-1e13a15f.js');
6
+ const usage = require('./usage-30f04ec3.js');
7
+ const logError = require('./log-error-c46b4b4c.js');
8
+
9
+ const guxChartLineCss = "gux-visualization-beta{height:fit-content;color:#2e394c}";
10
+
11
+ const DEFAULT_COLOR_FIELD_NAME = 'category';
12
+ const GuxLineChart = class {
13
+ constructor(hostRef) {
14
+ index.registerInstance(this, hostRef);
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ this.baseChartSpec = {
17
+ $schema: 'https://vega.github.io/schema/vega-lite/v5.json',
18
+ mark: {
19
+ type: 'line',
20
+ interpolate: 'linear',
21
+ point: false
22
+ },
23
+ config: {
24
+ axis: {
25
+ ticks: false,
26
+ titlePadding: 8
27
+ },
28
+ axisX: {
29
+ labelAngle: 0
30
+ },
31
+ legend: {
32
+ symbolType: 'circle'
33
+ }
34
+ },
35
+ encoding: {
36
+ x: { type: 'nominal' },
37
+ y: { type: 'quantitative' },
38
+ color: {
39
+ field: DEFAULT_COLOR_FIELD_NAME,
40
+ type: 'nominal',
41
+ scale: { range: logError.VISUALIZATION_COLORS },
42
+ legend: null
43
+ },
44
+ tooltip: { aggregate: 'count', type: 'quantitative' }
45
+ }
46
+ };
47
+ this.chartData = undefined;
48
+ this.xTickLabelSlant = undefined;
49
+ this.includeLegend = undefined;
50
+ this.legendPosition = 'right';
51
+ this.includeDataPointMarkers = undefined;
52
+ this.xFieldName = undefined;
53
+ this.xAxisTitle = undefined;
54
+ this.yFieldName = undefined;
55
+ this.yAxisTitle = undefined;
56
+ this.legendTitle = undefined;
57
+ this.colorFieldName = undefined;
58
+ this.strokeDash = undefined;
59
+ this.interpolation = undefined;
60
+ this.embedOptions = undefined;
61
+ }
62
+ parseData() {
63
+ if (!this.xFieldName || !this.yFieldName) {
64
+ logError.logError(this.root, 'requires x-field-name and y-field-name');
65
+ }
66
+ let chartData = {};
67
+ if (this.chartData) {
68
+ chartData = { data: this.chartData };
69
+ }
70
+ if (this.xTickLabelSlant) {
71
+ this.baseChartSpec.config.axisX.labelAngle = 45;
72
+ }
73
+ if (this.includeLegend) {
74
+ this.baseChartSpec.encoding.color.legend = true;
75
+ }
76
+ if (this.legendPosition) {
77
+ this.baseChartSpec.config.legend.orient = this.legendPosition;
78
+ }
79
+ const xFieldName = this.xFieldName;
80
+ const xAxisTitle = this.xAxisTitle;
81
+ const yFieldName = this.yFieldName;
82
+ const yAxisTitle = this.yAxisTitle;
83
+ const legendTitle = this.legendTitle;
84
+ const colorFieldName = this.colorFieldName || DEFAULT_COLOR_FIELD_NAME;
85
+ const interpolation = this.interpolation;
86
+ const strokeDash = this.strokeDash;
87
+ const includeDataPointMarkers = this.includeDataPointMarkers;
88
+ if (xFieldName) {
89
+ this.baseChartSpec.encoding.x.field = xFieldName;
90
+ }
91
+ if (xAxisTitle) {
92
+ this.baseChartSpec.encoding.x.title = xAxisTitle;
93
+ }
94
+ if (yFieldName) {
95
+ this.baseChartSpec.encoding.y.field = yFieldName;
96
+ }
97
+ if (yAxisTitle) {
98
+ this.baseChartSpec.encoding.y.title = yAxisTitle;
99
+ }
100
+ if (colorFieldName) {
101
+ this.baseChartSpec.encoding.color.field = colorFieldName;
102
+ }
103
+ if (legendTitle) {
104
+ this.baseChartSpec.encoding.color.title = legendTitle;
105
+ }
106
+ if (strokeDash) {
107
+ this.baseChartSpec.encoding.strokeDash = {
108
+ field: colorFieldName,
109
+ type: 'nominal'
110
+ };
111
+ }
112
+ if (interpolation) {
113
+ this.baseChartSpec.mark.interpolate = interpolation;
114
+ }
115
+ if (includeDataPointMarkers) {
116
+ this.baseChartSpec.mark.point = includeDataPointMarkers;
117
+ }
118
+ const spec = Object.assign(this.baseChartSpec, chartData);
119
+ this.visualizationSpec = spec;
120
+ }
121
+ componentWillLoad() {
122
+ usage.trackComponent(this.root);
123
+ this.parseData();
124
+ }
125
+ render() {
126
+ return (index.h("gux-visualization-beta", { visualizationSpec: this.visualizationSpec }));
127
+ }
128
+ get root() { return index.getElement(this); }
129
+ static get watchers() { return {
130
+ "chartData": ["parseData"]
131
+ }; }
132
+ };
133
+ GuxLineChart.style = guxChartLineCss;
134
+
135
+ exports.gux_chart_line_beta = GuxLineChart;
@@ -0,0 +1,113 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-1e13a15f.js');
6
+ const usage = require('./usage-30f04ec3.js');
7
+ const logError = require('./log-error-c46b4b4c.js');
8
+
9
+ const guxChartPieCss = "gux-visualization-beta{height:fit-content;color:#2e394c}";
10
+
11
+ const DEFAULT_COLOR_FIELD_NAME = 'category';
12
+ const DEFAULT_LABEL_FIELD_NAME = 'value';
13
+ const GuxPieChart = class {
14
+ constructor(hostRef) {
15
+ index.registerInstance(this, hostRef);
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ this.baseChartSpec = {
18
+ $schema: 'https://vega.github.io/schema/vega-lite/v5.json',
19
+ config: {
20
+ legend: {
21
+ symbolType: 'circle'
22
+ }
23
+ },
24
+ encoding: {
25
+ theta: { field: 'value', type: 'quantitative', stack: true },
26
+ color: {
27
+ field: DEFAULT_COLOR_FIELD_NAME,
28
+ type: 'nominal',
29
+ scale: { range: logError.VISUALIZATION_COLORS },
30
+ legend: null
31
+ },
32
+ tooltip: { aggregate: 'count', type: 'quantitative' }
33
+ },
34
+ layer: [
35
+ {
36
+ mark: { type: 'arc', outerRadius: 80 }
37
+ },
38
+ {
39
+ mark: { type: 'text', radius: 90 },
40
+ encoding: {
41
+ text: { field: DEFAULT_LABEL_FIELD_NAME, type: 'quantitative' }
42
+ }
43
+ }
44
+ ],
45
+ view: { stroke: null }
46
+ };
47
+ this.chartData = undefined;
48
+ this.includeLegend = undefined;
49
+ this.legendPosition = 'right';
50
+ this.legendTitle = undefined;
51
+ this.colorFieldName = undefined;
52
+ this.outerRadius = undefined;
53
+ this.labelRadius = undefined;
54
+ this.labelField = undefined;
55
+ this.embedOptions = undefined;
56
+ }
57
+ parseData() {
58
+ if (!this.outerRadius) {
59
+ logError.logError(this.root, 'requires outer-radius');
60
+ }
61
+ let chartData = {};
62
+ if (this.chartData) {
63
+ chartData = { data: this.chartData };
64
+ }
65
+ if (this.includeLegend) {
66
+ this.baseChartSpec.encoding.color.legend = true;
67
+ }
68
+ if (this.legendPosition) {
69
+ this.baseChartSpec.config.legend.orient = this.legendPosition;
70
+ }
71
+ const colorFieldName = this.colorFieldName || DEFAULT_COLOR_FIELD_NAME;
72
+ if (colorFieldName) {
73
+ this.baseChartSpec.encoding.color.field = colorFieldName;
74
+ }
75
+ const legendTitle = this.legendTitle;
76
+ if (legendTitle) {
77
+ this.baseChartSpec.encoding.color.title = legendTitle;
78
+ }
79
+ const outerRadius = this.outerRadius;
80
+ this.baseChartSpec.layer = [
81
+ {
82
+ mark: { type: 'arc', outerRadius }
83
+ }
84
+ ];
85
+ const labelRadius = this.labelRadius;
86
+ const labelField = this.labelField || DEFAULT_LABEL_FIELD_NAME;
87
+ if (labelRadius) {
88
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
89
+ this.baseChartSpec.layer.push({
90
+ mark: { type: 'text', radius: labelRadius },
91
+ encoding: {
92
+ text: { field: labelField, type: 'quantitative' }
93
+ }
94
+ });
95
+ }
96
+ const spec = Object.assign(this.baseChartSpec, chartData);
97
+ this.visualizationSpec = spec;
98
+ }
99
+ componentWillLoad() {
100
+ usage.trackComponent(this.root);
101
+ this.parseData();
102
+ }
103
+ render() {
104
+ return (index.h("gux-visualization-beta", { visualizationSpec: this.visualizationSpec }));
105
+ }
106
+ get root() { return index.getElement(this); }
107
+ static get watchers() { return {
108
+ "chartData": ["parseData"]
109
+ }; }
110
+ };
111
+ GuxPieChart.style = guxChartPieCss;
112
+
113
+ exports.gux_chart_pie_beta = GuxPieChart;