From 71138473b17703146cfd33541c4c88e9220a4692 Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Wed, 7 Aug 2019 15:29:30 +0300 Subject: [PATCH 01/12] EUIficate pointe-series and grid --- .../kbn_vislib_vis_types/public/area.js | 5 +- .../public/controls/point_series/grid.html | 59 ---------- .../controls/point_series/grid_options.tsx | 79 ++++++++++++++ .../public/controls/point_series/index.js | 1 - .../public/editors/point_series.html | 82 -------------- .../public/editors/point_series.tsx | 103 ++++++++++++++++++ .../kbn_vislib_vis_types/public/histogram.js | 4 +- .../public/horizontal_bar.js | 5 +- .../kbn_vislib_vis_types/public/line.js | 5 +- .../grid.js => utils/legend_positions.ts} | 41 ++++--- 10 files changed, 221 insertions(+), 163 deletions(-) delete mode 100644 src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid.html create mode 100644 src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx delete mode 100644 src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.html create mode 100644 src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx rename src/legacy/core_plugins/kbn_vislib_vis_types/public/{controls/point_series/grid.js => utils/legend_positions.ts} (55%) diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/area.js b/src/legacy/core_plugins/kbn_vislib_vis_types/public/area.js index a33d333867e62..1d88653bbd906 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/area.js +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/area.js @@ -20,7 +20,7 @@ import { VisFactoryProvider } from 'ui/vis/vis_factory'; import { i18n } from '@kbn/i18n'; import { Schemas } from 'ui/vis/editors/default/schemas'; -import pointSeriesTemplate from './editors/point_series.html'; +import { PointSeriesOptions } from './editors/point_series'; export default function PointSeriesVisType(Private) { const VisFactory = Private(VisFactoryProvider); @@ -96,6 +96,7 @@ export default function PointSeriesVisType(Private) { legendPosition: 'right', times: [], addTimeMarker: false, + labels: {}, }, }, editorConfig: { @@ -132,7 +133,7 @@ export default function PointSeriesVisType(Private) { editor: '
' + '
' }, - { name: 'options', title: 'Panel Settings', editor: pointSeriesTemplate }, + { name: 'options', title: 'Panel Settings', editor: PointSeriesOptions }, ], schemas: new Schemas([ { diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid.html b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid.html deleted file mode 100644 index 73832f7b741bb..0000000000000 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid.html +++ /dev/null @@ -1,59 +0,0 @@ -
-
-
- - - - -
-
- -
- -
- -
- -
-
- -
- -
- -
-
-
-
diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx new file mode 100644 index 0000000000000..840e83ede624c --- /dev/null +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx @@ -0,0 +1,79 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React, { useMemo } from 'react'; +import { EuiFormRow, EuiAccordion } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; + +import { VisOptionsProps, VisOptionsSetValue } from 'ui/vis/editors/default'; +import { SwitchOption } from '../switch'; +import { SelectOption } from '../select'; + +function GridOptions({ stateParams, setValue, vis }: VisOptionsProps) { + const setGrid: VisOptionsSetValue = (paramName, value) => + setValue('grid', { ...stateParams.grid, [paramName]: value }); + + const options = useMemo( + () => [ + ...stateParams.valueAxes.map(({ id, name }: { id: string; name: string }) => ({ + text: name, + value: id, + })), + { + text: i18n.translate('kbnVislibVisTypes.controls.pointSeries.gridAxis.dontShowLabel', { + defaultMessage: "Don't show", + }), + value: '', + }, + ], + [stateParams.valueAxes.map(({ id }: { id: string }) => id)] + ); + return ( + + + + + + + + ); +} + +export { GridOptions }; diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/index.js b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/index.js index 599a99b921486..87289e9aa410d 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/index.js +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/index.js @@ -20,4 +20,3 @@ import './value_axes.js'; import './category_axis.js'; import './series.js'; -import './grid.js'; diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.html b/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.html deleted file mode 100644 index 47079b44e1453..0000000000000 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.html +++ /dev/null @@ -1,82 +0,0 @@ -
- -
-
-
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- - -
- -
\ No newline at end of file diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx new file mode 100644 index 0000000000000..615e257dfacd3 --- /dev/null +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx @@ -0,0 +1,103 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React from 'react'; +import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; + +import { VisOptionsProps } from 'ui/vis/editors/default'; +import { SwitchOption } from '../controls/switch'; +import { SelectOption } from '../controls/select'; +import { GridOptions } from '../controls/point_series/grid_options'; +import { legendPositions } from '../utils/legend_positions'; + +function PointSeriesOptions(props: VisOptionsProps) { + const { stateParams, setValue, vis } = props; + + return ( + + +

+ +

+
+ + + + + + + {vis.hasSchemaAgg('segment', 'date_histogram') ? ( + + ) : ( + + )} + + {vis.type.type === 'histogram' && ( + + setValue('labels', { ...stateParams.labels, [paramName]: value }) + } + /> + )} + + + +
+ ); +} + +export { PointSeriesOptions }; diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/histogram.js b/src/legacy/core_plugins/kbn_vislib_vis_types/public/histogram.js index 07ddbcb941fdc..66b10e3b305bf 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/histogram.js +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/histogram.js @@ -20,7 +20,7 @@ import { VisFactoryProvider } from 'ui/vis/vis_factory'; import { i18n } from '@kbn/i18n'; import { Schemas } from 'ui/vis/editors/default/schemas'; -import pointSeriesTemplate from './editors/point_series.html'; +import { PointSeriesOptions } from './editors/point_series'; export default function PointSeriesVisType(Private) { const VisFactory = Private(VisFactoryProvider); @@ -137,7 +137,7 @@ export default function PointSeriesVisType(Private) { editor: '
' + '
' }, - { name: 'options', title: 'Panel Settings', editor: pointSeriesTemplate }, + { name: 'options', title: 'Panel Settings', editor: PointSeriesOptions }, ], schemas: new Schemas([ { diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/horizontal_bar.js b/src/legacy/core_plugins/kbn_vislib_vis_types/public/horizontal_bar.js index 5707b32b2c395..bf8c244e620ca 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/horizontal_bar.js +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/horizontal_bar.js @@ -20,7 +20,7 @@ import { VisFactoryProvider } from 'ui/vis/vis_factory'; import { i18n } from '@kbn/i18n'; import { Schemas } from 'ui/vis/editors/default/schemas'; -import pointSeriesTemplate from './editors/point_series.html'; +import { PointSeriesOptions } from './editors/point_series'; export default function PointSeriesVisType(Private) { const VisFactory = Private(VisFactoryProvider); @@ -99,6 +99,7 @@ export default function PointSeriesVisType(Private) { legendPosition: 'right', times: [], addTimeMarker: false, + labels: {}, }, }, editorConfig: { @@ -135,7 +136,7 @@ export default function PointSeriesVisType(Private) { editor: '
' + '
' }, - { name: 'options', title: 'Panel Settings', editor: pointSeriesTemplate }, + { name: 'options', title: 'Panel Settings', editor: PointSeriesOptions }, ], schemas: new Schemas([ { diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/line.js b/src/legacy/core_plugins/kbn_vislib_vis_types/public/line.js index e7c84fb6fc1ce..c0c013a3c5d3c 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/line.js +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/line.js @@ -20,7 +20,7 @@ import { VisFactoryProvider } from 'ui/vis/vis_factory'; import { i18n } from '@kbn/i18n'; import { Schemas } from 'ui/vis/editors/default/schemas'; -import pointSeriesTemplate from './editors/point_series.html'; +import { PointSeriesOptions } from './editors/point_series'; export default function PointSeriesVisType(Private) { const VisFactory = Private(VisFactoryProvider); @@ -96,6 +96,7 @@ export default function PointSeriesVisType(Private) { legendPosition: 'right', times: [], addTimeMarker: false, + labels: {}, }, }, editorConfig: { @@ -132,7 +133,7 @@ export default function PointSeriesVisType(Private) { editor: '
' + '
' }, - { name: 'options', title: 'Panel Settings', editor: pointSeriesTemplate }, + { name: 'options', title: 'Panel Settings', editor: PointSeriesOptions }, ], schemas: new Schemas([ { diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid.js b/src/legacy/core_plugins/kbn_vislib_vis_types/public/utils/legend_positions.ts similarity index 55% rename from src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid.js rename to src/legacy/core_plugins/kbn_vislib_vis_types/public/utils/legend_positions.ts index c0635d949115d..efb5d1940cefd 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid.js +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/utils/legend_positions.ts @@ -17,18 +17,33 @@ * under the License. */ -import { uiModules } from 'ui/modules'; -import vislibGridTemplate from './grid.html'; -const module = uiModules.get('kibana'); +import { i18n } from '@kbn/i18n'; -module.directive('vislibGrid', function () { - return { - restrict: 'E', - template: vislibGridTemplate, - replace: true, - link: function ($scope) { +const legendPositions = [ + { + text: i18n.translate('kbnVislibVisTypes.legendPositions.topText', { + defaultMessage: 'Top', + }), + value: 'top', + }, + { + text: i18n.translate('kbnVislibVisTypes.legendPositions.leftText', { + defaultMessage: 'Left', + }), + value: 'left', + }, + { + text: i18n.translate('kbnVislibVisTypes.legendPositions.rightText', { + defaultMessage: 'Right', + }), + value: 'right', + }, + { + text: i18n.translate('kbnVislibVisTypes.legendPositions.bottomText', { + defaultMessage: 'Bottom', + }), + value: 'bottom', + }, +]; - $scope.isGridOpen = true; - } - }; -}); +export { legendPositions }; From 950f4d54cdfedb17841104de1ab625d6aa1d28ae Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Thu, 8 Aug 2019 16:05:02 +0300 Subject: [PATCH 02/12] Apply TS --- .../controls/point_series/grid_options.tsx | 15 ++++++----- .../public/editors/point_series.tsx | 3 ++- .../kbn_vislib_vis_types/public/types.ts | 26 ++++++++++++++++++- .../public/utils/legend_positions.ts | 9 ++++--- 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx index 840e83ede624c..56f124061bea9 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx @@ -20,17 +20,20 @@ import React, { useMemo } from 'react'; import { EuiFormRow, EuiAccordion } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { VisOptionsProps, VisOptionsSetValue } from 'ui/vis/editors/default'; +import { VisOptionsProps } from 'ui/vis/editors/default'; import { SwitchOption } from '../switch'; import { SelectOption } from '../select'; +import { BasicVislibParams, ValueAxis } from '../../types'; -function GridOptions({ stateParams, setValue, vis }: VisOptionsProps) { - const setGrid: VisOptionsSetValue = (paramName, value) => - setValue('grid', { ...stateParams.grid, [paramName]: value }); +function GridOptions({ stateParams, setValue }: VisOptionsProps) { + const setGrid = ( + paramName: T, + value: BasicVislibParams['grid'][T] + ) => setValue('grid', { ...stateParams.grid, [paramName]: value }); const options = useMemo( () => [ - ...stateParams.valueAxes.map(({ id, name }: { id: string; name: string }) => ({ + ...stateParams.valueAxes.map(({ id, name }: ValueAxis) => ({ text: name, value: id, })), @@ -41,7 +44,7 @@ function GridOptions({ stateParams, setValue, vis }: VisOptionsProps) { value: '', }, ], - [stateParams.valueAxes.map(({ id }: { id: string }) => id)] + [stateParams.valueAxes.map(({ id }: ValueAxis) => id)] ); return ( diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx index 615e257dfacd3..e271c5da5f045 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx @@ -26,8 +26,9 @@ import { SwitchOption } from '../controls/switch'; import { SelectOption } from '../controls/select'; import { GridOptions } from '../controls/point_series/grid_options'; import { legendPositions } from '../utils/legend_positions'; +import { BasicVislibParams } from '../types'; -function PointSeriesOptions(props: VisOptionsProps) { +function PointSeriesOptions(props: VisOptionsProps) { const { stateParams, setValue, vis } = props; return ( diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/types.ts b/src/legacy/core_plugins/kbn_vislib_vis_types/public/types.ts index 8bf941d8b9458..8b2419347029a 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/types.ts +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/types.ts @@ -17,7 +17,31 @@ * under the License. */ +export enum LegendPositions { + RIGHT = 'right', + LEFT = 'left', + TOP = 'top', + BOTTOM = 'bottom', +} export interface CommonVislibParams { addTooltip: boolean; - legendPosition: 'right' | 'left' | 'top' | 'bottom'; + legendPosition: LegendPositions; +} + +export interface ValueAxis { + id: string; + name: string; +} + +export interface BasicVislibParams extends CommonVislibParams { + addTimeMarker: boolean; + orderBucketsBySum?: boolean; + labels: { + show: boolean; + }; + valueAxes: ValueAxis[]; + grid: { + categoryLines: boolean; + valueAxis?: string; + }; } diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/utils/legend_positions.ts b/src/legacy/core_plugins/kbn_vislib_vis_types/public/utils/legend_positions.ts index efb5d1940cefd..036c3937df829 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/utils/legend_positions.ts +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/utils/legend_positions.ts @@ -18,31 +18,32 @@ */ import { i18n } from '@kbn/i18n'; +import { LegendPositions } from '../types'; const legendPositions = [ { text: i18n.translate('kbnVislibVisTypes.legendPositions.topText', { defaultMessage: 'Top', }), - value: 'top', + value: LegendPositions.TOP, }, { text: i18n.translate('kbnVislibVisTypes.legendPositions.leftText', { defaultMessage: 'Left', }), - value: 'left', + value: LegendPositions.LEFT, }, { text: i18n.translate('kbnVislibVisTypes.legendPositions.rightText', { defaultMessage: 'Right', }), - value: 'right', + value: LegendPositions.RIGHT, }, { text: i18n.translate('kbnVislibVisTypes.legendPositions.bottomText', { defaultMessage: 'Bottom', }), - value: 'bottom', + value: LegendPositions.BOTTOM, }, ]; From d120cb391493f7c1df929ea87a4e5385d7dcbcfb Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Thu, 8 Aug 2019 18:37:07 +0300 Subject: [PATCH 03/12] Show grid on a panel --- .../controls/point_series/grid_options.tsx | 59 ++++----- .../public/editors/point_series.tsx | 113 +++++++++--------- .../page_objects/point_series_page.js | 2 +- 3 files changed, 91 insertions(+), 83 deletions(-) diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx index 56f124061bea9..d030a98269d62 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx @@ -17,8 +17,9 @@ * under the License. */ import React, { useMemo } from 'react'; -import { EuiFormRow, EuiAccordion } from '@elastic/eui'; +import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; import { VisOptionsProps } from 'ui/vis/editors/default'; import { SwitchOption } from '../switch'; @@ -47,35 +48,37 @@ function GridOptions({ stateParams, setValue }: VisOptionsProps id)] ); return ( - - + +

+ +

+
+ + + - + paramName="categoryLines" + value={stateParams.grid.categoryLines} + setValue={setGrid} + dataTestSubj="showCategoryLines" + /> - -
-
+ + ); } diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx index e271c5da5f045..3574bc48def50 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx @@ -32,72 +32,77 @@ function PointSeriesOptions(props: VisOptionsProps) { const { stateParams, setValue, vis } = props; return ( - - -

- -

-
- - - - - + <> + + +

+ +

+
+ - {vis.hasSchemaAgg('segment', 'date_histogram') ? ( - - ) : ( + - )} - {vis.type.type === 'histogram' && ( - - setValue('labels', { ...stateParams.labels, [paramName]: value }) - } - /> - )} + {vis.hasSchemaAgg('segment', 'date_histogram') ? ( + + ) : ( + + )} + + {vis.type.type === 'histogram' && ( + + setValue('labels', { ...stateParams.labels, [paramName]: value }) + } + /> + )} + + +
+ -
+ ); } diff --git a/test/functional/page_objects/point_series_page.js b/test/functional/page_objects/point_series_page.js index 7de7ebdd1e011..0d00bf30957c7 100644 --- a/test/functional/page_objects/point_series_page.js +++ b/test/functional/page_objects/point_series_page.js @@ -74,7 +74,7 @@ export function PointSeriesPageProvider({ getService }) { } async toggleGridCategoryLines() { - return await find.clickByCssSelector('#showCategoryLines'); + return await testSubjects.click('showCategoryLines'); } async setGridValueAxis(axis) { From 5c02bda9fb96368bd1fb5d5cf8edbad8129a691d Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Thu, 8 Aug 2019 18:48:57 +0300 Subject: [PATCH 04/12] Remove extra space --- .../public/controls/point_series/grid_options.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx index d030a98269d62..176048fa4bd28 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx @@ -57,7 +57,6 @@ function GridOptions({ stateParams, setValue }: VisOptionsProps - Date: Fri, 9 Aug 2019 16:35:09 +0300 Subject: [PATCH 05/12] Add TS --- .../kbn_vislib_vis_types/public/area.js | 2 ++ .../controls/point_series/grid_options.tsx | 2 +- .../public/editors/point_series.tsx | 3 +-- .../kbn_vislib_vis_types/public/histogram.js | 2 ++ .../public/horizontal_bar.js | 2 ++ .../kbn_vislib_vis_types/public/line.js | 2 ++ .../kbn_vislib_vis_types/public/types.ts | 25 ++++++++++++------- .../public/utils/legend_positions.ts | 12 ++++++--- 8 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/area.js b/src/legacy/core_plugins/kbn_vislib_vis_types/public/area.js index 1d88653bbd906..861f6929ea27b 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/area.js +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/area.js @@ -21,6 +21,7 @@ import { VisFactoryProvider } from 'ui/vis/vis_factory'; import { i18n } from '@kbn/i18n'; import { Schemas } from 'ui/vis/editors/default/schemas'; import { PointSeriesOptions } from './editors/point_series'; +import { getLegendPositions } from './utils/legend_positions'; export default function PointSeriesVisType(Private) { const VisFactory = Private(VisFactoryProvider); @@ -101,6 +102,7 @@ export default function PointSeriesVisType(Private) { }, editorConfig: { collections: { + legendPositions: getLegendPositions(), positions: ['top', 'left', 'right', 'bottom'], chartTypes: [{ value: 'line', diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx index 176048fa4bd28..b7a08bfc7ec83 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx @@ -17,7 +17,7 @@ * under the License. */ import React, { useMemo } from 'react'; -import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui'; +import { EuiPanel, EuiTitle } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx index 3574bc48def50..729d3e406d227 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx @@ -25,7 +25,6 @@ import { VisOptionsProps } from 'ui/vis/editors/default'; import { SwitchOption } from '../controls/switch'; import { SelectOption } from '../controls/select'; import { GridOptions } from '../controls/point_series/grid_options'; -import { legendPositions } from '../utils/legend_positions'; import { BasicVislibParams } from '../types'; function PointSeriesOptions(props: VisOptionsProps) { @@ -48,7 +47,7 @@ function PointSeriesOptions(props: VisOptionsProps) { label={i18n.translate('kbnVislibVisTypes.editors.pointSeries.legendPositionLabel', { defaultMessage: 'Legend position', })} - options={legendPositions} + options={vis.type.editorConfig.collections.legendPositions} paramName="legendPosition" value={stateParams.legendPosition} setValue={setValue} diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/histogram.js b/src/legacy/core_plugins/kbn_vislib_vis_types/public/histogram.js index 66b10e3b305bf..6ed41c74b06ad 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/histogram.js +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/histogram.js @@ -21,6 +21,7 @@ import { VisFactoryProvider } from 'ui/vis/vis_factory'; import { i18n } from '@kbn/i18n'; import { Schemas } from 'ui/vis/editors/default/schemas'; import { PointSeriesOptions } from './editors/point_series'; +import { getLegendPositions } from './utils/legend_positions'; export default function PointSeriesVisType(Private) { const VisFactory = Private(VisFactoryProvider); @@ -105,6 +106,7 @@ export default function PointSeriesVisType(Private) { }, editorConfig: { collections: { + legendPositions: getLegendPositions(), positions: ['top', 'left', 'right', 'bottom'], chartTypes: [{ value: 'line', diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/horizontal_bar.js b/src/legacy/core_plugins/kbn_vislib_vis_types/public/horizontal_bar.js index bf8c244e620ca..ca0cc7e753c34 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/horizontal_bar.js +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/horizontal_bar.js @@ -21,6 +21,7 @@ import { VisFactoryProvider } from 'ui/vis/vis_factory'; import { i18n } from '@kbn/i18n'; import { Schemas } from 'ui/vis/editors/default/schemas'; import { PointSeriesOptions } from './editors/point_series'; +import { getLegendPositions } from './utils/legend_positions'; export default function PointSeriesVisType(Private) { const VisFactory = Private(VisFactoryProvider); @@ -104,6 +105,7 @@ export default function PointSeriesVisType(Private) { }, editorConfig: { collections: { + legendPositions: getLegendPositions(), positions: ['top', 'left', 'right', 'bottom'], chartTypes: [{ value: 'line', diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/line.js b/src/legacy/core_plugins/kbn_vislib_vis_types/public/line.js index c0c013a3c5d3c..af58614770cb5 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/line.js +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/line.js @@ -21,6 +21,7 @@ import { VisFactoryProvider } from 'ui/vis/vis_factory'; import { i18n } from '@kbn/i18n'; import { Schemas } from 'ui/vis/editors/default/schemas'; import { PointSeriesOptions } from './editors/point_series'; +import { getLegendPositions } from './utils/legend_positions'; export default function PointSeriesVisType(Private) { const VisFactory = Private(VisFactoryProvider); @@ -101,6 +102,7 @@ export default function PointSeriesVisType(Private) { }, editorConfig: { collections: { + legendPositions: getLegendPositions(), positions: ['top', 'left', 'right', 'bottom'], chartTypes: [{ value: 'line', diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/types.ts b/src/legacy/core_plugins/kbn_vislib_vis_types/public/types.ts index 8b2419347029a..05d049d1c9e1e 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/types.ts +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/types.ts @@ -17,28 +17,35 @@ * under the License. */ -export enum LegendPositions { - RIGHT = 'right', - LEFT = 'left', - TOP = 'top', - BOTTOM = 'bottom', -} +import { LegendPositions } from './utils/legend_positions'; + export interface CommonVislibParams { addTooltip: boolean; legendPosition: LegendPositions; } +interface Labels { + filter: boolean; + rotate?: number; + show: boolean; + truncate: number; +} export interface ValueAxis { id: string; + labels: Labels; name: string; + position: LegendPositions; + scale: { type: string }; + show: boolean; + style: object; + title: { text: string }; + type: string; } export interface BasicVislibParams extends CommonVislibParams { addTimeMarker: boolean; orderBucketsBySum?: boolean; - labels: { - show: boolean; - }; + labels: Labels; valueAxes: ValueAxis[]; grid: { categoryLines: boolean; diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/utils/legend_positions.ts b/src/legacy/core_plugins/kbn_vislib_vis_types/public/utils/legend_positions.ts index 036c3937df829..ffe70eba19b39 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/utils/legend_positions.ts +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/utils/legend_positions.ts @@ -18,9 +18,15 @@ */ import { i18n } from '@kbn/i18n'; -import { LegendPositions } from '../types'; -const legendPositions = [ +export enum LegendPositions { + RIGHT = 'right', + LEFT = 'left', + TOP = 'top', + BOTTOM = 'bottom', +} + +const getLegendPositions = () => [ { text: i18n.translate('kbnVislibVisTypes.legendPositions.topText', { defaultMessage: 'Top', @@ -47,4 +53,4 @@ const legendPositions = [ }, ]; -export { legendPositions }; +export { getLegendPositions }; From 7c0462317697f01b38db91a8d44b7d1cd192a30c Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Fri, 9 Aug 2019 17:49:56 +0300 Subject: [PATCH 06/12] Use BasicOptions --- .../kbn_vislib_vis_types/public/area.js | 4 ++-- .../public/editors/point_series.tsx | 21 ++----------------- .../kbn_vislib_vis_types/public/histogram.js | 4 ++-- .../public/horizontal_bar.js | 4 ++-- .../kbn_vislib_vis_types/public/line.js | 4 ++-- 5 files changed, 10 insertions(+), 27 deletions(-) diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/area.js b/src/legacy/core_plugins/kbn_vislib_vis_types/public/area.js index 861f6929ea27b..435fc7d14528e 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/area.js +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/area.js @@ -21,7 +21,7 @@ import { VisFactoryProvider } from 'ui/vis/vis_factory'; import { i18n } from '@kbn/i18n'; import { Schemas } from 'ui/vis/editors/default/schemas'; import { PointSeriesOptions } from './editors/point_series'; -import { getLegendPositions } from './utils/legend_positions'; +import { getLegendPositions, LegendPositions } from './utils/legend_positions'; export default function PointSeriesVisType(Private) { const VisFactory = Private(VisFactoryProvider); @@ -94,7 +94,7 @@ export default function PointSeriesVisType(Private) { }], addTooltip: true, addLegend: true, - legendPosition: 'right', + legendPosition: LegendPositions.RIGHT, times: [], addTimeMarker: false, labels: {}, diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx index 729d3e406d227..e19efd60a3a44 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx @@ -23,8 +23,8 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { VisOptionsProps } from 'ui/vis/editors/default'; import { SwitchOption } from '../controls/switch'; -import { SelectOption } from '../controls/select'; import { GridOptions } from '../controls/point_series/grid_options'; +import { BasicOptions } from '../controls/basic_options'; import { BasicVislibParams } from '../types'; function PointSeriesOptions(props: VisOptionsProps) { @@ -43,24 +43,7 @@ function PointSeriesOptions(props: VisOptionsProps) { - - - + {vis.hasSchemaAgg('segment', 'date_histogram') ? ( Date: Fri, 9 Aug 2019 17:50:14 +0300 Subject: [PATCH 07/12] Adjust func test --- .../public/controls/point_series/grid_options.tsx | 1 + test/functional/page_objects/point_series_page.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx index b7a08bfc7ec83..4f0e37b5c69ae 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx @@ -76,6 +76,7 @@ function GridOptions({ stateParams, setValue }: VisOptionsProps ); diff --git a/test/functional/page_objects/point_series_page.js b/test/functional/page_objects/point_series_page.js index 0d00bf30957c7..4deb0edc7ed5c 100644 --- a/test/functional/page_objects/point_series_page.js +++ b/test/functional/page_objects/point_series_page.js @@ -21,6 +21,7 @@ export function PointSeriesPageProvider({ getService }) { const testSubjects = getService('testSubjects'); const log = getService('log'); const find = getService('find'); + const comboBox = getService('comboBox'); class PointSeriesVis { async clickOptions() { @@ -78,7 +79,8 @@ export function PointSeriesPageProvider({ getService }) { } async setGridValueAxis(axis) { - return await find.clickByCssSelector(`select#gridAxis option[value="${axis}"]`); + log.debug(`setGridValueAxis(${axis})`); + return await comboBox.set('gridAxis', axis); } async toggleCollapsibleTitle(title) { From 79cac99c34c891fbe6851f8eee1fa4af593660c3 Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Mon, 12 Aug 2019 09:46:13 +0300 Subject: [PATCH 08/12] Add dataTestSubj prop to SelectOption --- .../public/controls/point_series/grid_options.tsx | 2 +- .../kbn_vislib_vis_types/public/controls/select.tsx | 3 +++ x-pack/plugins/translations/translations/ja-JP.json | 2 -- x-pack/plugins/translations/translations/zh-CN.json | 2 -- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx index 4f0e37b5c69ae..8346509860c5b 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx @@ -76,7 +76,7 @@ function GridOptions({ stateParams, setValue }: VisOptionsProps ); diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/select.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/select.tsx index 01c6a576d4d1b..8ae6b4c48e67d 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/select.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/select.tsx @@ -25,6 +25,7 @@ interface SelectOptionProps; paramName: ParamName; value?: ValidParamValues; + dataTestSubj?: string; setValue: (paramName: ParamName, value: ValidParamValues) => void; } @@ -33,6 +34,7 @@ function SelectOption options, paramName, value, + dataTestSubj, setValue, }: SelectOptionProps) { return ( @@ -42,6 +44,7 @@ function SelectOption value={value} onChange={ev => setValue(paramName, ev.target.value as ValidParamValues)} fullWidth={true} + data-test-subj={dataTestSubj} />
); diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 46592b31d0bb2..20be5be986ccc 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -2557,10 +2557,8 @@ "kbnVislibVisTypes.editors.heatmap.showTooltipsLabel": "ツールヒントを表示", "kbnVislibVisTypes.editors.pie.donutLabel": "ドーナッツ", "kbnVislibVisTypes.editors.pointSeries.currentTimeMarkerLabel": "現在時刻マーカー", - "kbnVislibVisTypes.editors.pointSeries.legendPositionLabel": "凡例の配置", "kbnVislibVisTypes.editors.pointSeries.orderBucketsBySumLabel": "バケットを合計で並べ替え", "kbnVislibVisTypes.editors.pointSeries.settingsTitle": "設定", - "kbnVislibVisTypes.editors.pointSeries.showTooltipLabel": "ツールヒントを表示", "kbnVislibVisTypes.functions.pie.help": "パイビジュアライゼーション", "kbnVislibVisTypes.functions.vislib.help": "Vislib ビジュアライゼーション", "kbnVislibVisTypes.gauge.alignmentAutomaticTitle": "自動", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 41facad426c47..487e0fdbf99ec 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -2557,10 +2557,8 @@ "kbnVislibVisTypes.editors.heatmap.showTooltipsLabel": "显示工具提示", "kbnVislibVisTypes.editors.pie.donutLabel": "圆环图", "kbnVislibVisTypes.editors.pointSeries.currentTimeMarkerLabel": "当前时间标记", - "kbnVislibVisTypes.editors.pointSeries.legendPositionLabel": "图例位置", "kbnVislibVisTypes.editors.pointSeries.orderBucketsBySumLabel": "按总计值排序桶", "kbnVislibVisTypes.editors.pointSeries.settingsTitle": "设置", - "kbnVislibVisTypes.editors.pointSeries.showTooltipLabel": "显示工具提示", "kbnVislibVisTypes.functions.pie.help": "饼图可视化", "kbnVislibVisTypes.functions.vislib.help": "Vislib 可视化", "kbnVislibVisTypes.gauge.alignmentAutomaticTitle": "自动", From 44f061dc659664d7a647f55e21c293cdf242bd8a Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Mon, 12 Aug 2019 16:09:38 +0300 Subject: [PATCH 09/12] Use id instead of data-sest-subj --- .../public/controls/point_series/grid_options.tsx | 2 +- .../kbn_vislib_vis_types/public/controls/select.tsx | 6 +++--- test/functional/page_objects/point_series_page.js | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx index 8346509860c5b..e7651e095aa16 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx @@ -69,6 +69,7 @@ function GridOptions({ stateParams, setValue }: VisOptionsProps ); diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/select.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/select.tsx index 8ae6b4c48e67d..0a0aeeb26dcef 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/select.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/select.tsx @@ -21,6 +21,7 @@ import React from 'react'; import { EuiFormRow, EuiSelect } from '@elastic/eui'; interface SelectOptionProps { + id?: string; label: string; options: Array<{ value: ValidParamValues; text: string }>; paramName: ParamName; @@ -30,21 +31,20 @@ interface SelectOptionProps({ + id, label, options, paramName, value, - dataTestSubj, setValue, }: SelectOptionProps) { return ( - + setValue(paramName, ev.target.value as ValidParamValues)} fullWidth={true} - data-test-subj={dataTestSubj} /> ); diff --git a/test/functional/page_objects/point_series_page.js b/test/functional/page_objects/point_series_page.js index 4deb0edc7ed5c..371913f87fde7 100644 --- a/test/functional/page_objects/point_series_page.js +++ b/test/functional/page_objects/point_series_page.js @@ -21,7 +21,6 @@ export function PointSeriesPageProvider({ getService }) { const testSubjects = getService('testSubjects'); const log = getService('log'); const find = getService('find'); - const comboBox = getService('comboBox'); class PointSeriesVis { async clickOptions() { @@ -80,7 +79,7 @@ export function PointSeriesPageProvider({ getService }) { async setGridValueAxis(axis) { log.debug(`setGridValueAxis(${axis})`); - return await comboBox.set('gridAxis', axis); + return await find.clickByCssSelector(`select#gridAxis option[value="${axis}"]`); } async toggleCollapsibleTitle(title) { From 162b5cd4fe4e115f7d7db245d92c063c13d72317 Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Tue, 13 Aug 2019 17:37:04 +0300 Subject: [PATCH 10/12] Disable show x-axis lines when there is histogram agg --- .../controls/point_series/grid_options.tsx | 16 ++++++++++++++-- .../ui/public/vis/editors/default/default.js | 4 +++- .../ui/public/vis/editors/default/sidebar.html | 1 + .../ui/public/vis/editors/default/vis_options.js | 3 +++ .../vis/editors/default/vis_options_props.tsx | 1 + 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx index e7651e095aa16..6f28e67e25ba8 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import React, { useMemo } from 'react'; +import React, { useMemo, useEffect } from 'react'; import { EuiPanel, EuiTitle } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; @@ -26,7 +26,11 @@ import { SwitchOption } from '../switch'; import { SelectOption } from '../select'; import { BasicVislibParams, ValueAxis } from '../../types'; -function GridOptions({ stateParams, setValue }: VisOptionsProps) { +function GridOptions({ + stateParams, + setValue, + hasHistogramAgg, +}: VisOptionsProps) { const setGrid = ( paramName: T, value: BasicVislibParams['grid'][T] @@ -47,6 +51,13 @@ function GridOptions({ stateParams, setValue }: VisOptionsProps id)] ); + + useEffect(() => { + if (hasHistogramAgg) { + setGrid('categoryLines', false); + } + }, [hasHistogramAgg]); + return ( @@ -59,6 +70,7 @@ function GridOptions({ stateParams, setValue }: VisOptionsProps + const responseAggs = $scope.state.aggs.getResponseAggs(); + $scope.hasHistogramAgg = responseAggs.some(agg => agg.type.name === 'histogram'); + $scope.metricAggs = responseAggs.filter(agg => _.get(agg, 'schema.group') === AggGroupNames.Metrics); const lastParentPipelineAgg = _.findLast($scope.metricAggs, ({ type }) => type.subtype === parentPipelineAggHelper.subtype); $scope.lastParentPipelineAggTitle = lastParentPipelineAgg && lastParentPipelineAgg.type.title; diff --git a/src/legacy/ui/public/vis/editors/default/sidebar.html b/src/legacy/ui/public/vis/editors/default/sidebar.html index 14e9bd46c376d..07c2e2b1730ee 100644 --- a/src/legacy/ui/public/vis/editors/default/sidebar.html +++ b/src/legacy/ui/public/vis/editors/default/sidebar.html @@ -175,6 +175,7 @@ @@ -55,6 +57,7 @@ uiModules $scope.editor : ` diff --git a/src/legacy/ui/public/vis/editors/default/vis_options_props.tsx b/src/legacy/ui/public/vis/editors/default/vis_options_props.tsx index e82a0fdc0892d..a2212f924cf47 100644 --- a/src/legacy/ui/public/vis/editors/default/vis_options_props.tsx +++ b/src/legacy/ui/public/vis/editors/default/vis_options_props.tsx @@ -20,6 +20,7 @@ import { Vis } from './../..'; export interface VisOptionsProps { + hasHistogramAgg: boolean; stateParams: VisParamType; vis: Vis; setValue(paramName: T, value: VisParamType[T]): void; From b4ec159b31c4a7e7f8ac66f9f5e4e28ce5614ec3 Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Wed, 14 Aug 2019 10:55:49 +0300 Subject: [PATCH 11/12] Add tooltip for disabled 'Show x-axis lines' config --- .../public/controls/point_series/grid_options.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx index 6f28e67e25ba8..069a2a0dcbeab 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/point_series/grid_options.tsx @@ -75,6 +75,16 @@ function GridOptions({ defaultMessage: 'Show x-axis lines', })} paramName="categoryLines" + tooltip={ + hasHistogramAgg + ? i18n.translate( + 'kbnVislibVisTypes.controls.pointSeries.gridAxis.yAxisLinesDisabledTooltip', + { + defaultMessage: "X-axis lines can't show for histograms.", + } + ) + : undefined + } value={stateParams.grid.categoryLines} setValue={setGrid} dataTestSubj="showCategoryLines" From 74372e43fb3e571d46a64305ebaf1e8226c7ec0f Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Wed, 14 Aug 2019 16:24:53 +0300 Subject: [PATCH 12/12] Remove extra space --- .../kbn_vislib_vis_types/public/editors/point_series.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx index e19efd60a3a44..fcff704878fed 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/editors/point_series.tsx @@ -77,8 +77,6 @@ function PointSeriesOptions(props: VisOptionsProps) { } /> )} - -