Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lens] Legend config #70619

Merged
merged 63 commits into from
Jul 22, 2020
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
bebac29
add toolbar api
flash1293 Jun 16, 2020
e983014
fix teests
flash1293 Jun 16, 2020
3fbff62
fix types
flash1293 Jun 16, 2020
426f2ce
fix functional test
flash1293 Jun 16, 2020
44a17c3
Merge remote-tracking branch 'upstream/master' into lens/toolbar
flash1293 Jun 18, 2020
8c7381e
add back title
flash1293 Jun 18, 2020
64ee8ef
remove separator line
flash1293 Jun 18, 2020
9bb7843
Merge remote-tracking branch 'upstream/master' into lens/toolbar
flash1293 Jun 18, 2020
c1ddaaa
fix i18n
flash1293 Jun 18, 2020
e51ff5e
Update x-pack/plugins/lens/public/editor_frame_service/editor_frame/_…
flash1293 Jun 18, 2020
e3c6f94
Merge remote-tracking branch 'upstream/master' into lens/toolbar
flash1293 Jun 18, 2020
a278772
Merge branch 'lens/toolbar' of github.com:flash1293/kibana into lens/…
flash1293 Jun 18, 2020
bfb6898
Merge remote-tracking branch 'upstream/master' into lens/toolbar
flash1293 Jun 18, 2020
b3fb6e8
Merge remote-tracking branch 'upstream/master' into lens/toolbar
flash1293 Jun 18, 2020
2434486
do not show unsaved when there is no cahrt
flash1293 Jun 18, 2020
85c128e
revert unnecessary changes
flash1293 Jun 18, 2020
1ece895
Merge remote-tracking branch 'upstream/master' into lens/toolbar
flash1293 Jun 23, 2020
34cff58
always show title if available
flash1293 Jun 23, 2020
7a20163
Merge remote-tracking branch 'upstream/master' into lens/toolbar
flash1293 Jun 24, 2020
c6cdca0
fitting functions
flash1293 Jun 24, 2020
c0adafc
Merge remote-tracking branch 'upstream/master' into lens/fitting-func…
flash1293 Jun 25, 2020
fc6bd1d
clean up implementation
flash1293 Jun 25, 2020
edf1818
Merge branch 'master' into lens/fitting-functions
elasticmachine Jun 25, 2020
7e744a1
Merge remote-tracking branch 'upstream/master' into lens/fitting-func…
flash1293 Jun 26, 2020
5d0b6f4
use compressed form
flash1293 Jun 26, 2020
bde6bec
Merge remote-tracking branch 'upstream/master' into lens/fitting-func…
flash1293 Jun 26, 2020
4facefc
Merge branch 'lens/fitting-functions' of github.com:flash1293/kibana …
flash1293 Jun 26, 2020
3c3a4d6
Merge remote-tracking branch 'upstream/master' into lens/fitting-func…
flash1293 Jun 26, 2020
6d6f8d0
fix styling
flash1293 Jun 26, 2020
188f3a7
Merge remote-tracking branch 'upstream/master' into lens/fitting-func…
flash1293 Jun 29, 2020
4fd45fa
review comments
flash1293 Jun 29, 2020
af9b28e
Merge remote-tracking branch 'upstream/master' into lens/fitting-func…
flash1293 Jun 30, 2020
cb4c969
exclude stacked area charts
flash1293 Jun 30, 2020
e0d313f
Merge remote-tracking branch 'upstream/master' into lens/fitting-func…
flash1293 Jul 1, 2020
62d6945
adjust test and rename none to hidden
flash1293 Jul 1, 2020
b48b8d6
change descriptions
flash1293 Jul 1, 2020
8e9aa69
Merge remote-tracking branch 'upstream/master' into lens/fitting-func…
flash1293 Jul 2, 2020
328184f
apply feedback
flash1293 Jul 2, 2020
ba332b3
Merge remote-tracking branch 'upstream/master' into lens/fitting-func…
flash1293 Jul 2, 2020
f016ece
Merge remote-tracking branch 'upstream/master' into lens/fitting-func…
flash1293 Jul 2, 2020
c9840d1
implement legend config
flash1293 Jul 2, 2020
90fbbb3
Merge remote-tracking branch 'upstream/master' into lens/fitting-func…
flash1293 Jul 3, 2020
efd751e
change setting button to text
flash1293 Jul 3, 2020
df8da41
Merge remote-tracking branch 'upstream/master' into lens/legend-config
flash1293 Jul 3, 2020
242c795
Merge branch 'lens/fitting-functions' into lens/legend-config
flash1293 Jul 3, 2020
a2a0704
move pie toolbar over
flash1293 Jul 3, 2020
dc5d7c8
fix state management bug
flash1293 Jul 3, 2020
c5ab932
fix tests
flash1293 Jul 3, 2020
758e5a8
Merge remote-tracking branch 'upstream/master' into lens/legend-config
flash1293 Jul 6, 2020
fe16f35
fix eslint error
flash1293 Jul 6, 2020
20c8188
Merge branch 'master' into lens/legend-config
elasticmachine Jul 6, 2020
e302733
Merge branch 'master' into lens/legend-config
elasticmachine Jul 13, 2020
e9bcbe6
Merge branch 'master' into lens/legend-config
mbondyra Jul 17, 2020
6f2acf1
Merge branch 'master' into lens/legend-config
elasticmachine Jul 17, 2020
b3cc284
Update xy_config_panel.tsx
mbondyra Jul 17, 2020
ce31e3b
Merge remote-tracking branch 'upstream/master' into lens/legend-config
flash1293 Jul 21, 2020
947fbc5
reviews
flash1293 Jul 21, 2020
bec88ff
Merge branch 'lens/legend-config' of github.com:flash1293/kibana into…
flash1293 Jul 21, 2020
638ebc9
fix translations
flash1293 Jul 21, 2020
10ac06b
Merge remote-tracking branch 'upstream/master' into lens/legend-config
flash1293 Jul 21, 2020
0e660ba
fix reviews
flash1293 Jul 21, 2020
7f98197
remove unused fragment
flash1293 Jul 21, 2020
6bfd2c5
Merge branch 'master' into lens/legend-config
elasticmachine Jul 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function WorkspacePanelWrapper({
clearStagedPreview: false,
});
},
[dispatch]
[dispatch, activeVisualization]
);
return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { toExpression, toPreviewExpression } from './to_expression';
import { LayerState, PieVisualizationState } from './types';
import { suggestions } from './suggestions';
import { CHART_NAMES, MAX_PIE_BUCKETS, MAX_TREEMAP_BUCKETS } from './constants';
import { SettingsWidget } from './settings_widget';
import { PieToolbar } from './toolbar';

