@record-evolution/widget-gauge 1.7.8 → 1.7.9
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 +9 -4
- package/dist/widget-gauge.js.map +1 -1
- package/package.json +1 -1
- package/src/default-data.json +17 -0
- package/src/widget-gauge.ts +10 -4
package/package.json
CHANGED
package/src/default-data.json
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dataseries": [
|
|
3
|
+
{
|
|
4
|
+
"label": "Demo Gauge Temperature",
|
|
5
|
+
"unit": "°C",
|
|
6
|
+
"precision": 1,
|
|
7
|
+
"data": [
|
|
8
|
+
{
|
|
9
|
+
"value": 83
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"sections": {
|
|
13
|
+
"sectionLimits": [],
|
|
14
|
+
"backgroundColors": []
|
|
15
|
+
},
|
|
16
|
+
"advanced": {
|
|
17
|
+
"averageLatest": 1
|
|
18
|
+
}
|
|
19
|
+
},
|
|
3
20
|
{
|
|
4
21
|
"label": "Demo Gauge Pascal",
|
|
5
22
|
"unit": "Pa",
|
package/src/widget-gauge.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html, css, LitElement, PropertyValueMap } from 'lit'
|
|
2
2
|
import { customElement, property, state } from 'lit/decorators.js'
|
|
3
|
-
import { GaugeChartConfiguration } from './definition-schema.js'
|
|
3
|
+
import { GaugeChartConfiguration, SectionBackgroundColors } from './definition-schema.js'
|
|
4
4
|
|
|
5
5
|
import * as echarts from 'echarts/core'
|
|
6
6
|
import { TooltipComponent } from 'echarts/components'
|
|
@@ -356,14 +356,20 @@ export class WidgetGauge extends LitElement {
|
|
|
356
356
|
// ga.pointer.itemStyle.color = ds.valueColor
|
|
357
357
|
|
|
358
358
|
// Axis
|
|
359
|
-
const sectionLimits = ds.sections?.sectionLimits
|
|
359
|
+
const sectionLimits = !ds.sections?.sectionLimits?.length
|
|
360
|
+
? [0, 40, 80, 100]
|
|
361
|
+
: ds.sections?.sectionLimits
|
|
360
362
|
ga2.min = sectionLimits?.length ? Math.min(...sectionLimits) : 0
|
|
361
363
|
ga2.max = sectionLimits?.length ? Math.max(...sectionLimits) : 100
|
|
362
364
|
ga.min = ga2.min
|
|
363
365
|
ga.max = ga2.max
|
|
364
366
|
|
|
365
|
-
const tcolors = this.theme?.theme_object?.color
|
|
366
|
-
const
|
|
367
|
+
const tcolors: SectionBackgroundColors = this.theme?.theme_object?.color
|
|
368
|
+
const bcolors: SectionBackgroundColors = !ds.sections?.backgroundColors?.length
|
|
369
|
+
? (tcolors?.slice(0, 3) ?? ['#bf444c', '#d88273', '#f6efa6'])
|
|
370
|
+
: ds.sections?.backgroundColors
|
|
371
|
+
|
|
372
|
+
const colors: SectionBackgroundColors = bcolors?.map(
|
|
367
373
|
(b, i) => b || tcolors[i % (tcolors?.length ?? 0)]
|
|
368
374
|
) ??
|
|
369
375
|
tcolors?.slice(0, 3) ?? ['#bf444c', '#d88273', '#f6efa6']
|