Skip to content

Commit 83a0193

Browse files
authored
[Explore vis] update discover vis defaults (#10711)
* update discover vis defaults 1. update some style panel accordions default to be closed 2. change default legend position to bottom 3. default to not show axis title for not specified This commit also fixed a legend title UI glitch issue that it first is visible then become invisible. Signed-off-by: Yulong Ruan <[email protected]> --------- Signed-off-by: Yulong Ruan <[email protected]>
1 parent d3c5461 commit 83a0193

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+355
-277
lines changed

cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/06/rule_matching_vis_area.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export const runCreateVisTests = () => {
4747
.then((canvas) => {
4848
beforeCanvasDataUrl = canvas[0].toDataURL(); // current representation of image
4949
});
50+
// Open axes setting
51+
cy.get('[aria-controls="axesSection"]').click();
5052
cy.getElementByTestId('showXAxisSwitch').click();
5153
// compare with new canvas
5254
cy.get('canvas.marks').then((canvas) => {
@@ -64,6 +66,8 @@ export const runCreateVisTests = () => {
6466
.then((canvas) => {
6567
beforeCanvasDataUrl = canvas[0].toDataURL(); // current representation of image
6668
});
69+
// Open thresholds setting
70+
cy.get('[aria-controls="thresholdSection"]').click();
6771
// Change threshold mode from default 'Off' to enable threshold functionality
6872
cy.getElementByTestId('thresholdModeSelect').should('be.visible').select('Solid lines');
6973
cy.getElementByTestId('exploreVisAddThreshold').click();

cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/06/rule_matching_vis_bar.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export const runCreateVisTests = () => {
4747
.then((canvas) => {
4848
beforeCanvasDataUrl = canvas[0].toDataURL(); // current representation of image
4949
});
50+
// Open Axes setting
51+
cy.get('[aria-controls="allAxesSection"]').click();
5052
cy.getElementByTestId('showAxisSwitch').eq(1).click();
5153
// compare with new canvas
5254
cy.get('canvas.marks').then((canvas) => {
@@ -82,6 +84,9 @@ export const runCreateVisTests = () => {
8284
});
8385

8486
cy.getElementByTestId('useThresholdColorButton').click();
87+
88+
// Open thresholds setting
89+
cy.get('[aria-controls="thresholdSection"]').click();
8590
cy.getElementByTestId('exploreVisAddThreshold').click();
8691
// compare with new canvas
8792
cy.get('canvas.marks').then((canvas) => {

cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/06/rule_matching_vis_heatmap.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export const runCreateVisTests = () => {
4747
.then((canvas) => {
4848
beforeCanvasDataUrl = canvas[0].toDataURL(); // current representation of image
4949
});
50+
// Open Axes setting
51+
cy.get('[aria-controls="allAxesSection"]').click();
5052
cy.getElementByTestId('showAxisSwitch').eq(1).click();
5153
// compare with new canvas
5254
cy.get('canvas.marks').then((canvas) => {
@@ -63,6 +65,8 @@ export const runCreateVisTests = () => {
6365
.then((canvas) => {
6466
beforeCanvasDataUrl = canvas[0].toDataURL(); // current representation of image
6567
});
68+
// Open legend setting
69+
cy.get('[aria-controls="legendSection"]').click();
6670
cy.getElementByTestId('legendModeSwitch').click();
6771
// compare with new canvas
6872
cy.get('canvas.marks').then((canvas) => {

cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/06/rule_matching_vis_line.spec.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export const runCreateVisTests = () => {
4747
.then((canvas) => {
4848
beforeCanvasDataUrl = canvas[0].toDataURL(); // current representation of image
4949
});
50+
// Open axes setting
51+
cy.get('[aria-controls="axesSection"]').click();
5052
// turn off show X axis
5153
cy.getElementByTestId('showXAxisSwitch').click();
5254
// compare with new canvas
@@ -82,8 +84,10 @@ export const runCreateVisTests = () => {
8284
beforeCanvasDataUrl = canvas[0].toDataURL(); // current representation of image
8385
});
8486

87+
// Open thresholds setting
88+
cy.get('[aria-controls="thresholdSection"]').click();
8589
// Change threshold mode from default 'Off' to enable threshold functionality
86-
cy.getElementByTestId('thresholdModeSelect').should('be.visible').select('Solid lines');
90+
cy.getElementByTestId('thresholdModeSelect').select('Solid lines');
8791
cy.getElementByTestId('exploreVisAddThreshold').click();
8892
// compare with new canvas
8993
cy.get('canvas.marks').then((canvas) => {

cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/06/rule_matching_vis_pie.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ export const runCreateVisTests = () => {
4949
.then((canvas) => {
5050
beforeCanvasDataUrl = canvas[0].toDataURL(); // current representation of image
5151
});
52+
// Open legend setting
53+
cy.get('[aria-controls="legendSection"]').click();
5254
cy.getElementByTestId('legendModeSwitch').click();
5355
// compare with new canvas
5456
cy.get('canvas.marks').then((canvas) => {

cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/06/rule_matching_vis_scatter.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export const runCreateVisTests = () => {
4747
.then((canvas) => {
4848
beforeCanvasDataUrl = canvas[0].toDataURL(); // current representation of image
4949
});
50+
// Open Axes setting
51+
cy.get('[aria-controls="allAxesSection"]').click();
5052
// turn off show y axis
5153
cy.getElementByTestId('showAxisSwitch').eq(1).click();
5254
// compare with new canvas

src/plugins/explore/public/components/visualizations/area/area_vis_config.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('area_vis_config', () => {
1616
test('should have the expected default values', () => {
1717
expect(defaultAreaChartStyles).toMatchObject({
1818
addLegend: true,
19-
legendPosition: Positions.RIGHT,
19+
legendPosition: Positions.BOTTOM,
2020
addTimeMarker: false,
2121
tooltipOptions: {
2222
mode: 'all',

src/plugins/explore/public/components/visualizations/area/area_vis_config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ export type AreaChartStyle = Required<
5454
const defaultAreaChartStyles: AreaChartStyle = {
5555
// Basic controls
5656
addLegend: true,
57-
legendPosition: Positions.RIGHT,
57+
legendTitle: '',
58+
legendPosition: Positions.BOTTOM,
5859
addTimeMarker: false,
5960
tooltipOptions: {
6061
mode: 'all',

src/plugins/explore/public/components/visualizations/area/to_expression.ts

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const createSimpleAreaChart = (
5252
type: 'temporal',
5353
axis: applyAxisStyling(
5454
{
55-
title: dateName,
55+
title: '',
5656
labelAngle: -45,
5757
labelSeparation: 8,
5858
},
@@ -66,14 +66,7 @@ export const createSimpleAreaChart = (
6666
y: {
6767
field: metricField,
6868
type: 'quantitative',
69-
axis: applyAxisStyling(
70-
{ title: metricName },
71-
styles,
72-
'value',
73-
numericalColumns,
74-
[],
75-
dateColumns
76-
),
69+
axis: applyAxisStyling({ title: '' }, styles, 'value', numericalColumns, [], dateColumns),
7770
},
7871
...(showTooltip && {
7972
tooltip: [
@@ -188,7 +181,7 @@ export const createMultiAreaChart = (
188181
type: 'temporal',
189182
axis: applyAxisStyling(
190183
{
191-
title: dateName,
184+
title: '',
192185
labelAngle: -45,
193186
labelSeparation: 8,
194187
},
@@ -203,7 +196,7 @@ export const createMultiAreaChart = (
203196
field: metricField,
204197
type: 'quantitative',
205198
axis: applyAxisStyling(
206-
{ title: metricName },
199+
{ title: '' },
207200
styles,
208201
'value',
209202
numericalColumns,
@@ -331,7 +324,7 @@ export const createFacetedMultiAreaChart = (
331324
type: 'temporal',
332325
axis: applyAxisStyling(
333326
{
334-
title: dateName,
327+
title: '',
335328
labelAngle: -45,
336329
labelSeparation: 8,
337330
},
@@ -346,7 +339,7 @@ export const createFacetedMultiAreaChart = (
346339
field: metricField,
347340
type: 'quantitative',
348341
axis: applyAxisStyling(
349-
{ title: metricName },
342+
{ title: '' },
350343
styles,
351344
'value',
352345
numericalColumns,
@@ -512,7 +505,7 @@ export const createCategoryAreaChart = (
512505
type: 'nominal',
513506
axis: applyAxisStyling(
514507
{
515-
title: categoryName,
508+
title: '',
516509
labelAngle: -45,
517510
labelSeparation: 8,
518511
},
@@ -527,7 +520,7 @@ export const createCategoryAreaChart = (
527520
field: metricField,
528521
type: 'quantitative',
529522
axis: applyAxisStyling(
530-
{ title: metricName },
523+
{ title: '' },
531524
styles,
532525
'value',
533526
numericalColumns,
@@ -620,7 +613,7 @@ export const createStackedAreaChart = (
620613
type: 'nominal',
621614
axis: applyAxisStyling(
622615
{
623-
title: categoryName1,
616+
title: '',
624617
labelAngle: -45,
625618
labelSeparation: 8,
626619
},
@@ -635,7 +628,7 @@ export const createStackedAreaChart = (
635628
field: metricField,
636629
type: 'quantitative',
637630
axis: applyAxisStyling(
638-
{ title: metricName },
631+
{ title: '' },
639632
styles,
640633
'value',
641634
numericalColumns,

src/plugins/explore/public/components/visualizations/bar/bar_chart_utils.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import {
77
inferTimeIntervals,
8-
transformIntervelsToTickCount,
8+
transformIntervalsToTickCount,
99
inferBucketSize,
1010
adjustBucketBins,
1111
buildEncoding,
@@ -41,10 +41,10 @@ describe('bar_chart_utils', () => {
4141

4242
describe('transformIntervelsToTickCount', () => {
4343
it('transforms time units correctly', () => {
44-
expect(transformIntervelsToTickCount(TimeUnit.YEAR)).toBe('year');
45-
expect(transformIntervelsToTickCount(TimeUnit.MONTH)).toBe('month');
46-
expect(transformIntervelsToTickCount(TimeUnit.DATE)).toBe('day');
47-
expect(transformIntervelsToTickCount(undefined)).toBe('day');
44+
expect(transformIntervalsToTickCount(TimeUnit.YEAR)).toBe('year');
45+
expect(transformIntervalsToTickCount(TimeUnit.MONTH)).toBe('month');
46+
expect(transformIntervalsToTickCount(TimeUnit.DATE)).toBe('day');
47+
expect(transformIntervalsToTickCount(undefined)).toBe('day');
4848
});
4949
});
5050

0 commit comments

Comments
 (0)