Skip to content

Fix colors of predicted line in Live activity plot#2410

Open
elnjensen wants to merge 4 commits intoLoopKit:devfrom
elnjensen:live_activity_plot
Open

Fix colors of predicted line in Live activity plot#2410
elnjensen wants to merge 4 commits intoLoopKit:devfrom
elnjensen:live_activity_plot

Conversation

@elnjensen
Copy link
Contributor

This PR addresses two issues in the Live Activity plot:

  1. Correctly color-code the predicted line, addressing issue Live activity predictive line displays incorrectly if you are predicted to go below the glucose safety limit #2392;
  2. Make override and target range bars visible when min and max are the same.

@elnjensen elnjensen mentioned this pull request Mar 6, 2026
@StijnvanderLippe
Copy link

StijnvanderLippe commented Mar 9, 2026

The line colouring work as desired. Override bars do not display correctly.

Here are a couple of tests. I had an override active from 11:38 to 12:38, with 80% insulin needs as the only override.

Lower limit (mmol/L) Upper limit (mmol/L) Screenshot Comment
7 13 image Line is red below 7 mmol/L as desired. There is no orange colouring since I'm never above the upper limit. The override bar is displayed inside the "Eventual BG" text instead of inside the graph.
6 13 image Same as above. The red colouring now starts below 6 mmol/L as desired. The override bar again displays incorrectly.
4 7 image Now the line is never red, since I'm never below the lower limit, as desired. The line is coloured orange above the upper limit as expected. The BG level is also coloured according to the user's limits. The override bar again displays incorrectly.
4 6 image Similar test as previous case, line colouring starts where expected and the BG level is coloured correctly. The override bar again displays incorrectly.
5 5.5 image Line is red below 5 mmol/L, and orange above 5.5 mmol/L, as desired. The BG level is coloured correctly. The override bar again displays incorrectly, this time between the current glucose level and the "Eventual BG" text since some time has passed compared to previous tests.

In all tests the line colouring is how it's supposed to be, so that's the good news. The override bar does not seem to display correctly if the only override is the insulin needs. Below some additional tests to display this behaviour:

Override target range (mmol/L) Override insulin needs Override duration Screenshot Comment
8.5 - 9.0 Unchanged 3.5 hours image Displays correctly
4.4 - 4.5 140% Indefinite image Displays correctly
Unchanged 130% Indefinite image Displays incorrectly. The override bar seems to be placed at where 0 mmol/L would be, but this is just a guess.

From these tests it seems that if correction range is changed, the override bar displays correctly, regardless of insulin needs override. If only the insulin needs are changed, then the override bar displays incorrectly.

@elnjensen
Copy link
Contributor Author

elnjensen commented Mar 9, 2026

If only the insulin needs are changed, then the override bar displays incorrectly.

Is this behavior new with this PR? Are you able to test it with the released code? I wonder if it's a separate bug.

Edit to add that this happens for live activity mg/dl graph as well.

I didn't even realize it was possible for the range field to be blank in an override! (Maybe @bastiaanv didn't either, though he's probably ahead of me. 😉) I'm traveling and can't edit code right now, but I think this is a separate issue, and that the LA code needs to check to see if the range fields in an override are blank, and then fall back to displaying the override bar with the main range bounds if so.

@StijnvanderLippe
Copy link

StijnvanderLippe commented Mar 9, 2026

Is this behavior new with this PR? Are you able to test it with the released code? I wonder if it's a separate bug.

I went back to 3.12, the issue is also present but in a slightly different way. For the duration of the override the override bars are not visible at all (at least, I cannot find them in the live activity view).

Example below for an override of 1.5 hours with only insulin needs set at 70%:

image

So it seems the issue was already present, but the changes in this PR make it so the issue shows up in a slightly different way.

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.

2 participants