Skip to content

Commit

Permalink
[Visualize] Removes dimming opacity setting (#111704)
Browse files Browse the repository at this point in the history
* [Visualize] Removes the dimming opacity setting

* Remove from docs

* Fix 18n

* Address PR comments

* More cleaning

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
stratoula and kibanamachine authored Sep 14, 2021
1 parent 182533f commit 8a4355b
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 59 deletions.
4 changes: 0 additions & 4 deletions docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,6 @@ Enables the legacy charts library for timelion charts in Visualize.
**This setting is deprecated and will not be supported as of 8.0.**
Maps values to specific colors in charts using the *Compatibility* palette.

[[visualization-dimmingopacity]]`visualization:dimmingOpacity`::
The opacity of the chart items that are dimmed when highlighting another element
of the chart. Use numbers between 0 and 1. The lower the number, the more the highlighted element stands out.

[[visualization-heatmap-maxbuckets]]`visualization:heatmap:maxBuckets`::
The maximum number of buckets a datasource can return. High numbers can have a negative impact on your browser rendering performance.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'visualization:dimmingOpacity': {
type: 'float',
_meta: { description: 'Non-default value of setting.' },
},
'visualization:tileMap:maxPrecision': {
type: 'long',
_meta: { description: 'Non-default value of setting.' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export interface UsageStats {
'visualization:heatmap:maxBuckets': number;
'visualization:colorMapping': string;
'visualization:regionmap:showWarnings': boolean;
'visualization:dimmingOpacity': number;
'visualization:tileMap:maxPrecision': number;
'csv:separator': string;
'visualization:tileMap:WMSdefaults': string;
Expand Down
6 changes: 0 additions & 6 deletions src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -7068,12 +7068,6 @@
"description": "Non-default value of setting."
}
},
"visualization:dimmingOpacity": {
"type": "float",
"_meta": {
"description": "Non-default value of setting."
}
},
"visualization:tileMap:maxPrecision": {
"type": "long",
"_meta": {
Expand Down
1 change: 0 additions & 1 deletion src/plugins/vis_types/vislib/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
* Side Public License, v 1.
*/

export const DIMMING_OPACITY_SETTING = 'visualization:dimmingOpacity';
export const HEATMAP_MAX_BUCKETS_SETTING = 'visualization:heatmap:maxBuckets';
15 changes: 3 additions & 12 deletions src/plugins/vis_types/vislib/public/vislib/lib/dispatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import d3 from 'd3';
import { get, pull, rest, size, reduce } from 'lodash';
import $ from 'jquery';
import { DIMMING_OPACITY_SETTING } from '../../../common';

/**
* Handles event responses
Expand Down Expand Up @@ -280,7 +279,7 @@ export class Dispatch {
const addEvent = this.addEvent;
const $el = this.handler.el;
if (!this.handler.highlight) {
this.handler.highlight = self.getHighlighter(self.uiSettings);
this.handler.highlight = self.getHighlighter();
}

function hover(d, i) {
Expand Down Expand Up @@ -375,20 +374,18 @@ export class Dispatch {
/**
* return function to Highlight the element that is under the cursor
* by reducing the opacity of all the elements on the graph.
* @param uiSettings
* @method getHighlighter
*/
getHighlighter(uiSettings) {
getHighlighter() {
return function highlight(element) {
const label = this.getAttribute('data-label');
if (!label) return;
const dimming = uiSettings.get(DIMMING_OPACITY_SETTING);
$(element)
.parent()
.find('[data-label]')
.css('opacity', 1) //Opacity 1 is needed to avoid the css application
.not((els, el) => String($(el).data('label')) === label)
.css('opacity', justifyOpacity(dimming));
.css('opacity', 0.5);
};
}

Expand Down Expand Up @@ -470,9 +467,3 @@ export class Dispatch {
function validBrushClick(event) {
return event.button === 0;
}

function justifyOpacity(opacity) {
const decimalNumber = parseFloat(opacity, 10);
const fallbackOpacity = 0.5;
return 0 <= decimalNumber && decimalNumber <= 1 ? decimalNumber : fallbackOpacity;
}
3 changes: 1 addition & 2 deletions src/plugins/vis_types/vislib/public/vislib/vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { EventEmitter } from 'events';
import { VislibError } from './errors';
import { VisConfig } from './lib/vis_config';
import { Handler } from './lib/handler';
import { DIMMING_OPACITY_SETTING, HEATMAP_MAX_BUCKETS_SETTING } from '../../common';
import { HEATMAP_MAX_BUCKETS_SETTING } from '../../common';

/**
* Creates the visualizations.
Expand All @@ -28,7 +28,6 @@ export class Vis extends EventEmitter {
super();
this.element = element.get ? element.get(0) : element;
this.visConfigArgs = _.cloneDeep(visConfigArgs);
this.visConfigArgs.dimmingOpacity = core.uiSettings.get(DIMMING_OPACITY_SETTING);
this.visConfigArgs.heatmapMaxBuckets = core.uiSettings.get(HEATMAP_MAX_BUCKETS_SETTING);
this.charts = charts;
this.uiSettings = core.uiSettings;
Expand Down
19 changes: 1 addition & 18 deletions src/plugins/vis_types/vislib/server/ui_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,9 @@ import { i18n } from '@kbn/i18n';
import { schema } from '@kbn/config-schema';

import { UiSettingsParams } from 'kibana/server';
import { DIMMING_OPACITY_SETTING, HEATMAP_MAX_BUCKETS_SETTING } from '../common';
import { HEATMAP_MAX_BUCKETS_SETTING } from '../common';

export const getUiSettings: () => Record<string, UiSettingsParams> = () => ({
// TODO: move this to vis_type_xy when vislib is removed
// https://github.com/elastic/kibana/issues/56143
[DIMMING_OPACITY_SETTING]: {
name: i18n.translate('visTypeVislib.advancedSettings.visualization.dimmingOpacityTitle', {
defaultMessage: 'Dimming opacity',
}),
value: 0.5,
type: 'number',
description: i18n.translate('visTypeVislib.advancedSettings.visualization.dimmingOpacityText', {
defaultMessage:
'The opacity of the chart items that are dimmed when highlighting another element of the chart. ' +
'The lower this number, the more the highlighted element will stand out. ' +
'This must be a number between 0 and 1.',
}),
category: ['visualization'],
schema: schema.number(),
},
[HEATMAP_MAX_BUCKETS_SETTING]: {
name: i18n.translate('visTypeVislib.advancedSettings.visualization.heatmap.maxBucketsTitle', {
defaultMessage: 'Heatmap maximum buckets',
Expand Down
8 changes: 1 addition & 7 deletions src/plugins/vis_types/xy/public/components/xy_settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {

import { renderEndzoneTooltip } from '../../../../charts/public';

import { getThemeService, getUISettings } from '../services';
import { getThemeService } from '../services';
import { VisConfig } from '../types';

declare global {
Expand Down Expand Up @@ -101,16 +101,10 @@ export const XYSettings: FC<XYSettingsProps> = ({
const themeService = getThemeService();
const theme = themeService.useChartsTheme();
const baseTheme = themeService.useChartsBaseTheme();
const dimmingOpacity = getUISettings().get<number | undefined>('visualization:dimmingOpacity');
const valueLabelsStyling = getValueLabelsStyling();

const themeOverrides: PartialTheme = {
markSizeRatio,
sharedStyle: {
unhighlighted: {
opacity: dimmingOpacity,
},
},
barSeriesStyle: {
...valueLabelsStyling,
},
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -5653,8 +5653,6 @@
"visTypeVega.vegaParser.widthAndHeightParamsAreRequired": "{autoSizeParam}が{noneParam}に設定されているときには、カットまたは繰り返された{vegaLiteParam}仕様を使用している間に何も表示されません。修正するには、{autoSizeParam}を削除するか、{vegaParam}を使用してください。",
"visTypeVega.visualization.renderErrorTitle": "Vega エラー",
"visTypeVega.visualization.unableToRenderWithoutDataWarningMessage": "データなしにはレンダリングできません",
"visTypeVislib.advancedSettings.visualization.dimmingOpacityText": "チャートの別のエレメントが選択された時に暗くなるチャート項目の透明度です。この数字が小さければ小さいほど、ハイライトされたエレメントが目立ちます。0と1の間の数字で設定します。",
"visTypeVislib.advancedSettings.visualization.dimmingOpacityTitle": "減光透明度",
"visTypeVislib.advancedSettings.visualization.heatmap.maxBucketsText": "1つのデータソースが返せるバケットの最大数です。値が大きいとブラウザのレンダリング速度が下がる可能性があります。",
"visTypeVislib.advancedSettings.visualization.heatmap.maxBucketsTitle": "ヒートマップの最大バケット数",
"visTypeVislib.aggResponse.allDocsTitle": "すべてのドキュメント",
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -5699,8 +5699,6 @@
"visTypeVega.vegaParser.widthAndHeightParamsAreRequired": "{autoSizeParam} 设置为 {noneParam} 时,如果使用分面或重复 {vegaLiteParam} 规格,将不会呈现任何内容。要解决问题,请移除 {autoSizeParam} 或使用 {vegaParam}。",
"visTypeVega.visualization.renderErrorTitle": "Vega 错误",
"visTypeVega.visualization.unableToRenderWithoutDataWarningMessage": "没有数据时无法渲染",
"visTypeVislib.advancedSettings.visualization.dimmingOpacityText": "突出显示图表的其他元素时变暗图表项的透明度。此数字越低,突出显示的元素越突出。必须是介于 0 和 1 之间的数字。",
"visTypeVislib.advancedSettings.visualization.dimmingOpacityTitle": "变暗透明度",
"visTypeVislib.advancedSettings.visualization.heatmap.maxBucketsText": "单个数据源可以返回的最大存储桶数目。较高的数目可能对浏览器呈现性能有负面影响",
"visTypeVislib.advancedSettings.visualization.heatmap.maxBucketsTitle": "热图最大存储桶数",
"visTypeVislib.aggResponse.allDocsTitle": "所有文档",
Expand Down

0 comments on commit 8a4355b

Please sign in to comment.