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] Remove "inside only" option for treemap labels #65363

Merged
merged 4 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
20 changes: 19 additions & 1 deletion x-pack/plugins/lens/public/pie_visualization/settings_widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,24 @@ const categoryOptions: Array<{
},
];

const categoryOptionsTreemap: Array<{
value: SharedLayerState['categoryDisplay'];
inputDisplay: string;
}> = [
{
value: 'default',
inputDisplay: i18n.translate('xpack.lens.pieChart.showTreemapCategoriesLabel', {
defaultMessage: 'Show',
}),
},
{
value: 'hide',
inputDisplay: i18n.translate('xpack.lens.pieChart.categoriesInLegendLabel', {
defaultMessage: 'Hide labels',
}),
},
];

const legendOptions: Array<{
value: SharedLayerState['legendDisplay'];
label: string;
Expand Down Expand Up @@ -113,7 +131,7 @@ export function SettingsWidget(props: VisualizationLayerWidgetProps<PieVisualiza
<EuiSuperSelect
compressed
valueOfSelected={layer.categoryDisplay}
options={categoryOptions}
options={state.shape === 'treemap' ? categoryOptionsTreemap : categoryOptions}
onChange={option => {
setState({
...state,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ describe('suggestions', () => {
metric: 'b',

numberDisplay: 'hidden',
categoryDisplay: 'inside',
categoryDisplay: 'default', // This is changed
legendDisplay: 'show',
percentDecimals: 0,
nestedLegend: true,
Expand Down
4 changes: 4 additions & 0 deletions x-pack/plugins/lens/public/pie_visualization/suggestions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ export function suggestions({
layerId: table.layerId,
groups: groups.map(col => col.columnId),
metric: metrics[0].columnId,
categoryDisplay:
state.layers[0].categoryDisplay === 'inside'
? 'default'
: state.layers[0].categoryDisplay,
}
: {
layerId: table.layerId,
Expand Down