open-plan-tool / gui

Energy Planning Application
Other
8 stars 4 forks source link

[Tool] The default graphics should be constructed using ReportItems #139

Closed Bachibouzouk closed 2 years ago

Bachibouzouk commented 2 years ago
Bachibouzouk commented 2 years ago

To get a hand on the selected scenarios one can make use of

projects.services.get_selected_scenarios_in_cache(request, proj_id)

to get the selected scenarios in a view in python side (with the request of the view)

In js side the function update_selected_scenarios calls functions to update the default graphs (for example scenario_visualize_timeseries, one could use this to update the default ReportItems

Bachibouzouk commented 2 years ago

How ReportItems are plotted is by using the "render_json" method of the ReportItem. Each ReportItem has a unique DOM id, which can be used by js function to modify the rendered graphs. Every js code which deals with ReportItem is in static/js/report_items.js. Maybe the best would be to copy addReportItemGraphToDOM to updateReportItemGraph and modify the Graph only using the graphId