Skip to content

Commit

Permalink
Merge pull request #3405 from ag-grid/AG-13318/qa_feedback_tc9
Browse files Browse the repository at this point in the history
AG-13318 Fix TC9: Default enabled to true with `tooltip: {}`
  • Loading branch information
alantreadway authored Jan 20, 2025
2 parents b4a0097 + 555286e commit 4da9b74
Show file tree
Hide file tree
Showing 19 changed files with 28 additions and 6 deletions.
21 changes: 21 additions & 0 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,6 +128,7 @@ function radialGaugeOptions(opts: AgRadialGaugeOptions) {
subtitle,
theme,
title,
tooltip: pickTooltipProps(tooltip),
width,
});

Expand Down Expand Up @@ -238,6 +256,7 @@ function linearGaugeOptions(opts: AgLinearGaugeOptions): AgGaugeChartOptions {
subtitle,
theme,
title,
tooltip: pickTooltipProps(tooltip),
width,
});
const scaleOpts = pickProps<ScaleStyle>(scale, {
Expand Down Expand Up @@ -361,6 +380,7 @@ export function gauge(
subtitle,
theme,
title,
tooltip,
width,
} = opts;
return pickProps<AgBaseGaugePresetOptions>(opts, {
Expand All @@ -378,6 +398,7 @@ export function gauge(
subtitle,
theme,
title,
tooltip,
width,
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export const LinearGaugeModule: _ModuleSupport.SeriesModule<'linear-gauge'> = {
themeTemplate: {
minWidth: 200,
minHeight: 200,
tooltip: {
enabled: false,
},
series: {
thickness: 50,
bar: {
Expand Down Expand Up @@ -62,9 +65,6 @@ export const LinearGaugeModule: _ModuleSupport.SeriesModule<'linear-gauge'> = {
color: DEFAULT_INVERTED_LABEL_COLOUR,
},
margin: 4,
tooltip: {
enabled: false,
},
},
axes: {
[CARTESIAN_AXIS_TYPE.NUMBER]: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export const RadialGaugeModule: _ModuleSupport.SeriesModule<'radial-gauge'> = {
themeTemplate: {
minWidth: 200,
minHeight: 200,
tooltip: {
enabled: false,
},
series: {
outerRadiusRatio: 1,
innerRadiusRatio: 0.8,
Expand Down Expand Up @@ -73,9 +76,6 @@ export const RadialGaugeModule: _ModuleSupport.SeriesModule<'radial-gauge'> = {
fontFamily: { ref: 'fontFamily' },
color: DEFAULT_MUTED_LABEL_COLOUR,
},
tooltip: {
enabled: false,
},
},
axes: {
[POLAR_AXIS_TYPE.ANGLE_NUMBER]: {
Expand Down
1 change: 1 addition & 0 deletions packages/ag-charts-types/src/chart/themeOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ export type AgBaseGaugePresetThemeOptions = Pick<
| 'padding'
| 'subtitle'
| 'title'
| 'tooltip'
| 'width'
>;

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4da9b74

Please sign in to comment.