Skip to content

Commit 943c36c

Browse files
Merge branch '7.x' into backport/7.x/pr-70031
2 parents e3f7789 + 37a7005 commit 943c36c

File tree

20 files changed

+388
-113
lines changed

20 files changed

+388
-113
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@ Summarize your PR. If it involves visual changes include a screenshot or gif.
44

55
### Checklist
66

7-
Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR.
7+
Delete any items that are not applicable to this PR.
88

9-
- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)
109
- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)
1110
- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials
1211
- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios
1312
- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)
13+
- [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)
14+
- [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
1415

1516
### For maintainers
1617

1718
- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)
18-
- [ ] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)
19-

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
"@babel/plugin-transform-modules-commonjs": "^7.10.1",
121121
"@babel/register": "^7.10.1",
122122
"@elastic/apm-rum": "^5.2.0",
123-
"@elastic/charts": "19.6.3",
123+
"@elastic/charts": "19.7.0",
124124
"@elastic/datemath": "5.0.3",
125125
"@elastic/ems-client": "7.9.3",
126126
"@elastic/eui": "24.1.0",

packages/kbn-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap

Lines changed: 0 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/kbn-ui-shared-deps/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"kbn:watch": "node scripts/build --dev --watch"
1010
},
1111
"dependencies": {
12-
"@elastic/charts": "19.6.3",
12+
"@elastic/charts": "19.7.0",
1313
"@elastic/eui": "24.1.0",
1414
"@elastic/numeral": "^2.5.0",
1515
"@kbn/i18n": "1.0.0",

x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.tsx

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,29 +68,33 @@ export function WorkspacePanelWrapper({
6868
return (
6969
<EuiFlexGroup gutterSize="s" direction="column" alignItems="stretch" responsive={false}>
7070
<EuiFlexItem grow={false}>
71-
<ChartSwitch
72-
data-test-subj="lnsChartSwitcher"
73-
visualizationMap={visualizationMap}
74-
visualizationId={visualizationId}
75-
visualizationState={visualizationState}
76-
datasourceMap={datasourceMap}
77-
datasourceStates={datasourceStates}
78-
dispatch={dispatch}
79-
framePublicAPI={framePublicAPI}
80-
/>
71+
<EuiFlexGroup gutterSize="s" direction="row" responsive={false}>
72+
<EuiFlexItem grow={false}>
73+
<ChartSwitch
74+
data-test-subj="lnsChartSwitcher"
75+
visualizationMap={visualizationMap}
76+
visualizationId={visualizationId}
77+
visualizationState={visualizationState}
78+
datasourceMap={datasourceMap}
79+
datasourceStates={datasourceStates}
80+
dispatch={dispatch}
81+
framePublicAPI={framePublicAPI}
82+
/>
83+
</EuiFlexItem>
84+
{activeVisualization && activeVisualization.renderToolbar && (
85+
<EuiFlexItem grow>
86+
<NativeRenderer
87+
render={activeVisualization.renderToolbar}
88+
nativeProps={{
89+
frame: framePublicAPI,
90+
state: visualizationState,
91+
setState: setVisualizationState,
92+
}}
93+
/>
94+
</EuiFlexItem>
95+
)}
96+
</EuiFlexGroup>
8197
</EuiFlexItem>
82-
{activeVisualization && activeVisualization.renderToolbar && (
83-
<EuiFlexItem grow={false}>
84-
<NativeRenderer
85-
render={activeVisualization.renderToolbar}
86-
nativeProps={{
87-
frame: framePublicAPI,
88-
state: visualizationState,
89-
setState: setVisualizationState,
90-
}}
91-
/>
92-
</EuiFlexItem>
93-
)}
9498
<EuiFlexItem>
9599
<EuiPageContent className="lnsWorkspacePanelWrapper">
96100
{(!emptyExpression || title) && (

x-pack/plugins/lens/public/xy_visualization/__snapshots__/to_expression.test.ts.snap

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/lens/public/xy_visualization/__snapshots__/xy_expression.test.tsx.snap

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { Fit } from '@elastic/charts';
8+
import { i18n } from '@kbn/i18n';
9+
10+
export type FittingFunction = typeof fittingFunctionDefinitions[number]['id'];
11+
12+
export const fittingFunctionDefinitions = [
13+
{
14+
id: 'None',
15+
title: i18n.translate('xpack.lens.fittingFunctionsTitle.none', {
16+
defaultMessage: 'Hide',
17+
}),
18+
description: i18n.translate('xpack.lens.fittingFunctionsDescription.none', {
19+
defaultMessage: 'Do not fill gaps',
20+
}),
21+
},
22+
{
23+
id: 'Zero',
24+
title: i18n.translate('xpack.lens.fittingFunctionsTitle.zero', {
25+
defaultMessage: 'Zero',
26+
}),
27+
description: i18n.translate('xpack.lens.fittingFunctionsDescription.zero', {
28+
defaultMessage: 'Fill gaps with zeros',
29+
}),
30+
},
31+
{
32+
id: 'Linear',
33+
title: i18n.translate('xpack.lens.fittingFunctionsTitle.linear', {
34+
defaultMessage: 'Linear',
35+
}),
36+
description: i18n.translate('xpack.lens.fittingFunctionsDescription.linear', {
37+
defaultMessage: 'Fill gaps with a line',
38+
}),
39+
},
40+
{
41+
id: 'Carry',
42+
title: i18n.translate('xpack.lens.fittingFunctionsTitle.carry', {
43+
defaultMessage: 'Last',
44+
}),
45+
description: i18n.translate('xpack.lens.fittingFunctionsDescription.carry', {
46+
defaultMessage: 'Fill gaps with the last value',
47+
}),
48+
},
49+
{
50+
id: 'Lookahead',
51+
title: i18n.translate('xpack.lens.fittingFunctionsTitle.lookahead', {
52+
defaultMessage: 'Next',
53+
}),
54+
description: i18n.translate('xpack.lens.fittingFunctionsDescription.lookahead', {
55+
defaultMessage: 'Fill gaps with the next value',
56+
}),
57+
},
58+
] as const;
59+
60+
export function getFitEnum(fittingFunction?: FittingFunction) {
61+
if (fittingFunction) {
62+
return Fit[fittingFunction];
63+
}
64+
return Fit.None;
65+
}
66+
67+
export function getFitOptions(fittingFunction?: FittingFunction) {
68+
return { type: getFitEnum(fittingFunction) };
69+
}

x-pack/plugins/lens/public/xy_visualization/to_expression.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ describe('#toExpression', () => {
4040
{
4141
legend: { position: Position.Bottom, isVisible: true },
4242
preferredSeriesType: 'bar',
43+
fittingFunction: 'Carry',
4344
layers: [
4445
{
4546
layerId: 'first',
@@ -55,6 +56,27 @@ describe('#toExpression', () => {
5556
).toMatchSnapshot();
5657
});
5758

59+
it('should default the fitting function to None', () => {
60+
expect(
61+
(xyVisualization.toExpression(
62+
{
63+
legend: { position: Position.Bottom, isVisible: true },
64+
preferredSeriesType: 'bar',
65+
layers: [
66+
{
67+
layerId: 'first',
68+
seriesType: 'area',
69+
splitAccessor: 'd',
70+
xAccessor: 'a',
71+
accessors: ['b', 'c'],
72+
},
73+
],
74+
},
75+
frame
76+
) as Ast).chain[0].arguments.fittingFunction[0]
77+
).toEqual('None');
78+
});
79+
5880
it('should not generate an expression when missing x', () => {
5981
expect(
6082
xyVisualization.toExpression(

x-pack/plugins/lens/public/xy_visualization/to_expression.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export const buildExpression = (
133133
],
134134
},
135135
],
136+
fittingFunction: [state.fittingFunction || 'None'],
136137
layers: validLayers.map((layer) => {
137138
const columnToLabel: Record<string, string> = {};
138139

0 commit comments

Comments
 (0)