mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
VizTooltips: Remove default width/height values (#81832)
This commit is contained in:
@@ -22,6 +22,7 @@ import { ContextMenuPlugin } from '../timeseries/plugins/ContextMenuPlugin';
|
||||
import { ExemplarsPlugin } from '../timeseries/plugins/ExemplarsPlugin';
|
||||
import { OutsideRangePlugin } from '../timeseries/plugins/OutsideRangePlugin';
|
||||
import { ThresholdControlsPlugin } from '../timeseries/plugins/ThresholdControlsPlugin';
|
||||
import { isTooltipScrollable } from '../timeseries/utils';
|
||||
|
||||
import { prepareCandlestickFields } from './fields';
|
||||
import { Options, defaultCandlestickColors, VizDisplayMode } from './types';
|
||||
@@ -298,6 +299,7 @@ export const CandlestickPanel = ({
|
||||
mode={options.tooltip.mode}
|
||||
isPinned={isPinned}
|
||||
annotate={enableAnnotationCreation ? annotate : undefined}
|
||||
scrollable={isTooltipScrollable(options.tooltip)}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
|
||||
@@ -428,7 +428,6 @@ export const plugin = new PanelPlugin<Options, GraphFieldConfig>(HeatmapPanel)
|
||||
category,
|
||||
settings: {
|
||||
integer: true,
|
||||
placeholder: '300',
|
||||
},
|
||||
});
|
||||
|
||||
@@ -438,7 +437,6 @@ export const plugin = new PanelPlugin<Options, GraphFieldConfig>(HeatmapPanel)
|
||||
category,
|
||||
settings: {
|
||||
integer: true,
|
||||
placeholder: '600',
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import { ExemplarsPlugin, getVisibleLabels } from './plugins/ExemplarsPlugin';
|
||||
import { OutsideRangePlugin } from './plugins/OutsideRangePlugin';
|
||||
import { ThresholdControlsPlugin } from './plugins/ThresholdControlsPlugin';
|
||||
import { getPrepareTimeseriesSuggestion } from './suggestions';
|
||||
import { getTimezones, prepareGraphableFields, regenerateLinksSupplier } from './utils';
|
||||
import { getTimezones, isTooltipScrollable, prepareGraphableFields, regenerateLinksSupplier } from './utils';
|
||||
|
||||
interface TimeSeriesPanelProps extends PanelProps<Options> {}
|
||||
|
||||
@@ -142,6 +142,7 @@ export const TimeSeriesPanel = ({
|
||||
sortOrder={options.tooltip.sort}
|
||||
isPinned={isPinned}
|
||||
annotate={enableAnnotationCreation ? annotate : undefined}
|
||||
scrollable={isTooltipScrollable(options.tooltip)}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
|
||||
@@ -37,6 +37,7 @@ interface TimeSeriesTooltipProps {
|
||||
sortOrder?: SortOrder;
|
||||
|
||||
isPinned: boolean;
|
||||
scrollable?: boolean;
|
||||
|
||||
annotate?: () => void;
|
||||
}
|
||||
@@ -48,6 +49,7 @@ export const TimeSeriesTooltip = ({
|
||||
seriesIdx,
|
||||
mode = TooltipDisplayMode.Single,
|
||||
sortOrder = SortOrder.None,
|
||||
scrollable = false,
|
||||
isPinned,
|
||||
annotate,
|
||||
}: TimeSeriesTooltipProps) => {
|
||||
@@ -156,11 +158,7 @@ export const TimeSeriesTooltip = ({
|
||||
<div>
|
||||
<div className={styles.wrapper}>
|
||||
<VizTooltipHeader headerLabel={getHeaderLabel()} isPinned={isPinned} />
|
||||
<VizTooltipContent
|
||||
contentLabelValue={getContentLabelValue()}
|
||||
isPinned={isPinned}
|
||||
scrollable={mode === TooltipDisplayMode.Multi}
|
||||
/>
|
||||
<VizTooltipContent contentLabelValue={getContentLabelValue()} isPinned={isPinned} scrollable={scrollable} />
|
||||
{isPinned && <VizTooltipFooter dataLinks={links} annotate={annotate} />}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
import { convertFieldType } from '@grafana/data/src/transformations/transformers/convertFieldType';
|
||||
import { applyNullInsertThreshold } from '@grafana/data/src/transformations/transformers/nulls/nullInsertThreshold';
|
||||
import { nullToValue } from '@grafana/data/src/transformations/transformers/nulls/nullToValue';
|
||||
import { GraphFieldConfig, LineInterpolation } from '@grafana/schema';
|
||||
import { GraphFieldConfig, LineInterpolation, TooltipDisplayMode, VizTooltipOptions } from '@grafana/schema';
|
||||
import { buildScaleKey } from '@grafana/ui/src/components/uPlot/internal';
|
||||
|
||||
type ScaleKey = string;
|
||||
@@ -310,3 +310,7 @@ export function regenerateLinksSupplier(
|
||||
|
||||
return alignedDataFrame;
|
||||
}
|
||||
|
||||
export const isTooltipScrollable = (tooltipOptions: VizTooltipOptions) => {
|
||||
return tooltipOptions.mode === TooltipDisplayMode.Multi && tooltipOptions.maxHeight != null;
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ import { TimeSeries } from 'app/core/components/TimeSeries/TimeSeries';
|
||||
import { findFieldIndex } from 'app/features/dimensions';
|
||||
|
||||
import { TimeSeriesTooltip } from '../timeseries/TimeSeriesTooltip';
|
||||
import { prepareGraphableFields, regenerateLinksSupplier } from '../timeseries/utils';
|
||||
import { isTooltipScrollable, prepareGraphableFields, regenerateLinksSupplier } from '../timeseries/utils';
|
||||
|
||||
import { Options } from './panelcfg.gen';
|
||||
|
||||
@@ -142,6 +142,7 @@ export const TrendPanel = ({
|
||||
mode={options.tooltip.mode}
|
||||
sortOrder={options.tooltip.sort}
|
||||
isPinned={isPinned}
|
||||
scrollable={isTooltipScrollable(options.tooltip)}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user