-
I would like to graph these 108 sensors as parts of a 3D mesh if possible, here is the data as a normal graph: Using this code: type: custom:plotly-graph
entities:
- entity: sensor.bms_can_logger_cell_v_0
- entity: sensor.bms_can_logger_cell_v_1
- entity: sensor.bms_can_logger_cell_v_2
- entity: sensor.bms_can_logger_cell_v_3
- entity: sensor.bms_can_logger_cell_v_4
- entity: sensor.bms_can_logger_cell_v_5
- entity: sensor.bms_can_logger_cell_v_6
- entity: sensor.bms_can_logger_cell_v_7
- entity: sensor.bms_can_logger_cell_v_8
- entity: sensor.bms_can_logger_cell_v_9
- entity: sensor.bms_can_logger_cell_v_10
- entity: sensor.bms_can_logger_cell_v_11
- entity: sensor.bms_can_logger_cell_v_12
etc.. The closest appearance wise is this example: #391 But my data source is very different in that each sensor would be one part of the graph. I already have a real time bar graph of the cells: using this code: type: custom:plotly-graph
raw_plotly_config: true
title: Battery 0
fn: |-
$ex {
vars.x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
vars.y = [1, 2, 3, 4, 5, 6, 7, 8];
vars.z = [];
for (let j = 0; j < 108; j++) {
vars.z[j] = [];
// Calculate the index in the 1D array corresponding to the 2D matrix element
let index = j;
// Populate the matrix with values from the 1D array
vars.z[j][j] = hass.states["sensor.bms_can_logger_cell_v_" + (index).toString()].state
}
//console.log(vars.x);
//console.log(vars.y);
//console.log(vars.z);
for (let j = 0; j < 108; j++) {
// Calculate the index in the 1D array corresponding to the 2D matrix element
let index = j;
vars.x[index] = index;
// Populate the matrix with values from the 1D array
console.log(index);
vars.y[index] = hass.states["sensor.bms_can_logger_cell_v_" + (index).toString()].state
}
vars.ymin = Math.min(...vars.y) - (50.0 / 1000);
vars.ymax = Math.max(...vars.y) + (50.0 / 1000);
console.log(vars.x);
console.log(vars.y);
}
entities:
- entity: ""
color: "#ff0000"
type: bar
x: $ex vars.x
"y": $ex vars.y
z: $ex vars.z
texttemplate: "%{y}"
refresh_interval: 2
layout:
xaxis:
showgrid: false
zeroline: false
showticklabels: false
ticks: false
nticks: 1
visible: false
height: 410
yaxis:
range:
- $ex vars.ymin
- $ex vars.ymax
config:
displayModeBar: false
scrollZoom: false Any ideas on where to start? |
Beta Was this translation helpful? Give feedback.
Answered by
dbuezas
Nov 21, 2024
Replies: 1 comment 4 replies
-
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
clowrey
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's a tricky one! Try with this:
(used some random sensors to test it)