From b395a08b6eeabc87fdabc9b30cfebaba2b311f20 Mon Sep 17 00:00:00 2001 From: Thomas <101348966+tt-tom17@users.noreply.github.com> Date: Sun, 23 Feb 2025 03:10:01 +0100 Subject: [PATCH] Update CardChart_History.js add const 'factor' for big value and negativ value on panel --- ioBroker/Blockly/CardChart_History.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ioBroker/Blockly/CardChart_History.js b/ioBroker/Blockly/CardChart_History.js index 2cc66fc0..10fcde97 100644 --- a/ioBroker/Blockly/CardChart_History.js +++ b/ioBroker/Blockly/CardChart_History.js @@ -1,8 +1,9 @@ -var sourceDP = 'alias.0.Wohnzimmer.Heizung.ACTUAL'; -var targetDP = '0_userdata.0.Test.chartTest'; -var rangeHours = 24; -var maxXAchsisTicks = 6; -var historyInstance = 'history.0'; +const sourceDP = 'alias.0.Wohnzimmer.Heizung.ACTUAL'; +const targetDP = '0_userdata.0.Test.chartTest'; +const rangeHours = 24; +const maxXAchsisTicks = 6; +const historyInstance = 'history.0'; +const factor = 1; // Bei zu großen Werten und negativen Anzeigen im Panel um das 10fache erhöhen on({id: sourceDP, change: "any"}, async function (obj) { sendTo(historyInstance, 'getHistory', { @@ -25,7 +26,7 @@ on({id: sourceDP, change: "any"}, async function (obj) { //Check history items for requested hours for (var j = 0, targetValue = 0; j < result.result.length; j++) { var valueDate = new Date(result.result[j].ts); - var value = (Math.round(result.result[j].val * 10) / 10); + var value = Math.round(result.result[j].val / factor * 10); if (valueDate > targetDate){ if ((targetDate.getHours() % stepXAchsis) == 0){ @@ -47,4 +48,4 @@ on({id: sourceDP, change: "any"}, async function (obj) { setState(targetDP, cardChartString, true); } }); -}); \ No newline at end of file +});