The content of each panel depends on three things:
the type of panel
the type of graph
the data being used
We already have separation between panels and graphs, and we merged some panels by adding a dropdown that lets you select the data being plotted, however we can generalize this further.
This means that the VersusGraph (which is just a line plot with two lines) can only be used to plot values from totalProduction/totalConsumption.
Instead of doing this, we should have generic panels and graphs that accept a path (as a string) that can be used by the graph to retrieve the data. For example, the above example could be rewritten to:
The content of each panel depends on three things:
We already have separation between panels and graphs, and we merged some panels by adding a dropdown that lets you select the data being plotted, however we can generalize this further.
Currently we do something like this:
ProductionConsumption.vue
panel, we include theVersusGraph
and we pass thecurrency
being plotted: https://github.com/overthesun/simoc-web/blob/ee0153b0408b48f5aaca4dfccf1e1cb6be825d96/src/components/panels/ProductionConsumption.vue#L12VersusGraph.vue
we just pick the selectedcurrency
from the hardcodedtotalProduction
/totalConsumption
: https://github.com/overthesun/simoc-web/blob/ee0153b0408b48f5aaca4dfccf1e1cb6be825d96/src/components/graphs/VersusGraph.vue#L142-L143This means that the
VersusGraph
(which is just a line plot with two lines) can only be used to plot values fromtotalProduction
/totalConsumption
.Instead of doing this, we should have generic panels and graphs that accept a path (as a string) that can be used by the graph to retrieve the data. For example, the above example could be rewritten to:
where
datasets
could be defined as:with
currency
being the value selected from the dropdown.The graph can then use the paths specified in
datasets
and plot a line for each dataset.To retrieve the actual values from the path, we can use
lodash.get
orobject-path
.