Skip to content

Fixes Missing tooltip on charts (high DPI / multi-monitor DPI issue)#320

Merged
erikdarlingdata merged 1 commit into
erikdarlingdata:devfrom
ClaudioESSilva:fix/MissingTooltipOnCharts-issue-319
Feb 26, 2026
Merged

Fixes Missing tooltip on charts (high DPI / multi-monitor DPI issue)#320
erikdarlingdata merged 1 commit into
erikdarlingdata:devfrom
ClaudioESSilva:fix/MissingTooltipOnCharts-issue-319

Conversation

@ClaudioESSilva
Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #319

Which component(s) does this affect?

  • Full Dashboard
  • Lite Dashboard
  • Lite Tests
  • SQL collection scripts
  • CLI Installer
  • GUI Installer
  • Documentation

How was this tested?

Before:

NoTooltip.mp4

After:

WithTooltip.mp4

Root cause:

_chart.DisplayScale is captured by ScottPlot at first render and stays fixed at the DPI of the monitor where the window opened. VisualTreeHelper.GetDpi() is a WPF live query that always reflects the DPI of the monitor the visual currently lives on, including after the window is dragged to another screen.

What happens without the fix (on a monitor with different DPI):

  • e.GetPosition() returns logical pixels scaled by the new monitor's DPI ratio
  • _chart.DisplayScale still holds the original monitor's ratio
  • The resulting ScottPlot.Pixel is off, dx / dy exceed the proximity threshold, so no tooltip is shown

Checklist

  • I have read the contributing guide
  • My code builds with zero warnings (dotnet build -c Debug)
  • I have tested my changes against at least one SQL Server version
  • I have not introduced any hardcoded credentials or server names

@ClaudioESSilva ClaudioESSilva changed the base branch from main to dev February 26, 2026 15:09
@ClaudioESSilva ClaudioESSilva changed the title Fixes #319 Fixes Missing tooltip on charts (high DPI / multi-monitor DPI issue) Feb 26, 2026
Copy link
Copy Markdown
Owner

@erikdarlingdata erikdarlingdata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean fix, good root cause analysis.

_chart.DisplayScale is captured once at first render and stays locked to the original monitor's DPI. VisualTreeHelper.GetDpi() live-queries the current monitor, so the coordinate math stays correct after dragging across monitors.

Safe on single-monitor setups — DpiScaleX/DpiScaleY will equal DisplayScale, so behavior is unchanged.

Worth noting that ScottPlot's own rendering still uses the stale DisplayScale internally (axis labels, plot layout, etc.), but that's a ScottPlot issue, not something for this PR to solve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] The tooltip for data points doesn't appear (high DPI / multi-monitor DPI issue)

2 participants