@record-evolution/widget-linechart 1.6.6 → 1.6.7
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": "Webcomponent widget-linechart following open-wc recommendations",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "widget-linechart",
|
|
6
|
-
"version": "1.6.
|
|
6
|
+
"version": "1.6.7",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/widget-linechart.js",
|
|
9
9
|
"types": "dist/src/widget-linechart.d.ts",
|
package/src/widget-linechart.ts
CHANGED
|
@@ -30,7 +30,7 @@ echarts.use([
|
|
|
30
30
|
])
|
|
31
31
|
|
|
32
32
|
import { InputData } from './definition-schema'
|
|
33
|
-
import { EChartsOption,
|
|
33
|
+
import { EChartsOption, SeriesOption } from 'echarts'
|
|
34
34
|
import { TitleOption } from 'echarts/types/dist/shared'
|
|
35
35
|
|
|
36
36
|
type Theme = {
|
|
@@ -51,11 +51,9 @@ export class WidgetLinechart extends LitElement {
|
|
|
51
51
|
{ echart?: echarts.ECharts; series: SeriesOption[]; doomed?: boolean; element?: HTMLDivElement }
|
|
52
52
|
> = new Map()
|
|
53
53
|
|
|
54
|
-
@state()
|
|
55
|
-
private
|
|
56
|
-
|
|
57
|
-
@state()
|
|
58
|
-
private themeColor?: string
|
|
54
|
+
@state() private themeBgColor?: string
|
|
55
|
+
@state() private themeTitleColor?: string
|
|
56
|
+
@state() private themeSubtitleColor?: string
|
|
59
57
|
|
|
60
58
|
boxes?: HTMLDivElement[]
|
|
61
59
|
origWidth: number = 0
|
|
@@ -202,6 +200,12 @@ export class WidgetLinechart extends LitElement {
|
|
|
202
200
|
|
|
203
201
|
console.log('Registering theme', theme)
|
|
204
202
|
echarts.registerTheme(theme.theme_name, theme.theme_object)
|
|
203
|
+
const cssTextColor = getComputedStyle(this).getPropertyValue('--re-text-color').trim()
|
|
204
|
+
const cssBgColor = getComputedStyle(this).getPropertyValue('--re-background-color').trim()
|
|
205
|
+
this.themeBgColor = cssBgColor || this.theme?.theme_object?.backgroundColor
|
|
206
|
+
this.themeTitleColor = cssTextColor || this.theme?.theme_object?.title?.textStyle?.color
|
|
207
|
+
this.themeSubtitleColor =
|
|
208
|
+
cssTextColor || this.theme?.theme_object?.title?.subtextStyle?.color || this.themeTitleColor
|
|
205
209
|
}
|
|
206
210
|
|
|
207
211
|
transformData() {
|
|
@@ -332,7 +336,7 @@ export class WidgetLinechart extends LitElement {
|
|
|
332
336
|
const oldOption: any = chart.echart?.getOption() ?? {}
|
|
333
337
|
const notMerge = oldOption.series?.length !== chart.series.length
|
|
334
338
|
chart.echart?.setOption(option, { notMerge })
|
|
335
|
-
chart.echart?.resize()
|
|
339
|
+
// chart.echart?.resize()
|
|
336
340
|
})
|
|
337
341
|
}
|
|
338
342
|
|
|
@@ -364,10 +368,7 @@ export class WidgetLinechart extends LitElement {
|
|
|
364
368
|
const newChart = echarts.init(newContainer, this.theme?.theme_name)
|
|
365
369
|
const chart = { echart: newChart, series: [] as SeriesOption[], element: newContainer }
|
|
366
370
|
this.canvasList.set(label, chart)
|
|
367
|
-
|
|
368
|
-
this.themeBgColor = newChart._theme?.backgroundColor
|
|
369
|
-
//@ts-ignore
|
|
370
|
-
this.themeColor = newChart._theme?.title?.textStyle?.color
|
|
371
|
+
|
|
371
372
|
return chart
|
|
372
373
|
}
|
|
373
374
|
|
|
@@ -382,7 +383,6 @@ export class WidgetLinechart extends LitElement {
|
|
|
382
383
|
static styles = css`
|
|
383
384
|
:host {
|
|
384
385
|
display: block;
|
|
385
|
-
color: var(--re-text-color, #000);
|
|
386
386
|
font-family: sans-serif;
|
|
387
387
|
box-sizing: border-box;
|
|
388
388
|
position: relative;
|
|
@@ -400,7 +400,6 @@ export class WidgetLinechart extends LitElement {
|
|
|
400
400
|
width: 100%;
|
|
401
401
|
padding: 16px;
|
|
402
402
|
box-sizing: border-box;
|
|
403
|
-
color: var(--re-text-color, #000);
|
|
404
403
|
gap: 12px;
|
|
405
404
|
}
|
|
406
405
|
|
|
@@ -449,7 +448,6 @@ export class WidgetLinechart extends LitElement {
|
|
|
449
448
|
|
|
450
449
|
.no-data {
|
|
451
450
|
font-size: 20px;
|
|
452
|
-
color: var(--re-text-color, #000);
|
|
453
451
|
display: flex;
|
|
454
452
|
height: 100%;
|
|
455
453
|
width: 100%;
|
|
@@ -461,10 +459,19 @@ export class WidgetLinechart extends LitElement {
|
|
|
461
459
|
|
|
462
460
|
render() {
|
|
463
461
|
return html`
|
|
464
|
-
<div
|
|
462
|
+
<div
|
|
463
|
+
class="wrapper"
|
|
464
|
+
style="background-color: ${this.themeBgColor}; color: ${this.themeTitleColor}"
|
|
465
|
+
>
|
|
465
466
|
<header class="paging" ?active=${this.inputData?.title || this.inputData?.subTitle}>
|
|
466
467
|
<h3 class="paging" ?active=${this.inputData?.title}>${this.inputData?.title}</h3>
|
|
467
|
-
<p
|
|
468
|
+
<p
|
|
469
|
+
class="paging"
|
|
470
|
+
?active=${this.inputData?.subTitle}
|
|
471
|
+
style="color: ${this.themeSubtitleColor}"
|
|
472
|
+
>
|
|
473
|
+
${this.inputData?.subTitle}
|
|
474
|
+
</p>
|
|
468
475
|
</header>
|
|
469
476
|
<div class="paging no-data" ?active=${this.canvasList.size === 0}>No Data</div>
|
|
470
477
|
<div
|