We want the developers to be able to create charts from the backend code. In order to achieve that, Proteus-backend may send WebSocket messages containing a chart identifier along its data, visualisation type and aditional information like a label. With this design, the Proteus-charts library should be able to create new charts on demand for new charts from the backend.
On the client side, the developer may set a container div
where the library will create additional div
containers for each new chart requested from the server.
The following is a proposed data format for the connector messages:
{
"type": "linechart",
"chart": "chart1",
"label": "wow so charty, much data",
"data": [{
"key": "CO2",
"values": [{
"x": 1,
"y": 10
}]
}, {
"key": "SO2",
"values": [{
"x": 1,
"y": 1.5
}, {
"x": 2,
"y": 1.5
}, {
"x": 3,
"y": 5
}]
}, {
"key": "CO",
"values": [{
"x": 1,
"y": 3
}, {
"x": 2,
"y": 12
}, {
"x": 3,
"y": 21
}]
}]
}