Skip to content

Commit

Permalink
AG-13318 Mute warnings when setting series[].tooltip.renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
olegat committed Jan 17, 2025
1 parent d404906 commit 0007f40
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions packages/ag-charts-community/src/api/preset/gauge.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { RequireOptional } from 'ag-charts-core';
import {
type AgBaseGaugePresetOptions,
type AgCartesianAxisOptions,
type AgCartesianAxisPosition,
type AgChartTooltipOptions,
type AgGaugeChartOptions,
type AgGaugeOptions,
type AgLinearGaugeOptions,
Expand All @@ -17,6 +19,21 @@ import {
import { mergeArrayDefaults, mergeDefaults } from '../../util/object';
import { IGNORED_PROP, pickProps } from './presetUtils';

function pickTooltipProps(tooltip: AgChartTooltipOptions | undefined): AgChartTooltipOptions | undefined {
if (tooltip === undefined) return undefined;

const { enabled, showArrow, range, position, delay, wrapping } = tooltip;
const result: RequireOptional<AgChartTooltipOptions> = {
enabled,
showArrow,
range,
position,
delay,
wrapping,
};
return Object.fromEntries(Object.entries(result).filter(([_, value]) => value !== undefined));
}

function isRadialGauge(opts: AgGaugeOptions): opts is AgRadialGaugeOptions {
return opts.type === 'radial-gauge';
}
Expand Down Expand Up @@ -111,7 +128,7 @@ function radialGaugeOptions(opts: AgRadialGaugeOptions) {
subtitle,
theme,
title,
tooltip,
tooltip: pickTooltipProps(tooltip),
width,
});

Expand Down Expand Up @@ -239,7 +256,7 @@ function linearGaugeOptions(opts: AgLinearGaugeOptions): AgGaugeChartOptions {
subtitle,
theme,
title,
tooltip,
tooltip: pickTooltipProps(tooltip),
width,
});
const scaleOpts = pickProps<ScaleStyle>(scale, {
Expand Down

0 comments on commit 0007f40

Please sign in to comment.