I’m evaluating whether to use an Online Chart or an XY Chart in mapp View for visualizing battery operation. The chart should display both charge/discharge power and battery state of charge (SoC). Currently, I have an Online Chart and an XY Chart displaying the same data, but I’m not sure which widget is better suited for the requirements below.
The x-axes should start once the variable “session started = True”.
The x-axes should autoscale with the variable “session duration”
The time should display relative session time in hh:mm (variable “session duration”)
The SoC should be fixed from 0-100%. The power axis should automatically scale based on the actual charge/discharge power.
The area under the power curve should be colored with respect to 0Watt. Not with respect to the x axes of the graph
Ideally the SoC axes is placed on the right of the graph and the power axes is placed on the left.
I discovered that the XY chart has more configuraton options, but as far as I understand this plot requires an array of data, and might therfore be less suitable for plotting live data. Furthermore, the session duration can vary from a few hours to weeks, causing large arrays. Despite that, the appearance of the online chart is more modern and in line with our theme, the XY chart looks more industrial.
What would be the best type of plot, and how can I implement the requirements above within the existing widgets/limitations imposed by them?
I think you have already answered your questions, for your usecase is from my perspective better OnlineChart. but you are limited with styling possiblity. Or what our mappView experts thinks about it, e.g. @marcel.voigt ?
This is most likely where you will face problems with both approaches… OnlineChart stores the data in the clients memory(or the PLC if you use OPC UA Historizing)… and XY chart would store it in the PLC:s memory. Of course you could do some averaging / bucketing of data on the PLC for the XY chart.
The Y axes for both should be possible to scale by setting the “max” and “min” properties via bindings. (Calculate your preferred values with PLC code or event bindings / event scripts).
Automation Help: XY Chart YAxis
For selecting how many points are shown on the X axis there is the “numberOfSamples” property, that can be updated via bindings to match the amount of data points in your arrays.
Automation Help: XY Chart Graph
The best approach here sounds like you need an external database, preferably a timeseries database, for storing the data and then you need to get the data from there as required. This can then be quite easily shown with the XY chart.
You could then also use the WebViever widget to embed a proper data analysis dashboard(Grafana for example) to show within mappView, that would get and show the data without using the PLC in between. And also not be limited in the configuration of the mapp View graphing widgets.