From eb5fa763da265ef34423394754c6f9275eb47667 Mon Sep 17 00:00:00 2001 From: Steve-Mcl Date: Tue, 24 Sep 2024 20:58:17 +0100 Subject: [PATCH 01/10] fix broken show/hide of y-axis --- nodes/widgets/ui_chart.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nodes/widgets/ui_chart.html b/nodes/widgets/ui_chart.html index 05e05c42f..6add0c801 100644 --- a/nodes/widgets/ui_chart.html +++ b/nodes/widgets/ui_chart.html @@ -298,9 +298,9 @@ } }) - // handle event when chart's type is changed + // handle event when chart's series property is changed $('#node-input-category').change((evt) => { - const categoryType = $(evt.target).val() + const categoryType = $('#node-input-category').typedInput('type') if (categoryType === 'json') { // hide y-axis property setting as category will now control that From c52ab78060024a5cf27e80e4f5af754c77a2306b Mon Sep 17 00:00:00 2001 From: Steve-Mcl Date: Tue, 24 Sep 2024 20:59:49 +0100 Subject: [PATCH 02/10] add typed input option msg to y-axis --- nodes/widgets/ui_chart.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nodes/widgets/ui_chart.html b/nodes/widgets/ui_chart.html index 6add0c801..0c868cd10 100644 --- a/nodes/widgets/ui_chart.html +++ b/nodes/widgets/ui_chart.html @@ -82,6 +82,7 @@ xAxisFormatType: { value: 'auto' }, yAxisLabel: { value: '' }, yAxisProperty: { value: null }, + yAxisPropertyType: { value: 'property' }, ymin: { value: '', validate: function (value) { return value === '' || RED.validators.number() } }, ymax: { value: '', validate: function (value) { return value === '' || RED.validators.number() } }, action: { value: 'append' }, @@ -231,7 +232,7 @@ $('#node-input-yAxisProperty').typedInput({ default: propertyType.value, typeField: $('#node-input-yAxisPropertyType'), - types: [propertyType] + types: ['msg', propertyType] // makes no sense for the y-axis to be a string }) const updateXAxisTypeOptions = function (options, defaultValue) { @@ -550,6 +551,7 @@

Axis Configuration

+
From f24a69826dded4669e73ab2aa5018b1307864523 Mon Sep 17 00:00:00 2001 From: Steve-Mcl Date: Tue, 24 Sep 2024 21:00:52 +0100 Subject: [PATCH 03/10] rename array for clarity --- nodes/widgets/ui_chart.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/nodes/widgets/ui_chart.html b/nodes/widgets/ui_chart.html index 0c868cd10..48b1e0a9f 100644 --- a/nodes/widgets/ui_chart.html +++ b/nodes/widgets/ui_chart.html @@ -42,7 +42,7 @@ return RED._('@flowfuse/node-red-dashboard/ui-chart:ui-chart.' + property) } const noneType = { value: 'none', label: RED._('@flowfuse/node-red-dashboard/ui-chart:ui-chart.label.none'), hasValue: false } - const propertyType = { value: 'property', label: RED._('@flowfuse/node-red-dashboard/ui-chart:ui-chart.label.key') } + const keyType = { value: 'property', label: RED._('@flowfuse/node-red-dashboard/ui-chart:ui-chart.label.key') } function hexToRgb (hex) { const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex) @@ -57,9 +57,9 @@ function getSeriesTypes (xAxisType) { if (xAxisType === 'category') { - return [noneType, 'msg', 'str', 'json', propertyType] + return [noneType, 'msg', 'str', 'json', keyType] } else { - return [noneType, 'msg', 'str', 'json', propertyType] + return [noneType, 'msg', 'str', 'json', keyType] } } @@ -225,14 +225,14 @@ types: getSeriesTypes($('#node-input-xAxisType').val()) }) $('#node-input-xAxisProperty').typedInput({ - default: propertyType.value, + default: keyType.value, typeField: $('#node-input-xAxisPropertyType'), - types: ['msg', 'str', propertyType] + types: ['msg', 'str', keyType] }) $('#node-input-yAxisProperty').typedInput({ - default: propertyType.value, + default: keyType.value, typeField: $('#node-input-yAxisPropertyType'), - types: ['msg', propertyType] // makes no sense for the y-axis to be a string + types: ['msg', keyType] // makes no sense for the y-axis to be a string }) const updateXAxisTypeOptions = function (options, defaultValue) { @@ -314,8 +314,8 @@ // ensure the xAxis PropertyType isn't an invalid value if (this.xAxisPropertyType === 'msg' && this.xAxisProperty === '') { // auto-fix it for the user - this.xAxisPropertyType = propertyType.value - $('#node-input-xAxisProperty').typedInput('type', propertyType.value) + this.xAxisPropertyType = keyType.value + $('#node-input-xAxisProperty').typedInput('type', keyType.value) } // Stack/Group-By Options - convert from bool to string values for