Repository navigation
feat(profile): continue the NDL overlay as TTS once in deco - #826
Conversation
|
📦 Build artifacts for this PR · commit
Artifacts expire in 7 days. Downloading requires being signed in to GitHub. macOS needs two extractions: unzip the downloaded artifact, then unzip the Updated automatically on each push. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Updates the dive profile chart overlay so the “NDL” toggle draws NDL only while NDL > 0, then breaks and continues as a TTS segment over the deco region (with tooltip behavior updated accordingly), avoiding misleading bridging diagonals across deco.
Changes:
- Updates tooltip rendering so that in-deco points show TTS under the NDL overlay (unless the standalone TTS overlay is enabled).
- Changes
_buildNdlLineto emit onlyNDL > 0points, insert null-spot breaks, and render straight segments to avoid spline overshoot across breaks. - Adds
_buildNdlDecoTtsLineand wires it into chart series building (suppressed when the standalone TTS overlay is enabled to avoid duplication).
Suppressed comments (1)
lib/features/dive_log/presentation/widgets/dive_profile_chart.dart:4533
- For consistency with the standalone TTS overlay (_buildTtsLine), consider applying the same flat surface lead-in here. Without it, if a profile starts in deco (NDL < 0 from the first sample) the NDL-overlay’s TTS continuation will start one sample interval inside the chart, reintroducing the ragged left edge that other overlay lines avoid.
return LineChartBarData(
spots: spots,
isCurved: false,
color: ttsColor,
|
@etlami Thank you for your contribution! Would you mind adding a before and after screenshot to visualize the proposed changes? Please include the existing NDL and TTS charts as well. |
|
Thanks @readme42! Before/after on dive #2851, which has a deco obligation. NDL overlay only
After — the NDL line stops where no-deco time runs out and continues as TTS (magenta) over the deco portion. So the single overlay reads as NDL while no-deco and TTS once a stop is owed. NDL + TTS both enabled
After — the NDL line no longer flatlines in deco, and the tooltip no longer lists TTS twice.
(A shallow deco stop later in the same dive, for good measure.) |
|
Thank you very much @etlami, now it's clear to me what you're trying to achieve here. In general I like the idea of avoiding the long "bottom zero NDL line" — it really has no benefit. A few points I'd like us to think through before this goes in:
Stepping back, the questions I keep coming back to are:
I ask because if the honest answer is "tec divers want TTS, rec divers want NDL", then maybe the better fix isn't to chain the two metrics onto one toggle, but to make each overlay behave sensibly on its own — NDL simply ending when it stops Happy to keep iterating on this with you either way. |
|
TTS and NDL are objectively two distinct things, each with a different class of diver who cares about them, and each with potentially more than one source or way of being calculated/displayed. For those reasons I feel that they should remain separate and distinct in the UI. Merging them makes too many assumptions around what a diver infers from the values. Merging would also require adding a lot of ui configuration complexity to support the different source/calculation combinations of each metric. |
The NDL overlay clamped to a flat line pinned at zero the moment a deco obligation began, and because the deco points were only dropped (not broken) the line bridged straight across the deco region as a misleading diagonal. Now NDL is drawn only while there is actually no-deco time left; once it is spent the line ends (a null spot breaks the series so it doesn't bridge the gap). NDL and TTS stay separate overlays -- TTS is unchanged.
a1ce526 to
07262b3
Compare
|
Agree — chaining the two metrics onto one toggle was the wrong call, and it produced exactly the three issues you flagged (magenta while TTS is off, spliced source selectors, the untouched comparison overlay). Reworked to the simpler behaviour you both suggested: the NDL overlay now just ends where no-deco time runs out (no flat zero line, no bridging diagonal), and TTS is left entirely as its own overlay. Each overlay now behaves sensibly on its own, so all three concerns go away. The diff is down to a single ~14-line change in |





What
On the dive profile chart, the NDL overlay used to clamp to a flat line pinned at zero the moment a deco obligation began — an uninformative stretch. Worse, because the deco points were only dropped (not broken), the line bridged straight across the deco region as a misleading diagonal.
Now the NDL overlay is drawn only while there is actual no-deco time left (NDL > 0). Once it's spent, the line breaks and the same overlay continues as TTS (time-to-surface) over the deco portion, drawn as its own coloured segment so the metric change reads clearly. The tooltip switches to TTS there too.
So the single NDL overlay reads as NDL while no-deco diving and TTS once a stop is owed — which also keeps the graph clean without needing a separate always-on TTS line.
Details
_buildNdlLine: only emits spots wherendl > 0; inserts a null spot at deco boundaries so segments don't bridge; straight segments (a spline would overshoot across the breaks)._buildNdlDecoTtsLine: plots TTS over thendl < 0deco portion, in the TTS colour, under the same NDL toggle.Note
This is a chart-behaviour change; I validated it visually on a real deco dive (NDL breaks where no-deco time runs out, TTS takes over, no bridging diagonal, single TTS tooltip row). No unit test is added — the change is in the fl_chart line builders, exercised by the existing profile-chart widget tests, which pass.
Verified locally (Flutter 3.44.8 / Dart 3.12.2):
flutter analyze libclean,dart formatclean, dive-log widget suite green.