mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-09-07 09:13:00 +02:00
Add metrics to histoselect, add userfilters
- edit struct to make only count return required
This commit is contained in:
@@ -316,16 +316,18 @@ export function checkMetricDisabled(m, c, s) { //[m]etric, [c]luster, [s]ubclust
|
||||
}
|
||||
|
||||
export function convert2uplot(canvasData) {
|
||||
// initial use: Canvas Histogram Data to Uplot
|
||||
// Prep: Uplot Data Structure
|
||||
let uplotData = [[],[]] // [X, Y1, Y2, ...]
|
||||
// MetricHisto Only: Check if 1st bin not-null -> Set 0-Value bin for scaling
|
||||
// Else: Only Single 0-Value bin returned -> No reset required
|
||||
if (canvasData[0]?.bin) {
|
||||
uplotData[0].push(0)
|
||||
uplotData[1].push(0)
|
||||
}
|
||||
// Iterate
|
||||
canvasData.forEach( cd => {
|
||||
if (cd.bin) { // MetricHisto Datafromat
|
||||
// Force Zero Entry for scaling
|
||||
if (uplotData[0].length == 0) {
|
||||
uplotData[0].push(0)
|
||||
uplotData[1].push(0)
|
||||
}
|
||||
uplotData[0].push(cd.max)
|
||||
if (Object.keys(cd).length == 4) { // MetricHisto Datafromat
|
||||
uplotData[0].push(cd?.max ? cd.max : 0)
|
||||
uplotData[1].push(cd.count)
|
||||
} else { // Default
|
||||
uplotData[0].push(cd.value)
|
||||
|
Reference in New Issue
Block a user