From 9abaa97aeadeb45057775c8da0bab1507891ef07 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Thu, 11 Jul 2024 08:53:41 +0200 Subject: [PATCH] Cleanup --- .../unified_histogram/public/chart/histogram.tsx | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/plugins/unified_histogram/public/chart/histogram.tsx b/src/plugins/unified_histogram/public/chart/histogram.tsx index 19c53fa1d2c52..70e1f039bc3ba 100644 --- a/src/plugins/unified_histogram/public/chart/histogram.tsx +++ b/src/plugins/unified_histogram/public/chart/histogram.tsx @@ -8,7 +8,7 @@ import { useEuiTheme } from '@elastic/eui'; import { css } from '@emotion/react'; -import React, { useState, useRef, useEffect } from 'react'; +import React, { useState } from 'react'; import type { DataView } from '@kbn/data-views-plugin/public'; import type { DefaultInspectorAdapters, Datatable } from '@kbn/expressions-plugin/common'; import type { IKibanaSearchResponse } from '@kbn/search-types'; @@ -106,7 +106,6 @@ export function Histogram({ abortController, }: HistogramProps) { const [bucketInterval, setBucketInterval] = useState(); - const [chartSize, setChartSize] = useState('100%'); const { timeRangeText, timeRangeDisplay } = useTimeRange({ uiSettings, bucketInterval, @@ -115,17 +114,8 @@ export function Histogram({ isPlainRecord, timeField: dataView.timeFieldName, }); - const chartRef = useRef(null); const { attributes } = visContext; - useEffect(() => { - if (attributes.visualizationType === 'lnsMetric') { - setChartSize('90%'); - } else { - setChartSize('100%'); - } - }, [attributes]); - const onLoad = useStableCallback( ( isLoading: boolean, @@ -195,7 +185,7 @@ export function Histogram({ } & .lnsExpressionRenderer { - width: ${chartSize}; + width: ${attributes.visualizationType === 'lnsMetric' ? '90$' : '100%'}; margin: auto; box-shadow: ${attributes.visualizationType === 'lnsMetric' ? boxShadow : 'none'}; } @@ -220,7 +210,6 @@ export function Histogram({ data-request-data={requestData} data-suggestion-type={visContext.suggestionType} css={chartCss} - ref={chartRef} >