4 · Chart Snap Point

Line chart built with BlazorExpress.ChartJS (the chart package that replaces the Blazor.Bootstrap charts from v4 onwards). Clicking a point makes the event snap to the closest data point and opens its link in a new tab.

Click and snap settings

Tickets per day · click a point

Chart waiting to be initialized.

Selected point

No point has been selected yet.

Point → link map

# Label Tickets Link
0 Day 01 32 open
1 Day 02 45 open
2 Day 03 28 open
3 Day 04 51 open
4 Day 05 39 open
5 Day 06 62 open
6 Day 07 55 open
7 Day 08 71 open
8 Day 09 48 open
9 Day 10 66 open
10 Day 11 74 open
11 Day 12 58 open
INFO
Case 4 findings
  • In Blazor.Bootstrap 4.0.0 the charts moved to the BlazorExpress.ChartJS package; v3.5.0 still bundles them but without click events.
  • BlazorExpress.ChartJS 1.2.4 exposes OnClick with DatasetIndex, DatasetLabel, Index, Label and Value, which is enough to resolve the point's link.
  • The "snap" is resolved by Chart.js with getElementsAtEventForMode(event, 'nearest', { intersect }): with intersect: true the click must hit the point; with intersect: false getting close is enough.
  • Opening the tab from the JS handler (Mode B) is more reliable: it happens inside the user gesture, so the browser does not treat it as a pop-up.
An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.