diff --git a/src/plugins/vis_type_timeseries/public/application/components/lib/charts.js b/src/plugins/vis_type_timeseries/public/application/components/lib/charts.js deleted file mode 100644 index 2495026304be8..0000000000000 --- a/src/plugins/vis_type_timeseries/public/application/components/lib/charts.js +++ /dev/null @@ -1,22 +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 { uniq, map, size, flow } from 'lodash'; - -export const areFieldsDifferent = (name) => (series) => flow(uniq, size)(map(series, name)) > 1; diff --git a/src/plugins/vis_type_timeseries/public/application/components/vis_types/timeseries/vis.js b/src/plugins/vis_type_timeseries/public/application/components/vis_types/timeseries/vis.js index 612a7a48bade1..c14148d4a020f 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/vis_types/timeseries/vis.js +++ b/src/plugins/vis_type_timeseries/public/application/components/vis_types/timeseries/vis.js @@ -31,7 +31,6 @@ import { MarkdownSimple } from '../../../../../../../plugins/kibana_react/public import { replaceVars } from '../../lib/replace_vars'; import { getAxisLabelString } from '../../lib/get_axis_label_string'; import { getInterval } from '../../lib/get_interval'; -import { areFieldsDifferent } from '../../lib/charts'; import { createXaxisFormatter } from '../../lib/create_xaxis_formatter'; import { STACKED_OPTIONS } from '../../../visualizations/constants'; import { getCoreStart } from '../../../../services'; @@ -164,7 +163,6 @@ export class TimeseriesVisualization extends Component { const mainAxisGroupId = yAxisIdGenerator('main_group'); const seriesModel = model.series.filter((s) => !s.hidden).map((s) => cloneDeep(s)); - const enableHistogramMode = areFieldsDifferent('chart_type')(seriesModel); const firstSeries = seriesModel.find((s) => s.formatter && !s.separate_axis); const mainAxisScaleType = TimeseriesVisualization.getAxisScaleType(model); @@ -243,7 +241,6 @@ export class TimeseriesVisualization extends Component { series={series} yAxis={yAxis} onBrush={onBrush} - enableHistogramMode={enableHistogramMode} backgroundColor={model.background_color} showGrid={Boolean(model.show_grid)} legend={Boolean(model.show_legend)} diff --git a/src/plugins/vis_type_timeseries/public/application/visualizations/views/timeseries/index.js b/src/plugins/vis_type_timeseries/public/application/visualizations/views/timeseries/index.js index 64ac5cc5f871f..6b5d84dc56981 100644 --- a/src/plugins/vis_type_timeseries/public/application/visualizations/views/timeseries/index.js +++ b/src/plugins/vis_type_timeseries/public/application/visualizations/views/timeseries/index.js @@ -67,7 +67,6 @@ export const TimeSeries = ({ onBrush, xAxisFormatter, annotations, - enableHistogramMode, }) => { const chartRef = useRef(); const updateCursor = (_, cursor) => { @@ -181,6 +180,7 @@ export const TimeSeries = ({ ) => { const stackAccessors = getStackAccessors(stack); const isPercentage = stack === STACKED_OPTIONS.PERCENT; + const isStacked = stack !== STACKED_OPTIONS.NONE; const key = `${id}-${label}`; // Only use color mapping if there is no color from the server const finalColor = color ?? colors.mappedColors.mapping[label]; @@ -201,7 +201,7 @@ export const TimeSeries = ({ xScaleType={xScaleType} yScaleType={yScaleType} timeZone={timeZone} - enableHistogramMode={enableHistogramMode} + enableHistogramMode={isStacked} useDefaultGroupDomain={useDefaultGroupDomain} sortIndex={sortIndex} y1AccessorFormat={y1AccessorFormat} @@ -227,7 +227,7 @@ export const TimeSeries = ({ xScaleType={xScaleType} yScaleType={yScaleType} timeZone={timeZone} - enableHistogramMode={enableHistogramMode} + enableHistogramMode={isStacked} useDefaultGroupDomain={useDefaultGroupDomain} sortIndex={sortIndex} y1AccessorFormat={y1AccessorFormat} @@ -283,5 +283,4 @@ TimeSeries.propTypes = { onBrush: PropTypes.func, xAxisFormatter: PropTypes.func, annotations: PropTypes.array, - enableHistogramMode: PropTypes.bool.isRequired, };