Skip to content

How make a plot which does not own the ploted data #43

@Adam-Ladd

Description

@Adam-Ladd

Hi,
I am working on a basic finite element method program. I would like to be able to add new data to the plot and render multiple plots based on the same data (showing displacements, stress, strain e.t.c.) the current implementation of chart does not appear to offer a way to pass data and instead that data must be owned by struct implementing the Chart trait. This leaves me with one of two options.

  1. Clone the data into each of the charts and implement logic to clone any changes to each of the charts
  2. Place the data in a reference counted pointer and clone that pointer into the chart's state

Both options are undesirable as the first would increase memory requirements a fair bit and require a bunch of extra logic to sync the changes, while the second would require me to use a smart pointer for all operations on the data (which is otherwise unnecessary). What I would ideally like is for the data to be owned by the main program to simply take an immutable reference(s) to that data when plotting (which is the only time that data is needed), this would allow the rest of the program to interact with and update this data when not plotting and for that data to then be plotted.

Is there a way to do this? Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions