Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula committed Jul 11, 2024
1 parent c83f02e commit 9abaa97
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/plugins/unified_histogram/public/chart/histogram.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -106,7 +106,6 @@ export function Histogram({
abortController,
}: HistogramProps) {
const [bucketInterval, setBucketInterval] = useState<UnifiedHistogramBucketInterval>();
const [chartSize, setChartSize] = useState('100%');
const { timeRangeText, timeRangeDisplay } = useTimeRange({
uiSettings,
bucketInterval,
Expand All @@ -115,17 +114,8 @@ export function Histogram({
isPlainRecord,
timeField: dataView.timeFieldName,
});
const chartRef = useRef<HTMLDivElement | null>(null);
const { attributes } = visContext;

useEffect(() => {
if (attributes.visualizationType === 'lnsMetric') {
setChartSize('90%');
} else {
setChartSize('100%');
}
}, [attributes]);

const onLoad = useStableCallback(
(
isLoading: boolean,
Expand Down Expand Up @@ -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'};
}
Expand All @@ -220,7 +210,6 @@ export function Histogram({
data-request-data={requestData}
data-suggestion-type={visContext.suggestionType}
css={chartCss}
ref={chartRef}
>
<lens.EmbeddableComponent
{...lensProps}
Expand Down

0 comments on commit 9abaa97

Please sign in to comment.