@record-evolution/widget-gauge 1.7.15 → 1.7.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/widget-gauge.js +15 -5
- package/dist/widget-gauge.js.map +1 -1
- package/package.json +2 -2
- package/src/definition-schema.d.ts +14 -4
- package/src/definition-schema.json +26 -5
- package/src/widget-gauge.ts +12 -4
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "REWidget widget-gauge",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "widget-gauge",
|
|
6
|
-
"version": "1.7.
|
|
6
|
+
"version": "1.7.16",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/widget-gauge.js",
|
|
9
9
|
"types": "dist/src/widget-gauge.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"echarts": "5.6.0",
|
|
27
|
-
"lit": "^3.3.
|
|
27
|
+
"lit": "^3.3.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@custom-elements-manifest/analyzer": "^0.10.4",
|
|
@@ -15,12 +15,20 @@ export type Unit = string;
|
|
|
15
15
|
/**
|
|
16
16
|
* The number of decimal places to show in the value. If not specified, precision is 0.
|
|
17
17
|
*/
|
|
18
|
-
export type
|
|
18
|
+
export type Decimals = number;
|
|
19
|
+
/**
|
|
20
|
+
* Draw multiple Charts based on the split column of a data table.
|
|
21
|
+
*/
|
|
22
|
+
export type MultiChart = boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The value of the gauge
|
|
25
|
+
*/
|
|
26
|
+
export type Value = number;
|
|
19
27
|
/**
|
|
20
28
|
* This should be an ISO String date like 2023-11-04T22:47:52.351152+00:00. Will only be used to detect data age of data.
|
|
21
29
|
*/
|
|
22
30
|
export type Timestamp = string;
|
|
23
|
-
export type
|
|
31
|
+
export type Value1 = number;
|
|
24
32
|
/**
|
|
25
33
|
* You can specify a table column to autogenerate dataseries for each distinct entry in this column. E.g. if you have a table with columns [city, timestamp, temperature] and specify ''city'' as split column, then you will get a gauge for each city.
|
|
26
34
|
*/
|
|
@@ -30,7 +38,7 @@ export type SplitDataBy = string;
|
|
|
30
38
|
*/
|
|
31
39
|
export type Data = {
|
|
32
40
|
tsp?: Timestamp;
|
|
33
|
-
value?:
|
|
41
|
+
value?: Value1;
|
|
34
42
|
pivot?: SplitDataBy;
|
|
35
43
|
[k: string]: unknown;
|
|
36
44
|
}[];
|
|
@@ -56,7 +64,9 @@ export type Gauges = {
|
|
|
56
64
|
label?: Label;
|
|
57
65
|
valueColor?: ValueColor;
|
|
58
66
|
unit?: Unit;
|
|
59
|
-
precision?:
|
|
67
|
+
precision?: Decimals;
|
|
68
|
+
multiChart?: MultiChart;
|
|
69
|
+
value?: Value;
|
|
60
70
|
data?: Data;
|
|
61
71
|
sections?: GaugeColorSections;
|
|
62
72
|
advanced?: AdvancedConfiguration;
|
|
@@ -39,17 +39,38 @@
|
|
|
39
39
|
"order": 3
|
|
40
40
|
},
|
|
41
41
|
"precision": {
|
|
42
|
-
"title": "
|
|
42
|
+
"title": "Decimals",
|
|
43
43
|
"description": "The number of decimal places to show in the value. If not specified, precision is 0.",
|
|
44
44
|
"type": "number",
|
|
45
|
-
"dataDrivenDisabled":
|
|
45
|
+
"dataDrivenDisabled": true,
|
|
46
46
|
"order": 4
|
|
47
47
|
},
|
|
48
|
+
"multiChart": {
|
|
49
|
+
"title": "Multi Chart",
|
|
50
|
+
"description": "Draw multiple Charts based on the split column of a data table.",
|
|
51
|
+
"type": "boolean",
|
|
52
|
+
"dataDrivenDisabled": true,
|
|
53
|
+
"order": 6
|
|
54
|
+
},
|
|
55
|
+
"value": {
|
|
56
|
+
"title": "Value",
|
|
57
|
+
"description": "The value of the gauge",
|
|
58
|
+
"type": "number",
|
|
59
|
+
"condition": {
|
|
60
|
+
"relativePath": "../multiChart",
|
|
61
|
+
"showIfValueIn": [false]
|
|
62
|
+
},
|
|
63
|
+
"order": 5
|
|
64
|
+
},
|
|
48
65
|
"data": {
|
|
49
66
|
"title": "Data",
|
|
50
67
|
"description": "Provide a list of values. Only the latest value is shown in the gauge unless you configure \"Advanced Settings\" below or use split data.",
|
|
51
68
|
"type": "array",
|
|
52
|
-
"
|
|
69
|
+
"condition": {
|
|
70
|
+
"relativePath": "../multiChart",
|
|
71
|
+
"showIfValueIn": [true]
|
|
72
|
+
},
|
|
73
|
+
"order": 7,
|
|
53
74
|
"items": {
|
|
54
75
|
"type": "object",
|
|
55
76
|
"properties": {
|
|
@@ -78,7 +99,7 @@
|
|
|
78
99
|
"title": "Gauge Color Sections",
|
|
79
100
|
"description": "",
|
|
80
101
|
"type": "object",
|
|
81
|
-
"order":
|
|
102
|
+
"order": 8,
|
|
82
103
|
"properties": {
|
|
83
104
|
"sectionLimits": {
|
|
84
105
|
"title": "Section Limits",
|
|
@@ -108,7 +129,7 @@
|
|
|
108
129
|
"title": "Advanced Configuration",
|
|
109
130
|
"description": "",
|
|
110
131
|
"type": "object",
|
|
111
|
-
"order":
|
|
132
|
+
"order": 9,
|
|
112
133
|
"properties": {
|
|
113
134
|
"averageLatest": {
|
|
114
135
|
"title": "Average Latest Values",
|
package/src/widget-gauge.ts
CHANGED
|
@@ -292,6 +292,8 @@ export class WidgetGauge extends LitElement {
|
|
|
292
292
|
advanced: ds.advanced,
|
|
293
293
|
valueColor: ds.valueColor,
|
|
294
294
|
sections: ds.sections,
|
|
295
|
+
multiChart: ds.multiChart,
|
|
296
|
+
value: ds.value,
|
|
295
297
|
data: distincts.length === 1 ? ds.data : ds?.data?.filter((d) => d.pivot === piv)
|
|
296
298
|
}
|
|
297
299
|
this.dataSets.push(pds)
|
|
@@ -317,10 +319,16 @@ export class WidgetGauge extends LitElement {
|
|
|
317
319
|
if (typeof ds.advanced?.averageLatest !== 'number' || isNaN(ds.advanced?.averageLatest))
|
|
318
320
|
ds.advanced.averageLatest = 1
|
|
319
321
|
const data = ds?.data?.slice(-ds.advanced?.averageLatest || -1) ?? []
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
322
|
+
console.log('multiChart', ds.multiChart)
|
|
323
|
+
if (!ds.multiChart) {
|
|
324
|
+
ds.needleValue = ds.value as number
|
|
325
|
+
} else {
|
|
326
|
+
const values = (data?.map((d) => d.value)?.filter((p) => p !== undefined) ?? []) as number[]
|
|
327
|
+
ds.needleValue = (values.reduce((p, c) => p + c, 0) / values.length) as number
|
|
328
|
+
}
|
|
329
|
+
ds.needleValue = isNaN(ds.needleValue as number)
|
|
330
|
+
? ds.sections?.sectionLimits?.[0]
|
|
331
|
+
: ds.needleValue
|
|
324
332
|
|
|
325
333
|
// The full range of the gauge
|
|
326
334
|
ds.range =
|