genesys-spark-chart-components 4.262.5 → 4.262.6

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 (49) hide show
  1. package/dist/cjs/{color-palette-CwSB4jG_.js → color-palette-CIfKETRv.js} +1 -1
  2. package/dist/cjs/gux-chart-column-beta.cjs.entry.js +6 -8
  3. package/dist/cjs/gux-chart-donut-beta.cjs.entry.js +6 -8
  4. package/dist/cjs/gux-chart-line-beta.cjs.entry.js +1 -1
  5. package/dist/cjs/gux-chart-pie-beta.cjs.entry.js +6 -8
  6. package/dist/cjs/gux-chart-scatter-plot-beta.cjs.entry.js +1 -1
  7. package/dist/cjs/gux-visualization-beta.cjs.entry.js +1 -1
  8. package/dist/collection/components/beta/gux-chart-column/gux-chart-column.js +5 -7
  9. package/dist/collection/components/beta/gux-chart-column/tests/gux-chart-column.common.js +63 -0
  10. package/dist/collection/components/beta/gux-chart-donut/gux-chart-donut.js +5 -7
  11. package/dist/collection/components/beta/gux-chart-donut/tests/gux-chart-donut.common.js +50 -0
  12. package/dist/collection/components/beta/gux-chart-line/tests/gux-chart-line.common.js +62 -0
  13. package/dist/collection/components/beta/gux-chart-pie/gux-chart-pie.js +5 -7
  14. package/dist/collection/components/beta/gux-chart-pie/tests/gux-chart-pie.common.js +45 -0
  15. package/dist/collection/components/beta/gux-chart-scatter-plot/tests/gux-chart-scatter-plot.common.js +54 -0
  16. package/dist/collection/components/beta/gux-visualization/tests/gux-visualization.common.js +116 -0
  17. package/dist/collection/test/commonTestUtils.js +1 -0
  18. package/dist/collection/test/expectToHaveNoViolations.js +44 -0
  19. package/dist/collection/test/playwrightTestUtils.js +177 -0
  20. package/dist/collection/test/setupAxeTests.js +5 -64
  21. package/dist/esm/{color-palette-DMUN-KvB.js → color-palette-D-Gi1-DZ.js} +1 -1
  22. package/dist/esm/gux-chart-column-beta.entry.js +6 -8
  23. package/dist/esm/gux-chart-donut-beta.entry.js +6 -8
  24. package/dist/esm/gux-chart-line-beta.entry.js +1 -1
  25. package/dist/esm/gux-chart-pie-beta.entry.js +6 -8
  26. package/dist/esm/gux-chart-scatter-plot-beta.entry.js +1 -1
  27. package/dist/esm/gux-visualization-beta.entry.js +1 -1
  28. package/dist/genesys-chart-webcomponents/genesys-chart-webcomponents.esm.js +1 -1
  29. package/dist/genesys-chart-webcomponents/p-2077462e.entry.js +1 -0
  30. package/dist/genesys-chart-webcomponents/p-315054e8.entry.js +1 -0
  31. package/dist/genesys-chart-webcomponents/{p-4074c43f.entry.js → p-52de3bcb.entry.js} +1 -1
  32. package/dist/genesys-chart-webcomponents/{p-94fcd188.entry.js → p-96698672.entry.js} +1 -1
  33. package/dist/genesys-chart-webcomponents/{p-DMUN-KvB.js → p-D-Gi1-DZ.js} +1 -1
  34. package/dist/genesys-chart-webcomponents/{p-9ee251a3.entry.js → p-b9df873c.entry.js} +1 -1
  35. package/dist/genesys-chart-webcomponents/p-e77f6da7.entry.js +1 -0
  36. package/dist/types/components/beta/gux-chart-column/tests/gux-chart-column.common.d.ts +5 -0
  37. package/dist/types/components/beta/gux-chart-donut/tests/gux-chart-donut.common.d.ts +5 -0
  38. package/dist/types/components/beta/gux-chart-line/tests/gux-chart-line.common.d.ts +5 -0
  39. package/dist/types/components/beta/gux-chart-pie/tests/gux-chart-pie.common.d.ts +5 -0
  40. package/dist/types/components/beta/gux-chart-scatter-plot/tests/gux-chart-scatter-plot.common.d.ts +5 -0
  41. package/dist/types/components/beta/gux-visualization/tests/gux-visualization.common.d.ts +6 -0
  42. package/dist/types/test/commonTestUtils.d.ts +4 -0
  43. package/dist/types/test/expectToHaveNoViolations.d.ts +14 -0
  44. package/dist/types/test/playwrightTestUtils.d.ts +27 -0
  45. package/dist/types/test/setupAxeTests.d.ts +1 -0
  46. package/package.json +9 -1
  47. package/dist/genesys-chart-webcomponents/p-30c034e4.entry.js +0 -1
  48. package/dist/genesys-chart-webcomponents/p-40e1427e.entry.js +0 -1
  49. package/dist/genesys-chart-webcomponents/p-bf3467de.entry.js +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const version = "4.262.5";
