@record-evolution/widget-gauge 1.7.13 → 1.7.14

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/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.13",
6
+ "version": "1.7.14",
7
7
  "type": "module",
8
8
  "main": "dist/widget-gauge.js",
9
9
  "types": "dist/src/widget-gauge.d.ts",
@@ -19,7 +19,7 @@
19
19
  "link": "npm run build && npm link && cd ../RESWARM/frontend && npm link @record-evolution/widget-gauge",
20
20
  "unlink": "npm unlink --global && cd ../RESWARM/frontend && npm unlink @record-evolution/widget-gauge && npm i @record-evolution/widget-gauge",
21
21
  "types": "cat src/definition-schema.json | json2ts --style.tabWidth=4 > src/definition-schema.d.ts",
22
- "release": "npm run build && npm run types && npm version patch --tag-version-prefix='' && git push && git push --tag"
22
+ "release": "npm run build && npm run types && npm version patch --tag-version-prefix='' && git push && git push --tag && npm run build"
23
23
  },
24
24
  "dependencies": {
25
25
  "echarts": "5.6.0",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "dataseries": [
3
3
  {
4
- "label": "Demo Gauge Temperature",
4
+ "label": "Temperature",
5
5
  "unit": "°C",
6
6
  "precision": 1,
7
7
  "data": [
@@ -16,15 +16,6 @@
16
16
  "advanced": {
17
17
  "averageLatest": 1
18
18
  }
19
- },
20
- {
21
- "label": "Demo Gauge Pascal",
22
- "unit": "Pa",
23
- "data": [
24
- {
25
- "value": 79
26
- }
27
- ]
28
19
  }
29
20
  ]
30
21
  }
@@ -89,8 +89,7 @@ export class WidgetGauge extends LitElement {
89
89
  detail: {
90
90
  valueAnimation: false,
91
91
  fontSize: 25,
92
- offsetCenter: [0, '-7%'],
93
- color: 'inherit'
92
+ offsetCenter: [0, '-7%']
94
93
  },
95
94
  title: {
96
95
  text: 'Gauge A',
@@ -209,10 +208,10 @@ export class WidgetGauge extends LitElement {
209
208
  Array.from(this?.shadowRoot?.querySelectorAll('.chart-wrapper') as NodeListOf<HTMLDivElement>) ??
210
209
  []
211
210
  if (!this.boxes.length) return
212
- this.origWidth =
213
- this.boxes?.map((b) => b.getBoundingClientRect().width).reduce((p, c) => (c > p ? c : p), 0) ?? 0
214
- this.origHeight =
215
- this.boxes?.map((b) => b.getBoundingClientRect().height).reduce((p, c) => (c > p ? c : p), 0) ?? 0
211
+ this.origWidth = 600
212
+ // this.boxes?.map((b) => b.getBoundingClientRect().width).reduce((p, c) => (c > p ? c : p), 0) ?? 0
213
+ this.origHeight = 230
214
+ // this.boxes?.map((b) => b.getBoundingClientRect().height).reduce((p, c) => (c > p ? c : p), 0) ?? 0
216
215
  }
217
216
 
218
217
  adjustSizes() {
@@ -346,12 +345,15 @@ export class WidgetGauge extends LitElement {
346
345
 
347
346
  ga.data[0].value = ds.needleValue
348
347
  ga.data[0].name = ds.unit
348
+ // unit style
349
349
  ga.title.fontSize = 20 * modifier
350
350
  ga.title.color = ds.valueColor ?? this.themeTitleColor
351
351
  ga.title.opacity = 1
352
+ // value style
352
353
  ga.detail.color = ds.valueColor ?? this.themeTitleColor
353
354
  ga.detail.opacity = 1
354
355
  ga.detail.fontSize = 40 * modifier
356
+
355
357
  ga.detail.formatter = (val: number) =>
356
358
  isNaN(val) ? '-' : val.toFixed(Math.floor(ds.precision ?? 0))
357
359
  // ga.anchor.itemStyle.color = ds.valueColor
@@ -401,7 +403,7 @@ export class WidgetGauge extends LitElement {
401
403
  }
402
404
  ga.progress.itemStyle.color = progressColor
403
405
  ga.progress.width = 60 * modifier
404
- // Apply
406
+
405
407
  const titleElement = this.canvasList.get(ds.label)?.title
406
408
  if (titleElement) {
407
409
  titleElement.style.fontSize = String(20 * modifier) + 'px'
@@ -410,6 +412,7 @@ export class WidgetGauge extends LitElement {
410
412
  titleElement.textContent = ds.label ?? ''
411
413
  }
412
414
 
415
+ // Apply
413
416
  echart?.setOption(option)
414
417
  }
415
418
  }