Skip to content

Commit

Permalink
[8.x] [Lens] revert Select line chart by default if the x-axis contai…
Browse files Browse the repository at this point in the history
…ns a timestamp (#198555) (#198798)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Lens] revert Select line chart by default if the x-axis contains a
timestamp (#198555)](#198555)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Marta
Bondyra","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-04T14:25:07Z","message":"[Lens]
revert Select line chart by default if the x-axis contains a timestamp
(#198555)\n\nReverts
https://github.com/elastic/kibana/pull/190786/files\r\n\r\n---------\r\n\r\nCo-authored-by:
Marco Vettorello
<[email protected]>","sha":"d1171418dd7d8c7252ad34b6bb2e4ff505fb684d","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Feature:Lens","v9.0.0","backport:version","v8.17.0"],"title":"[Lens]
revert Select line chart by default if the x-axis contains a
timestamp","number":198555,"url":"https://github.com/elastic/kibana/pull/198555","mergeCommit":{"message":"[Lens]
revert Select line chart by default if the x-axis contains a timestamp
(#198555)\n\nReverts
https://github.com/elastic/kibana/pull/190786/files\r\n\r\n---------\r\n\r\nCo-authored-by:
Marco Vettorello
<[email protected]>","sha":"d1171418dd7d8c7252ad34b6bb2e4ff505fb684d"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198555","number":198555,"mergeCommit":{"message":"[Lens]
revert Select line chart by default if the x-axis contains a timestamp
(#198555)\n\nReverts
https://github.com/elastic/kibana/pull/190786/files\r\n\r\n---------\r\n\r\nCo-authored-by:
Marco Vettorello
<[email protected]>","sha":"d1171418dd7d8c7252ad34b6bb2e4ff505fb684d"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Marta Bondyra <[email protected]>
  • Loading branch information
kibanamachine and mbondyra authored Nov 4, 2024
1 parent e204a18 commit 5189b2d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ describe('xy_suggestions', () => {
expect((suggestions[0].state.layers[0] as XYDataLayerConfig).seriesType).toEqual('line');
});

test('suggests line if changeType is initial and date column is involved', () => {
test('suggests bar if changeType is initial and date column is involved', () => {
const currentState: XYState = {
legend: { isVisible: true, position: 'bottom' },
valueLabels: 'hide',
Expand Down Expand Up @@ -885,8 +885,8 @@ describe('xy_suggestions', () => {
expect(suggestions).toHaveLength(1);

expect(suggestions[0].hide).toEqual(false);
expect(suggestions[0].state.preferredSeriesType).toEqual('line');
expect((suggestions[0].state.layers[0] as XYDataLayerConfig).seriesType).toEqual('line');
expect(suggestions[0].state.preferredSeriesType).toEqual('bar_stacked');
expect((suggestions[0].state.layers[0] as XYDataLayerConfig).seriesType).toEqual('bar_stacked');
});

test('makes a visible seriesType suggestion for unchanged table without split', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,6 @@ function getSuggestionsForLayer({
allowMixed,
};

if (changeType === 'initial' && xValue?.operation.dataType === 'date') {
return buildSuggestion({ ...options, seriesType: 'line' });
}
// handles the simplest cases, acting as a chart switcher
if (!currentState && changeType === 'unchanged') {
// Chart switcher needs to include every chart type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await testSubjects.click('fieldToggle-DistanceKilometers');

const data = await lens.getCurrentChartDebugState('xyVisChart');
assertMatchesExpectedData(data, [expectedLogstashData, expectedFlightsData], 'lines');
assertMatchesExpectedData(data, [expectedLogstashData, expectedFlightsData]);
});

it('ignores global filters on layers using a data view without the filter field', async () => {
await filterBar.addFilter({ field: 'Carrier', operation: 'exists' });
const data = await lens.getCurrentChartDebugState('xyVisChart');
assertMatchesExpectedData(data, [expectedLogstashData, expectedFlightsData], 'lines');
assertMatchesExpectedData(data, [expectedLogstashData, expectedFlightsData]);
await lens.save(visTitle);
});

Expand All @@ -120,7 +120,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

await visualize.openSavedVisualization(visTitle);
const data = await lens.getCurrentChartDebugState('xyVisChart');
assertMatchesExpectedData(data, [expectedFlightsData], 'lines');
assertMatchesExpectedData(data, [expectedFlightsData]);
});
});
}

0 comments on commit 5189b2d

Please sign in to comment.