) =>
onChange({
...model,
@@ -59,17 +50,9 @@ export const MultiValueRow = ({
});
return (
-
-
-
-
-
-
-
-
+
+
+
onDelete(model)}
disableDelete={disableDelete}
disableAdd={disableAdd}
+ responsive={false}
/>
-
-
+
);
};
diff --git a/src/plugins/vis_type_timeseries/public/application/components/aggs/percentile_rank/percentile_rank.tsx b/src/plugins/vis_type_timeseries/public/application/components/aggs/percentile_rank/percentile_rank.tsx
index d02a16ade2bba..f78df9b1ddef4 100644
--- a/src/plugins/vis_type_timeseries/public/application/components/aggs/percentile_rank/percentile_rank.tsx
+++ b/src/plugins/vis_type_timeseries/public/application/components/aggs/percentile_rank/percentile_rank.tsx
@@ -20,11 +20,11 @@
import React from 'react';
import {
htmlIdGenerator,
- EuiFlexGroup,
EuiFlexItem,
EuiFormLabel,
EuiFormRow,
EuiSpacer,
+ EuiFlexGrid,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { AggSelect } from '../agg_select';
@@ -34,12 +34,16 @@ import { FieldSelect } from '../field_select';
import { createChangeHandler } from '../../lib/create_change_handler';
// @ts-ignore
import { createSelectHandler } from '../../lib/create_select_handler';
+// @ts-ignore
+import { createNumberHandler } from '../../lib/create_number_handler';
+
import { AggRow } from '../agg_row';
import { PercentileRankValues } from './percentile_rank_values';
import { IFieldType, KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public';
import { MetricsItemsSchema, PanelSchema, SeriesItemsSchema } from '../../../../../common/types';
import { DragHandleProps } from '../../../../types';
+import { PercentileHdr } from '../percentile_hdr';
const RESTRICT_FIELDS = [KBN_FIELD_TYPES.NUMBER, KBN_FIELD_TYPES.HISTOGRAM];
@@ -67,6 +71,7 @@ export const PercentileRankAgg = (props: PercentileRankAggProps) => {
const isTablePanel = panel.type === 'table';
const handleChange = createChangeHandler(props.onChange, model);
const handleSelectChange = createSelectHandler(handleChange);
+ const handleNumberChange = createNumberHandler(handleChange);
const handlePercentileRankValuesChange = (values: MetricsItemsSchema['values']) => {
handleChange({
@@ -84,7 +89,7 @@ export const PercentileRankAgg = (props: PercentileRankAggProps) => {
siblings={props.siblings}
dragHandleProps={props.dragHandleProps}
>
-
+
{
/>
-
-
- {model.values && (
-
- )}
+
+
+
+ }
+ >
+
+
+
+
+
+
+
);
};
diff --git a/src/plugins/vis_type_timeseries/public/application/components/aggs/percentile_rank/percentile_rank_values.tsx b/src/plugins/vis_type_timeseries/public/application/components/aggs/percentile_rank/percentile_rank_values.tsx
index b66d79d67f427..92ca4dfb706ac 100644
--- a/src/plugins/vis_type_timeseries/public/application/components/aggs/percentile_rank/percentile_rank_values.tsx
+++ b/src/plugins/vis_type_timeseries/public/application/components/aggs/percentile_rank/percentile_rank_values.tsx
@@ -19,7 +19,7 @@
import React from 'react';
import { last } from 'lodash';
-import { EuiFlexGroup } from '@elastic/eui';
+import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { MultiValueRow } from './multi_value_row';
interface PercentileRankValuesProps {
@@ -52,19 +52,20 @@ export const PercentileRankValues = (props: PercentileRankValuesProps) => {
disableDeleteRow: boolean;
disableAddRow: boolean;
}) => (
-
+
+
+
);
return (
-
+
{showOnlyLastRow &&
renderRow({
rowModel: {
diff --git a/src/plugins/vis_type_timeseries/public/application/components/aggs/percentile_ui.js b/src/plugins/vis_type_timeseries/public/application/components/aggs/percentile_ui.js
index bd421248a3607..fb556a053df3f 100644
--- a/src/plugins/vis_type_timeseries/public/application/components/aggs/percentile_ui.js
+++ b/src/plugins/vis_type_timeseries/public/application/components/aggs/percentile_ui.js
@@ -19,6 +19,7 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
+import { i18n } from '@kbn/i18n';
import _ from 'lodash';
import { collectionActions } from '../lib/collection_actions';
import { AddDeleteButtons } from '../add_delete_buttons';
@@ -27,17 +28,19 @@ import {
htmlIdGenerator,
EuiFlexGroup,
EuiFlexItem,
- EuiFormLabel,
EuiComboBox,
EuiFieldNumber,
+ EuiFormRow,
+ EuiFlexGrid,
+ EuiPanel,
} from '@elastic/eui';
-import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
+import { FormattedMessage } from '@kbn/i18n/react';
export const newPercentile = (opts) => {
return _.assign({ id: uuid.v1(), mode: 'line', shade: 0.2 }, opts);
};
-class PercentilesUi extends Component {
+export class Percentiles extends Component {
handleTextChange(item, name) {
return (e) => {
const handleChange = collectionActions.handleChange.bind(null, this.props);
@@ -50,22 +53,31 @@ class PercentilesUi extends Component {
renderRow = (row, i, items) => {
const defaults = { value: '', percentile: '', shade: '' };
const model = { ...defaults, ...row };
- const { intl, panel } = this.props;
+ const { panel } = this.props;
+ const flexItemStyle = { minWidth: 100 };
const percentileFieldNumber = (
-
-
+
+
+ }
+ >
+
+
);
@@ -77,99 +89,103 @@ class PercentilesUi extends Component {
const handleDelete = collectionActions.handleDelete.bind(null, this.props, model);
const modeOptions = [
{
- label: intl.formatMessage({
- id: 'visTypeTimeseries.percentile.modeOptions.lineLabel',
+ label: i18n.translate('visTypeTimeseries.percentile.modeOptions.lineLabel', {
defaultMessage: 'Line',
}),
value: 'line',
},
{
- label: intl.formatMessage({
- id: 'visTypeTimeseries.percentile.modeOptions.bandLabel',
+ label: i18n.translate('visTypeTimeseries.percentile.modeOptions.bandLabel', {
defaultMessage: 'Band',
}),
value: 'band',
},
];
- const optionsStyle = {};
+ const optionsStyle = {
+ ...flexItemStyle,
+ };
if (model.mode === 'line') {
optionsStyle.display = 'none';
}
- const labelStyle = { marginBottom: 0 };
+
const htmlId = htmlIdGenerator(model.id);
const selectedModeOption = modeOptions.find((option) => {
return model.mode === option.value;
});
return (
-
- {percentileFieldNumber}
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ {percentileFieldNumber}
+
+
+ }
+ >
+
+
+
+
+
+ }
+ >
+
+
+
+
+
+ }
+ >
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
);
};
@@ -192,15 +208,13 @@ class PercentilesUi extends Component {
}
}
-PercentilesUi.defaultProps = {
+Percentiles.defaultProps = {
name: 'percentile',
};
-PercentilesUi.propTypes = {
+Percentiles.propTypes = {
name: PropTypes.string,
model: PropTypes.object,
panel: PropTypes.object,
onChange: PropTypes.func,
};
-
-export const Percentiles = injectI18n(PercentilesUi);
diff --git a/src/plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.js
index 1eace13c2e336..232efc7514a5a 100644
--- a/src/plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.js
@@ -43,7 +43,6 @@ export async function getSeriesData(req, panel) {
(acc, items) => acc.concat(items),
[]
);
-
const data = await searchStrategy.search(req, searches);
const handleResponseBodyFn = handleResponseBody(panel);
diff --git a/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/bucket_transform.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/bucket_transform.js
index f033a43806312..dc2936072165e 100644
--- a/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/bucket_transform.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/bucket_transform.js
@@ -64,6 +64,16 @@ function extendStatsBucket(bucket, metrics) {
return body;
}
+function getPercentileHdrParam(bucket) {
+ return bucket.numberOfSignificantValueDigits
+ ? {
+ hdr: {
+ number_of_significant_value_digits: bucket.numberOfSignificantValueDigits,
+ },
+ }
+ : undefined;
+}
+
export const bucketTransform = {
count: () => {
return {
@@ -139,13 +149,14 @@ export const bucketTransform = {
bucket.percentiles.filter((p) => p.percentile).map((p) => p.percentile)
);
}
- const agg = {
+
+ return {
percentiles: {
field: bucket.field,
percents,
+ ...getPercentileHdrParam(bucket),
},
};
- return agg;
},
percentile_rank: (bucket) => {
@@ -155,6 +166,7 @@ export const bucketTransform = {
percentile_ranks: {
field: bucket.field,
values: (bucket.values || []).map((value) => (isEmpty(value) ? 0 : value)),
+ ...getPercentileHdrParam(bucket),
},
};
},
diff --git a/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/percentile_rank.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/percentile_rank.js
index a11324f73e611..c163605af7ac5 100644
--- a/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/percentile_rank.js
+++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/percentile_rank.js
@@ -32,7 +32,7 @@ export function percentileRank(resp, panel, series, meta) {
}
getSplits(resp, panel, series, meta).forEach((split) => {
- (metric.values || []).forEach((percentileRank) => {
+ (metric.values || []).forEach((percentileRank, index) => {
const data = split.timeseries.buckets.map((bucket) => [
bucket.key,
getAggValue(bucket, {
@@ -43,7 +43,7 @@ export function percentileRank(resp, panel, series, meta) {
results.push({
data,
- id: `${split.id}:${percentileRank}`,
+ id: `${split.id}:${percentileRank}:${index}`,
label: `${split.label} (${percentileRank || 0})`,
color: split.color,
...getDefaultDecoration(series),
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index 9e37d6c25360f..6033f4e3e4543 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -3822,7 +3822,6 @@
"visTypeTimeseries.movingAverage.period": "期間",
"visTypeTimeseries.movingAverage.windowSizeHint": "ウィンドウは、必ず、期間のサイズの 2 倍以上でなければなりません",
"visTypeTimeseries.movingAverage.windowSizeLabel": "ウィンドウサイズ",
- "visTypeTimeseries.multivalueRow.valueLabel": "値:",
"visTypeTimeseries.noButtonLabel": "いいえ",
"visTypeTimeseries.noDataDescription": "選択されたメトリックに表示するデータがありません",
"visTypeTimeseries.percentile.aggregationLabel": "集約",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index 1e3c35af1ef66..3f64dd8c67bf9 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -3823,7 +3823,6 @@
"visTypeTimeseries.movingAverage.period": "期间",
"visTypeTimeseries.movingAverage.windowSizeHint": "窗口必须始终至少是期间大小的两倍",
"visTypeTimeseries.movingAverage.windowSizeLabel": "窗口大小",
- "visTypeTimeseries.multivalueRow.valueLabel": "值:",
"visTypeTimeseries.noButtonLabel": "否",
"visTypeTimeseries.noDataDescription": "所选指标没有可显示的数据",
"visTypeTimeseries.percentile.aggregationLabel": "聚合",