function newLayerState(layerId: string): LayerState {
return {
Expand Down Expand Up @@ -204,10 +204,10 @@ export const pieVisualization: Visualization<PieVisualizationState, PieVisualiza
toExpression,
toPreviewExpression,

renderLayerContextMenu(domElement, props) {
renderToolbar(domElement, props) {
render(
<I18nProvider>
<SettingsWidget {...props} />
<PieToolbar {...props} />
</I18nProvider>,
domElement
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { i18n } from '@kbn/i18n';
import { Position } from '@elastic/charts';
import { I18nProvider } from '@kbn/i18n/react';
import {
IInterpreterRenderHandlers,
Expand Down Expand Up @@ -73,6 +74,11 @@ export const pie: ExpressionFunctionDefinition<
types: ['boolean'],
help: '',
},
legendPosition: {
types: ['string'],
options: [Position.Top, Position.Right, Position.Bottom, Position.Left],
help: '',
},
percentDecimals: {
types: ['number'],
help: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ describe('PieVisualization component', () => {
};
}

test('it shows legend on correct side', () => {
const component = shallow(
<PieComponent args={{ ...args, legendPosition: 'top' }} {...getDefaultArgs()} />
);
expect(component.find(Settings).prop('legendPosition')).toEqual('top');
});

test('it shows legend for 2 groups using default legendDisplay', () => {
const component = shallow(<PieComponent args={args} {...getDefaultArgs()} />);
expect(component.find(Settings).prop('showLegend')).toEqual(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export function PieComponent(
numberDisplay,
categoryDisplay,
legendDisplay,
legendPosition,
nestedLegend,
percentDecimals,
hideLabels,
Expand Down Expand Up @@ -237,6 +238,7 @@ export function PieComponent(
(legendDisplay === 'show' ||
(legendDisplay === 'default' && columnGroups.length > 1 && shape !== 'treemap'))
}
legendPosition={legendPosition || 'right'}
flash1293 marked this conversation as resolved.
Show resolved Hide resolved
legendMaxDepth={nestedLegend ? undefined : 1 /* Color is based only on first layer */}
onElementClick={(args) => {
const context = getFilterContext(
Expand Down

This file was deleted.

230 changes: 0 additions & 230 deletions x-pack/plugins/lens/public/pie_visualization/settings_widget.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function expressionHelper(
numberDisplay: [layer.numberDisplay],
categoryDisplay: [layer.categoryDisplay],
legendDisplay: [layer.legendDisplay],
legendPosition: [layer.legendPosition || 'right'],
percentDecimals: [layer.percentDecimals ?? DEFAULT_PERCENT_DECIMALS],
nestedLegend: [!!layer.nestedLegend],
},
Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/lens/public/pie_visualization/toolbar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.lnsPieToolbar__popover {
width: 400px;
flash1293 marked this conversation as resolved.
Show resolved Hide resolved
}
Loading