3
+ const version = "4.262.6";
4
4
  var packageInfo = {
5
5
  version: version};
6
6
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-BU_h9-dW.js');
4
- var colorPalette = require('./color-palette-CwSB4jG_.js');
4
+ var colorPalette = require('./color-palette-CIfKETRv.js');
5
5
  var logError = require('./log-error-BMPVm36Q.js');
6
6
 
7
7
  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{}gux-visualization-beta .mark-rect.layer_1_marks path{fill:#1da8b3}`;
@@ -54,10 +54,6 @@ const GuxColumnChart = class {
54
54
  if (!this.xFieldName || !this.yFieldName) {
55
55
  logError.logError(this.root, 'requires x-field-name and y-field-name');
56
56
  }
57
- let chartData = {};
58
- if (this.chartData) {
59
- chartData = { data: this.chartData };
60
- }
61
57
  if (this.xTickLabelSlant) {
62
58
  this.baseChartSpec.config.axisX.labelAngle = 45;
63
59
  }
@@ -116,15 +112,17 @@ const GuxColumnChart = class {
116
112
  [rangeField]: colorPalette.VISUALIZATION_COLORS
117
113
  };
118
114
  this.baseChartSpec.config.range = rangeConfig;
119
- const spec = Object.assign(this.baseChartSpec, chartData);
120
- this.visualizationSpec = spec;
115
+ if (this.chartData) {
116
+ this.baseChartSpec.data = this.chartData;
117
+ }
118
+ this.visualizationSpec = JSON.parse(JSON.stringify(this.baseChartSpec));
121
119
  }
122
120
  componentWillLoad() {
123
121
  colorPalette.trackComponent(this.root);
124
122
  this.parseData();
125
123
  }
126
124
  render() {
127
- return (index.h("gux-visualization-beta", { key: '3747bc873408091885951d9b093bcb386a85b545', visualizationSpec: this.visualizationSpec }));
125
+ return (index.h("gux-visualization-beta", { key: 'bd2bf20b792ced36ea252d1332b3049c3ff5a652', visualizationSpec: this.visualizationSpec }));
128
126
  }
129
127
  get root() { return index.getElement(this); }
130
128
  static get watchers() { return {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-BU_h9-dW.js');
4
- var colorPalette = require('./color-palette-CwSB4jG_.js');
4
+ var colorPalette = require('./color-palette-CIfKETRv.js');
5
5
  var logError = require('./log-error-BMPVm36Q.js');
6
6
 
7
7
  const guxChartDonutCss = () => `gux-visualization-beta{height:fit-content;color:#2e394c}`;
@@ -49,10 +49,6 @@ const GuxDonutChart = class {
49
49
  if (!this.outerRadius && !this.innerRadius) {
50
50
  logError.logError(this.root, 'requires at least one of outer-radius or inner-radius');
51
51
  }
52
- let chartData = {};
53
- if (this.chartData) {
54
- chartData = { data: this.chartData };
55
- }
56
52
  this.baseChartSpec.config.legend.orient = this.legendPosition;
57
53
  if (this.includeLegend) {
58
54
  this.baseChartSpec.encoding.color.legend = {};
@@ -186,15 +182,17 @@ const GuxDonutChart = class {
186
182
  };
187
183
  }
188
184
  }
189
- const spec = Object.assign(this.baseChartSpec, chartData);
190
- this.visualizationSpec = spec;
185
+ if (this.chartData) {
186
+ this.baseChartSpec.data = this.chartData;
187
+ }
188
+ this.visualizationSpec = JSON.parse(JSON.stringify(this.baseChartSpec));
191
189
  }
192
190
  componentWillLoad() {
193
191
  colorPalette.trackComponent(this.root);
194
192
  this.parseData();
195
193
  }
196
194
  render() {
197
- return (index.h("gux-visualization-beta", { key: '9c6ad7f05c2f788bd677dca62fd91505cba0b525', visualizationSpec: this.visualizationSpec, embedOptions: this.tooltipSpec }));
195
+ return (index.h("gux-visualization-beta", { key: 'd8fd27820d40a737e614891b68c579d03422399e', visualizationSpec: this.visualizationSpec, embedOptions: this.tooltipSpec }));
198
196
  }
199
197
  get root() { return index.getElement(this); }
200
198
  static get watchers() { return {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-BU_h9-dW.js');
4
- var colorPalette = require('./color-palette-CwSB4jG_.js');
4
+ var colorPalette = require('./color-palette-CIfKETRv.js');
5
5
  var logError = require('./log-error-BMPVm36Q.js');
6
6
 
7
7
  const guxChartLineCss = () => `gux-visualization-beta{height:fit-content;color:#2e394c}`;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-BU_h9-dW.js');
4
- var colorPalette = require('./color-palette-CwSB4jG_.js');
4
+ var colorPalette = require('./color-palette-CIfKETRv.js');
5
5
  var logError = require('./log-error-BMPVm36Q.js');
6
6
 
7
7
  const guxChartPieCss = () => `gux-visualization-beta{height:fit-content;color:#2e394c}`;
@@ -48,10 +48,6 @@ const GuxPieChart = class {
48
48
  if (!this.outerRadius) {
49
49
  logError.logError(this.root, 'requires outer-radius');
50
50
  }
51
- let chartData = {};
52
- if (this.chartData) {
53
- chartData = { data: this.chartData };
54
- }
55
51
  if (this.includeLegend) {
56
52
  this.baseChartSpec.encoding.color.legend = true;
57
53
  }
@@ -79,15 +75,17 @@ const GuxPieChart = class {
79
75
  }
80
76
  });
81
77
  }
82
- const spec = Object.assign(this.baseChartSpec, chartData);
83
- this.visualizationSpec = spec;
78
+ if (this.chartData) {
79
+ this.baseChartSpec.data = this.chartData;
80
+ }
81
+ this.visualizationSpec = JSON.parse(JSON.stringify(this.baseChartSpec));
84
82
  }
85
83
  componentWillLoad() {
86
84
  colorPalette.trackComponent(this.root);
87
85
  this.parseData();
88
86
  }
89
87
  render() {
90
- return (index.h("gux-visualization-beta", { key: 'bda28ea5f2fbd01ee1a91287f2c30446db02d910', visualizationSpec: this.visualizationSpec }));
88
+ return (index.h("gux-visualization-beta", { key: '14ea025a649390ac62820a42990bbbf4f7b8f4f5', visualizationSpec: this.visualizationSpec }));
91
89
  }
92
90
  get root() { return index.getElement(this); }
93
91
  static get watchers() { return {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-BU_h9-dW.js');
4
- var colorPalette = require('./color-palette-CwSB4jG_.js');
4
+ var colorPalette = require('./color-palette-CIfKETRv.js');
5
5
  var logError = require('./log-error-BMPVm36Q.js');
6
6
 
7
7
  const guxChartScatterPlotCss = () => `gux-visualization-beta{height:fit-content;color:#2e394c}`;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index$4 = require('./index-BU_h9-dW.js');
4
- var colorPalette = require('./color-palette-CwSB4jG_.js');
4
+ var colorPalette = require('./color-palette-CIfKETRv.js');
5
5
 
6
6
  // Note: This regex matches even invalid JSON strings, but since we’re
7
7
  // working on the output of `JSON.stringify` we know that only valid strings
@@ -50,10 +50,6 @@ export class GuxColumnChart {
50
50
  if (!this.xFieldName || !this.yFieldName) {
51
51
  logError(this.root, 'requires x-field-name and y-field-name');
52
52
  }
53
- let chartData = {};
54
- if (this.chartData) {
55
- chartData = { data: this.chartData };
56
- }
57
53
  if (this.xTickLabelSlant) {
58
54
  this.baseChartSpec.config.axisX.labelAngle = 45;
59
55
  }
@@ -112,15 +108,17 @@ export class GuxColumnChart {
112
108
  [rangeField]: VisualizationColorUtil.VISUALIZATION_COLORS
113
109
  };
114
110
  this.baseChartSpec.config.range = rangeConfig;
115
- const spec = Object.assign(this.baseChartSpec, chartData);
116
- this.visualizationSpec = spec;
111
+ if (this.chartData) {
112
+ this.baseChartSpec.data = this.chartData;
113
+ }
114
+ this.visualizationSpec = JSON.parse(JSON.stringify(this.baseChartSpec));
117
115
  }
118
116
  componentWillLoad() {
119
117
  trackComponent(this.root);
120
118
  this.parseData();
121
119
  }
122
120
  render() {
123
- return (h("gux-visualization-beta", { key: '3747bc873408091885951d9b093bcb386a85b545', visualizationSpec: this.visualizationSpec }));
121
+ return (h("gux-visualization-beta", { key: 'bd2bf20b792ced36ea252d1332b3049c3ff5a652', visualizationSpec: this.visualizationSpec }));
124
122
  }
125
123
  static get is() { return "gux-chart-column-beta"; }
126
124
  static get encapsulation() { return "shadow"; }
@@ -0,0 +1,63 @@
1
+ import { hoverFirstShadowMark } from "../../../../test/playwrightTestUtils";
2
+ const chartData = {
3
+ values: [
4
+ { category: 'a', value: 4 },
5
+ { category: 'b', value: 6 },
6
+ { category: 'c', value: 10 },
7
+ { category: 'd', value: 3 },
8
+ { category: 'e', value: 10 },
9
+ { category: 'f', value: 20 }
10
+ ]
11
+ };
12
+ const layeredData = {
13
+ values: [
14
+ { category: 'a', value: 3, series: 'group1' },
15
+ { category: 'a', value: 4, series: 'group2' },
16
+ { category: 'b', value: 1, series: 'group1' },
17
+ { category: 'b', value: 6, series: 'group2' },
18
+ { category: 'c', value: 10, series: 'group2' },
19
+ { category: 'c', value: 7, series: 'group1' }
20
+ ]
21
+ };
22
+ async function setChartData(page, data, layers) {
23
+ await page.evaluate(({ data, layers }) => {
24
+ const el = document.querySelector('gux-chart-column-beta');
25
+ if (el) {
26
+ el.chartData = data;
27
+ if (layers) {
28
+ el.chartLayers = layers;
29
+ }
30
+ }
31
+ }, { data, layers });
32
+ await page.waitForFunction(() => {
33
+ var _a, _b;
34
+ const host = document.querySelector('gux-chart-column-beta');
35
+ const viz = (_a = host === null || host === void 0 ? void 0 : host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('gux-visualization-beta');
36
+ return ((_b = viz === null || viz === void 0 ? void 0 : viz.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.mark-rect path')) !== null;
37
+ });
38
+ }
39
+ export const renderConfigs = [
40
+ {
41
+ description: 'should render default column chart',
42
+ html: '<div lang="en" style="width:500px"><gux-chart-column-beta x-field-name="category" y-field-name="value"></gux-chart-column-beta></div>',
43
+ extraActions: page => setChartData(page, chartData)
44
+ },
45
+ {
46
+ description: 'should render layered column chart',
47
+ html: '<div lang="en" style="width:500px"><gux-chart-column-beta x-field-name="category" y-field-name="value"></gux-chart-column-beta></div>',
48
+ extraActions: page => setChartData(page, layeredData, ['group2', 'group1'])
49
+ },
50
+ {
51
+ description: 'should render column chart with legend',
52
+ html: '<div lang="en" style="width:500px"><gux-chart-column-beta include-legend="true" x-field-name="category" y-field-name="value"></gux-chart-column-beta></div>',
53
+ extraActions: page => setChartData(page, chartData)
54
+ },
55
+ {
56
+ description: 'should render column chart with tooltip on hover',
57
+ html: '<div lang="en" style="width:500px"><gux-chart-column-beta x-field-name="category" y-field-name="value"></gux-chart-column-beta></div>',
58
+ extraActions: async (page) => {
59
+ await setChartData(page, chartData);
60
+ await hoverFirstShadowMark(page, 'gux-chart-column-beta', '.mark-rect path');
61
+ }
62
+ }
63
+ ];
@@ -45,10 +45,6 @@ export class GuxDonutChart {
45
45
  if (!this.outerRadius && !this.innerRadius) {
46
46
  logError(this.root, 'requires at least one of outer-radius or inner-radius');
47
47
  }
48
- let chartData = {};
49
- if (this.chartData) {
50
- chartData = { data: this.chartData };
51
- }
52
48
  this.baseChartSpec.config.legend.orient = this.legendPosition;
53
49
  if (this.includeLegend) {
54
50
  this.baseChartSpec.encoding.color.legend = {};
@@ -182,15 +178,17 @@ export class GuxDonutChart {
182
178
  };
183
179
  }
184
180
  }
185
- const spec = Object.assign(this.baseChartSpec, chartData);
186
- this.visualizationSpec = spec;
181
+ if (this.chartData) {
182
+ this.baseChartSpec.data = this.chartData;
183
+ }
184
+ this.visualizationSpec = JSON.parse(JSON.stringify(this.baseChartSpec));
187
185
  }
188
186
  componentWillLoad() {
189
187
  trackComponent(this.root);
190
188
  this.parseData();
191
189
  }
192
190
  render() {
193
- return (h("gux-visualization-beta", { key: '9c6ad7f05c2f788bd677dca62fd91505cba0b525', visualizationSpec: this.visualizationSpec, embedOptions: this.tooltipSpec }));
191
+ return (h("gux-visualization-beta", { key: 'd8fd27820d40a737e614891b68c579d03422399e', visualizationSpec: this.visualizationSpec, embedOptions: this.tooltipSpec }));
194
192
  }
195
193
  static get is() { return "gux-chart-donut-beta"; }
196
194
  static get encapsulation() { return "shadow"; }
@@ -0,0 +1,50 @@
1
+ import { hoverFirstShadowMark } from "../../../../test/playwrightTestUtils";
2
+ const chartData = {
3
+ values: [
4
+ { category: 'Voice', value: 4 },
5
+ { category: 'Callback', value: 6 },
6
+ { category: 'Chat', value: 10 },
7
+ { category: 'Email', value: 3 },
8
+ { category: 'Messaging', value: 7 },
9
+ { category: 'Wuphf', value: 8 }
10
+ ]
11
+ };
12
+ async function setChartData(page) {
13
+ await page.evaluate(data => {
14
+ const el = document.querySelector('gux-chart-donut-beta');
15
+ if (el) {
16
+ el.chartData = data;
17
+ }
18
+ }, chartData);
19
+ await page.waitForFunction(() => {
20
+ var _a, _b;
21
+ const host = document.querySelector('gux-chart-donut-beta');
22
+ const viz = (_a = host === null || host === void 0 ? void 0 : host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('gux-visualization-beta');
23
+ return ((_b = viz === null || viz === void 0 ? void 0 : viz.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.mark-arc path')) !== null;
24
+ });
25
+ }
26
+ export const renderConfigs = [
27
+ {
28
+ description: 'should render donut chart',
29
+ html: '<div lang="en" style="width:400px"><gux-chart-donut-beta label-radius="110" label-field="value" outer-radius="80" inner-radius="68"></gux-chart-donut-beta></div>',
30
+ extraActions: setChartData
31
+ },
32
+ {
33
+ description: 'should render donut chart with legend',
34
+ html: '<div lang="en" style="width:400px"><gux-chart-donut-beta label-radius="110" label-field="value" include-legend="true" legend-title="Media Type" outer-radius="100"></gux-chart-donut-beta></div>',
35
+ extraActions: setChartData
36
+ },
37
+ {
38
+ description: 'should render gauge donut with center text',
39
+ html: '<div lang="en" style="width:400px"><gux-chart-donut-beta label-radius="110" label-field="value" outer-radius="80" inner-radius="68" gauge="true" center-text="38%" center-sub-text="Total Percentage"></gux-chart-donut-beta></div>',
40
+ extraActions: setChartData
41
+ },
42
+ {
43
+ description: 'should render donut chart with tooltip on hover',
44
+ html: '<div lang="en" style="width:400px"><gux-chart-donut-beta label-radius="110" label-field="value" outer-radius="80" inner-radius="68"></gux-chart-donut-beta></div>',
45
+ extraActions: async (page) => {
46
+ await setChartData(page);
47
+ await hoverFirstShadowMark(page, 'gux-chart-donut-beta', '.mark-arc path');
48
+ }
49
+ }
50
+ ];
@@ -0,0 +1,62 @@
1
+ import { hoverFirstShadowMark } from "../../../../test/playwrightTestUtils";
2
+ const chartData = {
3
+ values: [
4
+ { date: '2021-01-01', value: 9.4, category: 'Jupiter' },
5
+ { date: '2021-01-02', value: 12.8, category: 'Jupiter' },
6
+ { date: '2021-01-03', value: 10.6, category: 'Jupiter' },
7
+ { date: '2021-01-04', value: 11.7, category: 'Jupiter' },
8
+ { date: '2021-01-05', value: 12.2, category: 'Jupiter' },
9
+ { date: '2021-01-06', value: 8.9, category: 'Jupiter' },
10
+ { date: '2021-01-01', value: 5.6, category: 'Venus' },
11
+ { date: '2021-01-02', value: 5.6, category: 'Venus' },
12
+ { date: '2021-01-03', value: 5.0, category: 'Venus' },
13
+ { date: '2021-01-04', value: 10.6, category: 'Venus' },
14
+ { date: '2021-01-05', value: 12.2, category: 'Venus' },
15
+ { date: '2021-01-06', value: 12.2, category: 'Venus' }
16
+ ]
17
+ };
18
+ async function setChartData(page) {
19
+ await page.evaluate(data => {
20
+ const el = document.querySelector('gux-chart-line-beta');
21
+ if (el) {
22
+ el.chartData = data;
23
+ }
24
+ }, chartData);
25
+ await page.waitForFunction(() => {
26
+ var _a, _b;
27
+ const host = document.querySelector('gux-chart-line-beta');
28
+ const viz = (_a = host === null || host === void 0 ? void 0 : host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('gux-visualization-beta');
29
+ return ((_b = viz === null || viz === void 0 ? void 0 : viz.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.mark-line path')) !== null;
30
+ });
31
+ }
32
+ export const renderConfigs = [
33
+ {
34
+ description: 'should render default line chart',
35
+ html: '<div lang="en" style="width:500px"><gux-chart-line-beta x-field-name="date" y-field-name="value" x-tick-label-slant="true"></gux-chart-line-beta></div>',
36
+ extraActions: setChartData
37
+ },
38
+ {
39
+ description: 'should render line chart with legend',
40
+ html: '<div lang="en" style="width:500px"><gux-chart-line-beta x-field-name="date" y-field-name="value" include-legend="true" x-tick-label-slant="true"></gux-chart-line-beta></div>',
41
+ extraActions: setChartData
42
+ },
43
+ {
44
+ description: 'should render line chart with point markers',
45
+ html: '<div lang="en" style="width:500px"><gux-chart-line-beta x-field-name="date" y-field-name="value" include-legend="true" include-data-point-markers="true" x-tick-label-slant="true"></gux-chart-line-beta></div>',
46
+ extraActions: setChartData
47
+ },
48
+ {
49
+ description: 'should render line chart with tooltip on hover',
50
+ html: '<div lang="en" style="width:500px"><gux-chart-line-beta x-field-name="date" y-field-name="value" x-tick-label-slant="true" include-data-point-markers="true"></gux-chart-line-beta></div>',
51
+ extraActions: async (page) => {
52
+ await setChartData(page);
53
+ await page.waitForFunction(() => {
54
+ var _a, _b;
55
+ const host = document.querySelector('gux-chart-line-beta');
56
+ const viz = (_a = host === null || host === void 0 ? void 0 : host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('gux-visualization-beta');
57
+ return ((_b = viz === null || viz === void 0 ? void 0 : viz.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.mark-symbol path')) !== null;
58
+ });
59
+ await hoverFirstShadowMark(page, 'gux-chart-line-beta', '.mark-symbol path');
60
+ }
61
+ }
62
+ ];
@@ -44,10 +44,6 @@ export class GuxPieChart {
44
44
  if (!this.outerRadius) {
45
45
  logError(this.root, 'requires outer-radius');
46
46
  }
47
- let chartData = {};
48
- if (this.chartData) {
49
- chartData = { data: this.chartData };
50
- }
51
47
  if (this.includeLegend) {
52
48
  this.baseChartSpec.encoding.color.legend = true;
53
49
  }
@@ -75,15 +71,17 @@ export class GuxPieChart {
75
71
  }
76
72
  });
77
73
  }
78
- const spec = Object.assign(this.baseChartSpec, chartData);
79
- this.visualizationSpec = spec;
74
+ if (this.chartData) {
75
+ this.baseChartSpec.data = this.chartData;
76
+ }
77
+ this.visualizationSpec = JSON.parse(JSON.stringify(this.baseChartSpec));
80
78
  }
81
79
  componentWillLoad() {
82
80
  trackComponent(this.root);
83
81
  this.parseData();
84
82
  }
85
83
  render() {
86
- return (h("gux-visualization-beta", { key: 'bda28ea5f2fbd01ee1a91287f2c30446db02d910', visualizationSpec: this.visualizationSpec }));
84
+ return (h("gux-visualization-beta", { key: '14ea025a649390ac62820a42990bbbf4f7b8f4f5', visualizationSpec: this.visualizationSpec }));
87
85
  }
88
86
  static get is() { return "gux-chart-pie-beta"; }
89
87
  static get encapsulation() { return "shadow"; }
@@ -0,0 +1,45 @@
1
+ import { hoverFirstShadowMark } from "../../../../test/playwrightTestUtils";
2
+ const chartData = {
3
+ values: [
4
+ { category: 'Voice', value: 4 },
5
+ { category: 'Callback', value: 6 },
6
+ { category: 'Chat', value: 10 },
7
+ { category: 'Email', value: 3 },
8
+ { category: 'Messaging', value: 7 },
9
+ { category: 'Wuphf', value: 8 }
10
+ ]
11
+ };
12
+ async function setChartData(page) {
13
+ await page.evaluate(data => {
14
+ const el = document.querySelector('gux-chart-pie-beta');
15
+ if (el) {
16
+ el.chartData = data;
17
+ }
18
+ }, chartData);
19
+ await page.waitForFunction(() => {
20
+ var _a, _b;
21
+ const host = document.querySelector('gux-chart-pie-beta');
22
+ const viz = (_a = host === null || host === void 0 ? void 0 : host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('gux-visualization-beta');
23
+ return ((_b = viz === null || viz === void 0 ? void 0 : viz.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.mark-arc path')) !== null;
24
+ });
25
+ }
26
+ export const renderConfigs = [
27
+ {
28
+ description: 'should render pie chart',
29
+ html: '<div lang="en" style="width:400px"><gux-chart-pie-beta label-radius="110" label-field="value" outer-radius="100"></gux-chart-pie-beta></div>',
30
+ extraActions: setChartData
31
+ },
32
+ {
33
+ description: 'should render pie chart with legend',
34
+ html: '<div lang="en" style="width:400px"><gux-chart-pie-beta label-radius="110" label-field="value" include-legend="true" legend-title="Media Type" outer-radius="100"></gux-chart-pie-beta></div>',
35
+ extraActions: setChartData
36
+ },
37
+ {
38
+ description: 'should render pie chart with tooltip on hover',
39
+ html: '<div lang="en" style="width:400px"><gux-chart-pie-beta label-radius="110" label-field="value" outer-radius="100"></gux-chart-pie-beta></div>',
40
+ extraActions: async (page) => {
41
+ await setChartData(page);
42
+ await hoverFirstShadowMark(page, 'gux-chart-pie-beta', '.mark-arc path');
43
+ }
44
+ }
45
+ ];
@@ -0,0 +1,54 @@
1
+ import { hoverFirstShadowMark } from "../../../../test/playwrightTestUtils";
2
+ const chartData = {
3
+ values: [
4
+ { date: '2021-01-01', value: 9.4, category: 'Jupiter' },
5
+ { date: '2021-01-02', value: 12.8, category: 'Jupiter' },
6
+ { date: '2021-01-03', value: 10.6, category: 'Jupiter' },
7
+ { date: '2021-01-04', value: 11.7, category: 'Jupiter' },
8
+ { date: '2021-01-05', value: 12.2, category: 'Jupiter' },
9
+ { date: '2021-01-01', value: 5.6, category: 'Venus' },
10
+ { date: '2021-01-02', value: 5.6, category: 'Venus' },
11
+ { date: '2021-01-03', value: 5.0, category: 'Venus' },
12
+ { date: '2021-01-04', value: 10.6, category: 'Venus' },
13
+ { date: '2021-01-05', value: 12.2, category: 'Venus' },
14
+ { date: '2021-01-01', value: 2.6, category: 'Saturn' },
15
+ { date: '2021-01-02', value: 6.6, category: 'Saturn' },
16
+ { date: '2021-01-03', value: 3.0, category: 'Saturn' },
17
+ { date: '2021-01-04', value: 1.6, category: 'Saturn' },
18
+ { date: '2021-01-05', value: 14.2, category: 'Saturn' }
19
+ ]
20
+ };
21
+ async function setChartData(page) {
22
+ await page.evaluate(data => {
23
+ const el = document.querySelector('gux-chart-scatter-plot-beta');
24
+ if (el) {
25
+ el.chartData = data;
26
+ }
27
+ }, chartData);
28
+ await page.waitForFunction(() => {
29
+ var _a, _b;
30
+ const host = document.querySelector('gux-chart-scatter-plot-beta');
31
+ const viz = (_a = host === null || host === void 0 ? void 0 : host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('gux-visualization-beta');
32
+ return ((_b = viz === null || viz === void 0 ? void 0 : viz.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('svg')) !== null;
33
+ });
34
+ }
35
+ export const renderConfigs = [
36
+ {
37
+ description: 'should render default scatter plot',
38
+ html: '<div lang="en" style="width:500px"><gux-chart-scatter-plot-beta x-field-name="date" y-field-name="value" x-tick-label-slant="true"></gux-chart-scatter-plot-beta></div>',
39
+ extraActions: setChartData
40
+ },
41
+ {
42
+ description: 'should render scatter plot with legend',
43
+ html: '<div lang="en" style="width:500px"><gux-chart-scatter-plot-beta x-field-name="date" y-field-name="value" include-legend="true" x-tick-label-slant="true"></gux-chart-scatter-plot-beta></div>',
44
+ extraActions: setChartData
45
+ },
46
+ {
47
+ description: 'should render scatter plot with tooltip on hover',
48
+ html: '<div lang="en" style="width:500px"><gux-chart-scatter-plot-beta x-field-name="date" y-field-name="value" x-tick-label-slant="true"></gux-chart-scatter-plot-beta></div>',
49
+ extraActions: async (page) => {
50
+ await setChartData(page);
51
+ await hoverFirstShadowMark(page, 'gux-chart-scatter-plot-beta', '.mark-symbol path');
52
+ }
53
+ }
54
+ ];
@@ -0,0 +1,116 @@
1
+ import { hoverFirstShadowMark } from "../../../../test/playwrightTestUtils";
2
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
+ function setSpec(spec) {
4
+ return async (page) => {
5
+ await page.evaluate(s => {
6
+ const el = document.querySelector('gux-visualization-beta');
7
+ if (el) {
8
+ el.visualizationSpec = s;
9
+ }
10
+ }, spec);
11
+ await page.locator('gux-visualization-beta svg').waitFor();
12
+ };
13
+ }
14
+ async function waitForMark(page, selector) {
15
+ await page.waitForFunction(sel => {
16
+ var _a;
17
+ const viz = document.querySelector('gux-visualization-beta');
18
+ return ((_a = viz === null || viz === void 0 ? void 0 : viz.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(sel)) !== null;
19
+ }, selector);
20
+ }
21
+ const html = '<div lang="en" style="width:400px"><gux-visualization-beta></gux-visualization-beta></div>';
22
+ const barSpec = {
23
+ $schema: 'https://vega.github.io/schema/vega-lite/v6.json',
24
+ data: {
25
+ values: [
26
+ { category: 'A', value: 4 },
27
+ { category: 'B', value: 6 },
28
+ { category: 'C', value: 10 },
29
+ { category: 'D', value: 3 }
30
+ ]
31
+ },
32
+ mark: { type: 'bar' },
33
+ encoding: {
34
+ x: { field: 'category', type: 'nominal' },
35
+ y: { field: 'value', type: 'quantitative' }
36
+ }
37
+ };
38
+ const lineSpec = {
39
+ $schema: 'https://vega.github.io/schema/vega-lite/v6.json',
40
+ data: {
41
+ values: [
42
+ { month: '2024-01-01', value: 4 },
43
+ { month: '2024-02-01', value: 6 },
44
+ { month: '2024-03-01', value: 10 },
45
+ { month: '2024-04-01', value: 3 }
46
+ ]
47
+ },
48
+ mark: { type: 'line' },
49
+ encoding: {
50
+ x: { field: 'month', type: 'temporal' },
51
+ y: { field: 'value', type: 'quantitative' }
52
+ }
53
+ };
54
+ const pieSpec = {
55
+ $schema: 'https://vega.github.io/schema/vega-lite/v6.json',
56
+ data: {
57
+ values: [
58
+ { category: 'A', value: 4 },
59
+ { category: 'B', value: 6 },
60
+ { category: 'C', value: 10 },
61
+ { category: 'D', value: 3 }
62
+ ]
63
+ },
64
+ encoding: {
65
+ theta: { field: 'value', type: 'quantitative', stack: true },
66
+ color: { field: 'category', type: 'nominal', legend: null }
67
+ },
68
+ layer: [{ mark: { type: 'arc', outerRadius: 80 } }]
69
+ };
70
+ const lineSpecWithTooltip = Object.assign(Object.assign({}, lineSpec), { mark: { type: 'line', point: true, tooltip: true } });
71
+ const pieSpecWithTooltip = Object.assign(Object.assign({}, pieSpec), { layer: [{ mark: { type: 'arc', outerRadius: 80, tooltip: true } }] });
72
+ const barWithTooltipSpec = Object.assign(Object.assign({}, barSpec), { mark: { type: 'bar', tooltip: true } });
73
+ export const renderConfigs = [
74
+ {
75
+ description: 'should render a bar chart',
76
+ html,
77
+ extraActions: setSpec(barSpec)
78
+ },
79
+ {
80
+ description: 'should render a line chart',
81
+ html,
82
+ extraActions: setSpec(lineSpec)
83
+ },
84
+ {
85
+ description: 'should render a pie chart',
86
+ html,
87
+ extraActions: setSpec(pieSpec)
88
+ },
89
+ {
90
+ description: 'should render a bar chart with tooltip on hover',
91
+ html,
92
+ extraActions: async (page) => {
93
+ await setSpec(barWithTooltipSpec)(page);
94
+ await waitForMark(page, '.mark-rect path');
95
+ await hoverFirstShadowMark(page, 'gux-visualization-beta', '.mark-rect path');
96
+ }
97
+ },
98
+ {
99
+ description: 'should render a line chart with tooltip on hover',
100
+ html,
101
+ extraActions: async (page) => {
102
+ await setSpec(lineSpecWithTooltip)(page);
103
+ await waitForMark(page, '.mark-symbol path');
104
+ await hoverFirstShadowMark(page, 'gux-visualization-beta', '.mark-symbol path');
105
+ }
106
+ },
107
+ {
108
+ description: 'should render a pie chart with tooltip on hover',
109
+ html,
110
+ extraActions: async (page) => {
111
+ await setSpec(pieSpecWithTooltip)(page);
112
+ await waitForMark(page, '.mark-arc path');
113
+ await hoverFirstShadowMark(page, 'gux-visualization-beta', '.mark-arc path');
114
+ }
115
+ }
116
+ ];