* EUIficate pointe-series and grid * Apply TS * Show grid on a panel * Remove extra space * Add TS * Use BasicOptions * Adjust func test * Add dataTestSubj prop to SelectOption * Use id instead of data-sest-subj * Disable show x-axis lines when there is histogram agg * Add tooltip for disabled 'Show x-axis lines' config * Remove extra space
This commit is contained in:
parent
4d042b8d1c
commit
f5adc2c1eb
|
@ -20,7 +20,8 @@
|
|||
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';
|
||||
import { getLegendPositions, LegendPositions } from './utils/legend_positions';
|
||||
|
||||
export default function PointSeriesVisType(Private) {
|
||||
const VisFactory = Private(VisFactoryProvider);
|
||||
|
@ -93,13 +94,15 @@ export default function PointSeriesVisType(Private) {
|
|||
}],
|
||||
addTooltip: true,
|
||||
addLegend: true,
|
||||
legendPosition: 'right',
|
||||
legendPosition: LegendPositions.RIGHT,
|
||||
times: [],
|
||||
addTimeMarker: false,
|
||||
labels: {},
|
||||
},
|
||||
},
|
||||
editorConfig: {
|
||||
collections: {
|
||||
legendPositions: getLegendPositions(),
|
||||
positions: ['top', 'left', 'right', 'bottom'],
|
||||
chartTypes: [{
|
||||
value: 'line',
|
||||
|
@ -132,7 +135,7 @@ export default function PointSeriesVisType(Private) {
|
|||
editor: '<div><vislib-series></vislib-series><vislib-value-axes>' +
|
||||
'</vislib-value-axes><vislib-category-axis></vislib-category-axis></div>'
|
||||
},
|
||||
{ name: 'options', title: 'Panel Settings', editor: pointSeriesTemplate },
|
||||
{ name: 'options', title: 'Panel Settings', editor: PointSeriesOptions },
|
||||
],
|
||||
schemas: new Schemas([
|
||||
{
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
<div class="visEditorSidebar__collapsible--margin">
|
||||
<div class="visEditorSidebar__collapsibleTitle">
|
||||
<div
|
||||
class="visEditorSidebar__collapsibleTitleLabel"
|
||||
ng-click="isGridOpen = !isGridOpen"
|
||||
kbn-accessible-click
|
||||
aria-expanded="{{!!isGridOpen}}"
|
||||
aria-controls="visGridOptions"
|
||||
aria-label="Toggle grid options"
|
||||
>
|
||||
<icon color="'primary'"aria-hidden="true"ng-if="isGridOpen"type="'arrowDown'"size="'s'"></icon>
|
||||
<icon color="'primary'"aria-hidden="true"ng-if="!isGridOpen"type="'arrowRight'"size="'s'"></icon>
|
||||
|
||||
<span
|
||||
class="visEditorSidebar__collapsibleTitleText"
|
||||
i18n-id="kbnVislibVisTypes.controls.pointSeries.gridAxis.gridText"
|
||||
i18n-default-message="Grid"
|
||||
></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="visGridOptions" ng-show="isGridOpen">
|
||||
<!-- General -->
|
||||
<div class="visEditorSidebar__formRow">
|
||||
<label
|
||||
class="visEditorSidebar__formLabel"
|
||||
for="showCategoryLines"
|
||||
i18n-id="kbnVislibVisTypes.controls.pointSeries.gridAxis.xAxisLinesLabel"
|
||||
i18n-default-message="X-Axis Lines"
|
||||
></label>
|
||||
<div class="visEditorSidebar__formControl">
|
||||
<input class="kuiCheckBox" id="showCategoryLines" type="checkbox" ng-model="editorState.params.grid.categoryLines">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="visEditorSidebar__formRow">
|
||||
<label
|
||||
class="visEditorSidebar__formLabel"
|
||||
for="gridAxis"
|
||||
i18n-id="kbnVislibVisTypes.controls.pointSeries.gridAxis.yAxisLinesLabel"
|
||||
i18n-default-message="Y-Axis Lines"
|
||||
></label>
|
||||
<div class="visEditorSidebar__formControl">
|
||||
<select
|
||||
id="gridAxis"
|
||||
class="kuiSelect visEditorSidebar__select"
|
||||
ng-model="editorState.params.grid.valueAxis"
|
||||
ng-options="axis.id as axis.name for axis in editorState.params.valueAxes track by axis.id"
|
||||
>
|
||||
<option
|
||||
value=""
|
||||
i18n-id="kbnVislibVisTypes.controls.pointSeries.gridAxis.dontShowLabel"
|
||||
i18n-default-message="Don't show"
|
||||
></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* 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 { uiModules } from 'ui/modules';
|
||||
import vislibGridTemplate from './grid.html';
|
||||
const module = uiModules.get('kibana');
|
||||
|
||||
module.directive('vislibGrid', function () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
template: vislibGridTemplate,
|
||||
replace: true,
|
||||
link: function ($scope) {
|
||||
|
||||
$scope.isGridOpen = true;
|
||||
}
|
||||
};
|
||||
});
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* 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, useEffect } from 'react';
|
||||
import { EuiPanel, EuiTitle } 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';
|
||||
import { SelectOption } from '../select';
|
||||
import { BasicVislibParams, ValueAxis } from '../../types';
|
||||
|
||||
function GridOptions({
|
||||
stateParams,
|
||||
setValue,
|
||||
hasHistogramAgg,
|
||||
}: VisOptionsProps<BasicVislibParams>) {
|
||||
const setGrid = <T extends keyof BasicVislibParams['grid']>(
|
||||
paramName: T,
|
||||
value: BasicVislibParams['grid'][T]
|
||||
) => setValue('grid', { ...stateParams.grid, [paramName]: value });
|
||||
|
||||
const options = useMemo(
|
||||
() => [
|
||||
...stateParams.valueAxes.map(({ id, name }: ValueAxis) => ({
|
||||
text: name,
|
||||
value: id,
|
||||
})),
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.controls.pointSeries.gridAxis.dontShowLabel', {
|
||||
defaultMessage: "Don't show",
|
||||
}),
|
||||
value: '',
|
||||
},
|
||||
],
|
||||
[stateParams.valueAxes.map(({ id }: ValueAxis) => id)]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (hasHistogramAgg) {
|
||||
setGrid('categoryLines', false);
|
||||
}
|
||||
}, [hasHistogramAgg]);
|
||||
|
||||
return (
|
||||
<EuiPanel paddingSize="s">
|
||||
<EuiTitle size="xs">
|
||||
<h2>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.controls.pointSeries.gridAxis.gridText"
|
||||
defaultMessage="Grid"
|
||||
/>
|
||||
</h2>
|
||||
</EuiTitle>
|
||||
|
||||
<SwitchOption
|
||||
disabled={hasHistogramAgg}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.gridAxis.xAxisLinesLabel', {
|
||||
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"
|
||||
/>
|
||||
|
||||
<SelectOption
|
||||
id="gridAxis"
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.gridAxis.yAxisLinesLabel', {
|
||||
defaultMessage: 'Y-axis lines',
|
||||
})}
|
||||
options={options}
|
||||
paramName="valueAxis"
|
||||
value={stateParams.grid.valueAxis || ''}
|
||||
setValue={setGrid}
|
||||
/>
|
||||
</EuiPanel>
|
||||
);
|
||||
}
|
||||
|
||||
export { GridOptions };
|
|
@ -20,4 +20,3 @@
|
|||
import './value_axes.js';
|
||||
import './category_axis.js';
|
||||
import './series.js';
|
||||
import './grid.js';
|
||||
|
|
|
@ -21,14 +21,17 @@ import React from 'react';
|
|||
import { EuiFormRow, EuiSelect } from '@elastic/eui';
|
||||
|
||||
interface SelectOptionProps<ParamName extends string, ValidParamValues extends string> {
|
||||
id?: string;
|
||||
label: string;
|
||||
options: Array<{ value: ValidParamValues; text: string }>;
|
||||
paramName: ParamName;
|
||||
value?: ValidParamValues;
|
||||
dataTestSubj?: string;
|
||||
setValue: (paramName: ParamName, value: ValidParamValues) => void;
|
||||
}
|
||||
|
||||
function SelectOption<ParamName extends string, ValidParamValues extends string>({
|
||||
id,
|
||||
label,
|
||||
options,
|
||||
paramName,
|
||||
|
@ -36,7 +39,7 @@ function SelectOption<ParamName extends string, ValidParamValues extends string>
|
|||
setValue,
|
||||
}: SelectOptionProps<ParamName, ValidParamValues>) {
|
||||
return (
|
||||
<EuiFormRow label={label} fullWidth={true} compressed>
|
||||
<EuiFormRow id={id} label={label} fullWidth={true} compressed>
|
||||
<EuiSelect
|
||||
options={options}
|
||||
value={value}
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
<div>
|
||||
<!-- Global settings -->
|
||||
<div class="visEditorSidebar__section">
|
||||
<div class="visEditorSidebar__sectionTitle">
|
||||
<div
|
||||
i18n-id="kbnVislibVisTypes.editors.pointSeries.settingsTitle"
|
||||
i18n-default-message="Settings"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div class="visEditorSidebar__formRow">
|
||||
<label
|
||||
class="visEditorSidebar__formLabel"
|
||||
for="legendPosition"
|
||||
i18n-id="kbnVislibVisTypes.editors.pointSeries.legendPositionLabel"
|
||||
i18n-default-message="Legend Position"
|
||||
></label>
|
||||
<div class="visEditorSidebar__formControl">
|
||||
<select
|
||||
id="legendPosition"
|
||||
class="kuiSelect visEditorSidebar__select"
|
||||
ng-model="editorState.params.legendPosition"
|
||||
ng-options="position for position in ['top', 'left', 'right', 'bottom']"
|
||||
></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="visEditorSidebar__formRow">
|
||||
<label
|
||||
class="visEditorSidebar__formLabel"
|
||||
for="showCursor"
|
||||
i18n-id="kbnVislibVisTypes.editors.pointSeries.showTooltipLabel"
|
||||
i18n-default-message="Show Tooltip"
|
||||
></label>
|
||||
<div class="visEditorSidebar__formControl">
|
||||
<input class="kuiCheckBox" id="showCursor" type="checkbox" ng-model="editorState.params.addTooltip">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="visEditorSidebar__formRow" ng-show="vis.hasSchemaAgg('segment', 'date_histogram')">
|
||||
<label
|
||||
class="visEditorSidebar__formLabel"
|
||||
for="currentTimeMarker"
|
||||
i18n-id="kbnVislibVisTypes.editors.pointSeries.currentTimeMarkerLabel"
|
||||
i18n-default-message="Current Time Marker"
|
||||
></label>
|
||||
<div class="visEditorSidebar__formControl">
|
||||
<input class="kuiCheckBox" id="currentTimeMarker" type="checkbox"
|
||||
ng-model="editorState.params.addTimeMarker"
|
||||
ng-checked="editorState.params.addTimeMarker"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="visEditorSidebar__formRow" ng-show="!vis.hasSchemaAgg('segment', 'date_histogram')">
|
||||
<label
|
||||
class="visEditorSidebar__formLabel"
|
||||
for="orderBuckets"
|
||||
i18n-id="kbnVislibVisTypes.editors.pointSeries.orderBucketsBySumLabel"
|
||||
i18n-default-message="Order Buckets by Sum"
|
||||
></label>
|
||||
<div class="visEditorSidebar__formControl">
|
||||
<input class="kuiCheckBox" id="orderBuckets" type="checkbox" ng-model="editorState.params.orderBucketsBySum">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="visEditorSidebar__formRow" ng-show="vis.type.type === 'histogram'">
|
||||
<label
|
||||
class="visEditorSidebar__formLabel"
|
||||
for="showLabels"
|
||||
i18n-id="kbnVislibVisTypes.editors.pointSeries.showLabels"
|
||||
i18n-default-message="Show values on chart"
|
||||
></label>
|
||||
<div class="visEditorSidebar__formControl">
|
||||
<input class="kuiCheckBox" id="showLabels" type="checkbox" ng-model="editorState.params.labels.show">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<vislib-grid></vislib-grid>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* 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 { GridOptions } from '../controls/point_series/grid_options';
|
||||
import { BasicOptions } from '../controls/basic_options';
|
||||
import { BasicVislibParams } from '../types';
|
||||
|
||||
function PointSeriesOptions(props: VisOptionsProps<BasicVislibParams>) {
|
||||
const { stateParams, setValue, vis } = props;
|
||||
|
||||
return (
|
||||
<>
|
||||
<EuiPanel paddingSize="s">
|
||||
<EuiTitle size="xs">
|
||||
<h2>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.editors.pointSeries.settingsTitle"
|
||||
defaultMessage="Settings"
|
||||
/>
|
||||
</h2>
|
||||
</EuiTitle>
|
||||
<EuiSpacer size="s" />
|
||||
|
||||
<BasicOptions {...props} />
|
||||
|
||||
{vis.hasSchemaAgg('segment', 'date_histogram') ? (
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.editors.pointSeries.currentTimeMarkerLabel', {
|
||||
defaultMessage: 'Current time marker',
|
||||
})}
|
||||
paramName="addTimeMarker"
|
||||
value={stateParams.addTimeMarker}
|
||||
setValue={setValue}
|
||||
/>
|
||||
) : (
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.editors.pointSeries.orderBucketsBySumLabel', {
|
||||
defaultMessage: 'Order buckets by sum',
|
||||
})}
|
||||
paramName="orderBucketsBySum"
|
||||
value={stateParams.orderBucketsBySum}
|
||||
setValue={setValue}
|
||||
/>
|
||||
)}
|
||||
|
||||
{vis.type.type === 'histogram' && (
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.editors.pointSeries.showLabels', {
|
||||
defaultMessage: 'Show values on chart',
|
||||
})}
|
||||
paramName="show"
|
||||
value={stateParams.labels.show}
|
||||
setValue={(paramName, value) =>
|
||||
setValue('labels', { ...stateParams.labels, [paramName]: value })
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</EuiPanel>
|
||||
|
||||
<EuiSpacer size="s" />
|
||||
|
||||
<GridOptions {...props} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export { PointSeriesOptions };
|
|
@ -20,7 +20,8 @@
|
|||
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';
|
||||
import { getLegendPositions, LegendPositions } from './utils/legend_positions';
|
||||
|
||||
export default function PointSeriesVisType(Private) {
|
||||
const VisFactory = Private(VisFactoryProvider);
|
||||
|
@ -95,7 +96,7 @@ export default function PointSeriesVisType(Private) {
|
|||
],
|
||||
addTooltip: true,
|
||||
addLegend: true,
|
||||
legendPosition: 'right',
|
||||
legendPosition: LegendPositions.RIGHT,
|
||||
times: [],
|
||||
addTimeMarker: false,
|
||||
labels: {
|
||||
|
@ -105,6 +106,7 @@ export default function PointSeriesVisType(Private) {
|
|||
},
|
||||
editorConfig: {
|
||||
collections: {
|
||||
legendPositions: getLegendPositions(),
|
||||
positions: ['top', 'left', 'right', 'bottom'],
|
||||
chartTypes: [{
|
||||
value: 'line',
|
||||
|
@ -137,7 +139,7 @@ export default function PointSeriesVisType(Private) {
|
|||
editor: '<div><vislib-series></vislib-series><vislib-value-axes>' +
|
||||
'</vislib-value-axes><vislib-category-axis></vislib-category-axis></div>'
|
||||
},
|
||||
{ name: 'options', title: 'Panel Settings', editor: pointSeriesTemplate },
|
||||
{ name: 'options', title: 'Panel Settings', editor: PointSeriesOptions },
|
||||
],
|
||||
schemas: new Schemas([
|
||||
{
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
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';
|
||||
import { getLegendPositions, LegendPositions } from './utils/legend_positions';
|
||||
|
||||
export default function PointSeriesVisType(Private) {
|
||||
const VisFactory = Private(VisFactoryProvider);
|
||||
|
@ -96,13 +97,15 @@ export default function PointSeriesVisType(Private) {
|
|||
}],
|
||||
addTooltip: true,
|
||||
addLegend: true,
|
||||
legendPosition: 'right',
|
||||
legendPosition: LegendPositions.RIGHT,
|
||||
times: [],
|
||||
addTimeMarker: false,
|
||||
labels: {},
|
||||
},
|
||||
},
|
||||
editorConfig: {
|
||||
collections: {
|
||||
legendPositions: getLegendPositions(),
|
||||
positions: ['top', 'left', 'right', 'bottom'],
|
||||
chartTypes: [{
|
||||
value: 'line',
|
||||
|
@ -135,7 +138,7 @@ export default function PointSeriesVisType(Private) {
|
|||
editor: '<div><vislib-series></vislib-series><vislib-value-axes>' +
|
||||
'</vislib-value-axes><vislib-category-axis></vislib-category-axis></div>'
|
||||
},
|
||||
{ name: 'options', title: 'Panel Settings', editor: pointSeriesTemplate },
|
||||
{ name: 'options', title: 'Panel Settings', editor: PointSeriesOptions },
|
||||
],
|
||||
schemas: new Schemas([
|
||||
{
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
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';
|
||||
import { getLegendPositions, LegendPositions } from './utils/legend_positions';
|
||||
|
||||
export default function PointSeriesVisType(Private) {
|
||||
const VisFactory = Private(VisFactoryProvider);
|
||||
|
@ -93,13 +94,15 @@ export default function PointSeriesVisType(Private) {
|
|||
],
|
||||
addTooltip: true,
|
||||
addLegend: true,
|
||||
legendPosition: 'right',
|
||||
legendPosition: LegendPositions.RIGHT,
|
||||
times: [],
|
||||
addTimeMarker: false,
|
||||
labels: {},
|
||||
},
|
||||
},
|
||||
editorConfig: {
|
||||
collections: {
|
||||
legendPositions: getLegendPositions(),
|
||||
positions: ['top', 'left', 'right', 'bottom'],
|
||||
chartTypes: [{
|
||||
value: 'line',
|
||||
|
@ -132,7 +135,7 @@ export default function PointSeriesVisType(Private) {
|
|||
editor: '<div><vislib-series></vislib-series><vislib-value-axes>' +
|
||||
'</vislib-value-axes><vislib-category-axis></vislib-category-axis></div>'
|
||||
},
|
||||
{ name: 'options', title: 'Panel Settings', editor: pointSeriesTemplate },
|
||||
{ name: 'options', title: 'Panel Settings', editor: PointSeriesOptions },
|
||||
],
|
||||
schemas: new Schemas([
|
||||
{
|
||||
|
|
|
@ -17,7 +17,38 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { LegendPositions } from './utils/legend_positions';
|
||||
|
||||
export interface CommonVislibParams {
|
||||
addTooltip: boolean;
|
||||
legendPosition: 'right' | 'left' | 'top' | 'bottom';
|
||||
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: Labels;
|
||||
valueAxes: ValueAxis[];
|
||||
grid: {
|
||||
categoryLines: boolean;
|
||||
valueAxis?: string;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 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 { i18n } from '@kbn/i18n';
|
||||
|
||||
export enum LegendPositions {
|
||||
RIGHT = 'right',
|
||||
LEFT = 'left',
|
||||
TOP = 'top',
|
||||
BOTTOM = 'bottom',
|
||||
}
|
||||
|
||||
const getLegendPositions = () => [
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.legendPositions.topText', {
|
||||
defaultMessage: 'Top',
|
||||
}),
|
||||
value: LegendPositions.TOP,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.legendPositions.leftText', {
|
||||
defaultMessage: 'Left',
|
||||
}),
|
||||
value: LegendPositions.LEFT,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.legendPositions.rightText', {
|
||||
defaultMessage: 'Right',
|
||||
}),
|
||||
value: LegendPositions.RIGHT,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.legendPositions.bottomText', {
|
||||
defaultMessage: 'Bottom',
|
||||
}),
|
||||
value: LegendPositions.BOTTOM,
|
||||
},
|
||||
];
|
||||
|
||||
export { getLegendPositions };
|
|
@ -126,7 +126,9 @@ const defaultEditor = function ($rootScope, $compile) {
|
|||
return $scope.vis.getSerializableState($scope.state);
|
||||
}, function (newState) {
|
||||
$scope.vis.dirty = !angular.equals(newState, $scope.oldState);
|
||||
$scope.metricAggs = $scope.state.aggs.getResponseAggs().filter(agg =>
|
||||
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;
|
||||
|
|
|
@ -175,6 +175,7 @@
|
|||
<vis-editor-vis-options
|
||||
class="visEditorSidebar__options"
|
||||
editor-state="state"
|
||||
has-histogram-agg="hasHistogramAgg"
|
||||
vis="vis"
|
||||
vis-data="visData"
|
||||
ui-state="uiState"
|
||||
|
|
|
@ -34,6 +34,7 @@ uiModules
|
|||
['stateParams', { watchDepth: 'collection' }],
|
||||
['vis', { watchDepth: 'collection' }],
|
||||
['setValue', { watchDepth: 'reference' }],
|
||||
'hasHistogramAgg',
|
||||
]))
|
||||
.directive('visEditorVisOptions', function ($compile) {
|
||||
return {
|
||||
|
@ -46,6 +47,7 @@ uiModules
|
|||
visualizeEditor: '=',
|
||||
editorState: '=',
|
||||
onAggParamsChange: '=',
|
||||
hasHistogramAgg: '=',
|
||||
},
|
||||
link: function ($scope, $el) {
|
||||
$scope.setValue = (paramName, value) =>
|
||||
|
@ -55,6 +57,7 @@ uiModules
|
|||
$scope.editor :
|
||||
`<vis-options-react-wrapper
|
||||
component="editor"
|
||||
has-histogram-agg="hasHistogramAgg"
|
||||
state-params="editorState.params"
|
||||
vis="vis"
|
||||
set-value="setValue">
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
import { Vis } from './../..';
|
||||
|
||||
export interface VisOptionsProps<VisParamType = unknown> {
|
||||
hasHistogramAgg: boolean;
|
||||
stateParams: VisParamType;
|
||||
vis: Vis;
|
||||
setValue<T extends keyof VisParamType>(paramName: T, value: VisParamType[T]): void;
|
||||
|
|
|
@ -74,10 +74,11 @@ export function PointSeriesPageProvider({ getService }) {
|
|||
}
|
||||
|
||||
async toggleGridCategoryLines() {
|
||||
return await find.clickByCssSelector('#showCategoryLines');
|
||||
return await testSubjects.click('showCategoryLines');
|
||||
}
|
||||
|
||||
async setGridValueAxis(axis) {
|
||||
log.debug(`setGridValueAxis(${axis})`);
|
||||
return await find.clickByCssSelector(`select#gridAxis option[value="${axis}"]`);
|
||||
}
|
||||
|
||||
|
|
|
@ -2574,10 +2574,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": "自動",
|
||||
|
|
|
@ -2575,10 +2575,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": "自动",
|
||||
|
|
Loading…
Reference in a new issue