Skip to content

Unify graph default params #3378

@nikolas

Description

@nikolas

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions