Skip to content

Commit

Permalink
add tooltip and change icon (#132581)
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 authored May 20, 2022
1 parent aa4c389 commit 57d783a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,11 @@ export const getDatatableVisualization = ({
)
.map((accessor) => ({
columnId: accessor,
triggerIcon:
columnMap[accessor].hidden || columnMap[accessor].collapseFn
? 'invisible'
: undefined,
triggerIcon: columnMap[accessor].hidden
? 'invisible'
: columnMap[accessor].collapseFn
? 'aggregate'
: undefined,
})),
supportsMoreColumns: true,
filterOperations: (op) => op.isBucketed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ export function ColorIndicator({
})}
/>
)}
{accessorConfig.triggerIcon === 'aggregate' && (
<EuiIcon
{...baseIconProps}
type="fold"
color="subdued"
aria-label={i18n.translate('xpack.lens.editorFrame.aggregateIndicatorLabel', {
defaultMessage:
'This dimension is not visible in the chart because all individual values are aggregated into a single value',
})}
/>
)}
{accessorConfig.triggerIcon === 'colorBy' && (
<EuiIcon
{...baseIconProps}
Expand Down
19 changes: 17 additions & 2 deletions x-pack/plugins/lens/public/shared_components/collapse_setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { EuiFormRow, EuiSelect } from '@elastic/eui';
import { EuiFormRow, EuiIcon, EuiSelect, EuiToolTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';

Expand All @@ -26,7 +26,22 @@ export function CollapseSetting({
}) {
return (
<EuiFormRow
label={i18n.translate('xpack.lens.collapse.label', { defaultMessage: 'Collapse by' })}
label={
<EuiToolTip
delay="long"
position="top"
content={i18n.translate('xpack.lens.collapse.infoIcon', {
defaultMessage:
'Do not show this dimension in the visualization and aggregate all metric values which have the same value for this dimension into a single number.',
})}
>
<span>
{i18n.translate('xpack.lens.collapse.label', { defaultMessage: 'Collapse by' })}
{''}
<EuiIcon type="questionInCircle" color="subdued" size="s" className="eui-alignTop" />
</span>
</EuiToolTip>
}
display="columnCompressed"
fullWidth
>
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/lens/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ export type VisualizationDimensionEditorProps<T = unknown> = VisualizationConfig

export interface AccessorConfig {
columnId: string;
triggerIcon?: 'color' | 'disabled' | 'colorBy' | 'none' | 'invisible';
triggerIcon?: 'color' | 'disabled' | 'colorBy' | 'none' | 'invisible' | 'aggregate';
color?: string;
palette?: string[] | Array<{ color: string; stop: number }>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export const getXyVisualization = ({
? [
{
columnId: dataLayer.splitAccessor,
triggerIcon: dataLayer.collapseFn ? ('invisible' as const) : ('colorBy' as const),
triggerIcon: dataLayer.collapseFn ? ('aggregate' as const) : ('colorBy' as const),
palette: dataLayer.collapseFn
? undefined
: paletteService
Expand Down

0 comments on commit 57d783a

Please sign in to comment.