FUSED-Wind / fusedwind-gui

Apache License 2.0
1 stars 2 forks source link

detach bokeh plots from OpenMDAO components #4

Open fzahle opened 9 years ago

fzahle commented 9 years ago

It would be a more clean if we detached all GUI related plotting from the actual OpenMDAO components and instead made a series of plot_xx functions that returned simple dictionaries with e.g. plot type, x and y values.

e.g.

plot_wall_thickness(self):

    plot_dict = {'title': 'Tower wall thickness'
                      'plot_type': 'line',
                      'x-label': 'Radius [m]',
                      'y-label': 'Wall thickness [m]',
                       'x': self.t[:, 0],
                       'y': self.t[:, 1]}
    return plot_dict

we can then make bokeh as well as matplotlib interfaces if we wanted to.

when we start using the plot server we can also hook these methods up to bokeh server update methods that would update the plots continuously in e.g. an optimisation. See https://github.com/bokeh/bokeh/blob/master/examples/embed/slideshow/app_reveal.py for inspiration.

fzahle commented 9 years ago

It could be neat if we could define plot methods associated with variables. Say a component has a variable called tower_wall_thickness, if the component then defines a method called plot_tower_wall_thickness which returns a dictionary like above, we then know that the plot should be associated with that variable and can be added to the detail view of the variable and not placed at the bottom of the component view as it's done now. that allows us to make a myriad of plots without cluttering the main view of the component.

this would also be very neat for all the cost breakdowns that are vartrees where we can generate pie/bar charts.