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

Unify graph default params #3378

Open
nikolas opened this issue Jul 29, 2024 · 1 comment
Open

Unify graph default params #3378

nikolas opened this issue Jul 29, 2024 · 1 comment

Comments

@nikolas
Copy link
Member

nikolas commented Jul 29, 2024

Default parameters for a new graph are set a number of ways throughout the various graph types:

These different places are appropriate for different scenarios, though they are all fine. Still, I think there is some technical debt here which we can unify to make things work in a clearer way.

If this parameter is hard-coded for this graph type and will not be altered by the user or instructor, this is best to set in the graph constructor (i.e. in the graphs directory). For this sort of parameter, it doesn't even need to be saved to the database since it will never be changed, so it can exist purely as code in the specific graph file itself.

If we provide a default for this parameter which is optionally overridden by the instructor in the graph creation process, we set the default in Editor.jsx. https://github.com/ccnmtl/econplayground/blob/master/media/js/src/Editor.jsx#L113

As a last resort, we can set parameters in JXGBoard. This component is useful for setting parameters which need to update based on other params. But the complex logic in this component is messy and I think there is some cleanup we can do here.

@nikolas
Copy link
Member Author

nikolas commented Aug 12, 2024

This system is now generally in place here: https://github.com/ccnmtl/econplayground/blob/master/media/js/src/graphUtils.js

We can migrate older graph types to this on an as-needed basis.

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

No branches or pull requests

1 participant