Skip to content

Commit 1ddc86a

Browse files
authored
Change default value for sorting dropdown in settings (tensorflow#7051)
## Motivation for features / changes The tooltip is now limited to 5 items, so the default sorting should prioritize the most relevant data. Setting Nearest Pixel as the default ensures the tooltip shows the items closest to the cursor, reducing clutter and improving readability. ## Technical description of changes Updated the dropdown settings view component to use Nearest Pixel as the default sorting option. This affects the initial tooltip ordering logic so the first 5 displayed items are the ones closest to the cursor position.
1 parent a82193a commit 1ddc86a

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

tensorboard/webapp/metrics/metrics_integration_test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {MetricsDashboardContainer} from './views/metrics_container';
2424
describe('metrics integration test', () => {
2525
const ByCss = {
2626
SCALARS_SMOOTHING_INPUT: By.css('.scalars-smoothing input'),
27+
TOOLTIP_SORT_DROPDOWN: By.css('.tooltip-sort tb-dropdown'),
2728
};
2829

2930
beforeEach(() => {
@@ -44,6 +45,13 @@ describe('metrics integration test', () => {
4445

4546
const input = fixture.debugElement.query(ByCss.SCALARS_SMOOTHING_INPUT);
4647
expect(input.nativeElement.value).toBe('0.6');
48+
49+
const tooltipSortDropdown = fixture.debugElement.query(
50+
ByCss.TOOLTIP_SORT_DROPDOWN
51+
);
52+
expect(tooltipSortDropdown.componentInstance.value).toBe(
53+
METRICS_SETTINGS_DEFAULT.tooltipSort
54+
);
4755
});
4856

4957
it('permits overriding default settings with DI', async () => {

tensorboard/webapp/metrics/store/metrics_types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ export interface State {
278278

279279
export const METRICS_SETTINGS_DEFAULT: MetricsSettings = {
280280
cardMinWidth: null,
281-
tooltipSort: TooltipSort.ALPHABETICAL,
281+
tooltipSort: TooltipSort.NEAREST,
282282
ignoreOutliers: true,
283283
xAxisType: XAxisType.STEP,
284284
hideEmptyCards: true,

0 commit comments

Comments
 (0)