Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mrc-5490 Add graph #207

Merged
merged 97 commits into from
Nov 5, 2024
Merged

mrc-5490 Add graph #207

merged 97 commits into from
Nov 5, 2024

Conversation

EmmaLRussell
Copy link
Contributor

@EmmaLRussell EmmaLRussell commented Jun 27, 2024

NB After approval, we'll use this as the 'epic branch' for multiple graph tickets, and merge to main when the feature is complete.

This branch includes functionality to add graphs, and drag variables between graphs or to Hidden variables, as in the proof of concept.

Sorry about the line count! Future branches will be smaller.

Key changes:

  • I've pulled out a separate component GraphConfigs to replace SelectedVariables and act as a container for the individual GraphConfigs and the HiddenVariables component.
  • This is wrapped in a GraphConfigsCollapsible which has the top level vertical collapse and shows nothing if no variables or compile required - this is easier to unit test by splitting like this because verifcal collapse content is contained in a slot.
  • Shared logic for drag and drop etc used by GraphConfig and HiddenVariables is contained in a SelectedVariables mixin.
  • As suggested in POC review, an x button is included on all variables as an alternative way or removing it from the graph.
  • It proved very tricky to unit test code which directly uses the color package without enabling synthetic default imports - which caused a whole raft of other compilation errors, so I just side-stepped that by wrapping the usage of color (to fade the colour of hidden variables) into a separate util, and mocking that..
  • Graph config is added to Options tab as well as Code tab.
  • Graphs are only added to Run tab - multiple sensitivity graphs will go into a future branch.

@EmmaLRussell EmmaLRussell marked this pull request as ready for review July 1, 2024 13:44
const unselectedVariables =
rootState.model.odinModelResponse?.metadata?.variables.filter(
(s) => !payload.selectedVariables.includes(s)
) || [];
commit(GraphsMutation.SetSelectedVariables, { ...payload, unselectedVariables });
// sort the selected variables to match the order in the model
const selectedVariables = payload.selectedVariables.sort((a, b) =>
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there a benfit of the sort? is there significance in order of variables

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this is the variable order that will be displayed in the UI, and we want it to match the order of variables as they're defined in the model, which might typically follow a temporal order e.g. S(usceptible), I(nfected), R(ecovered) or be ordered by category. Just leaving them unordered or sorting alphabetically would be less meanginful for the user. This matches the previous toggle behaviour where variables were always in model order.

EmmaLRussell and others added 29 commits July 26, 2024 16:35
mrc-5551 Show Time label on final graph only
mrc-5485 Use multiple graph config in Sensitivity plots
Co-authored-by: David Mears <60350599+david-mears-2@users.noreply.github.com>
mrc-5545 Do not show linked variables on graphs which are not showing those variables
mrc-5443 Copy variable on drag if Ctrl key is pressed
@EmmaLRussell EmmaLRussell merged commit 154e4a7 into main Nov 5, 2024
1 of 2 checks passed
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