@record-evolution/widget-linechart 1.6.6 → 1.6.8
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.8",
|
|
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
|
|
@@ -186,6 +184,7 @@ export class WidgetLinechart extends LitElement {
|
|
|
186
184
|
this.chartContainer = this.shadowRoot?.querySelector('.chart-container')
|
|
187
185
|
this.transformData()
|
|
188
186
|
this.applyData()
|
|
187
|
+
this.registerTheme(this.theme)
|
|
189
188
|
// Add ResizeObserver for chart container
|
|
190
189
|
if (this.chartContainer) {
|
|
191
190
|
this.resizeObserver = new ResizeObserver(() => {
|
|
@@ -198,9 +197,15 @@ export class WidgetLinechart extends LitElement {
|
|
|
198
197
|
}
|
|
199
198
|
|
|
200
199
|
registerTheme(theme?: Theme) {
|
|
200
|
+
const cssTextColor = getComputedStyle(this).getPropertyValue('--re-text-color').trim()
|
|
201
|
+
const cssBgColor = getComputedStyle(this).getPropertyValue('--re-background-color').trim()
|
|
202
|
+
this.themeBgColor = cssBgColor || this.theme?.theme_object?.backgroundColor
|
|
203
|
+
this.themeTitleColor = cssTextColor || this.theme?.theme_object?.title?.textStyle?.color
|
|
204
|
+
this.themeSubtitleColor =
|
|
205
|
+
cssTextColor || this.theme?.theme_object?.title?.subtextStyle?.color || this.themeTitleColor
|
|
206
|
+
|
|
201
207
|
if (!theme || !theme.theme_object || !theme.theme_name) return
|
|
202
208
|
|
|
203
|
-
console.log('Registering theme', theme)
|
|
204
209
|
echarts.registerTheme(theme.theme_name, theme.theme_object)
|
|
205
210
|
}
|
|
206
211
|
|
|
@@ -332,7 +337,7 @@ export class WidgetLinechart extends LitElement {
|
|
|
332
337
|
const oldOption: any = chart.echart?.getOption() ?? {}
|
|
333
338
|
const notMerge = oldOption.series?.length !== chart.series.length
|
|
334
339
|
chart.echart?.setOption(option, { notMerge })
|
|
335
|
-
chart.echart?.resize()
|
|
340
|
+
// chart.echart?.resize()
|
|
336
341
|
})
|
|
337
342
|
}
|
|
338
343
|
|
|
@@ -364,10 +369,7 @@ export class WidgetLinechart extends LitElement {
|
|
|
364
369
|
const newChart = echarts.init(newContainer, this.theme?.theme_name)
|
|
365
370
|
const chart = { echart: newChart, series: [] as SeriesOption[], element: newContainer }
|
|
366
371
|
this.canvasList.set(label, chart)
|
|
367
|
-
|
|
368
|
-
this.themeBgColor = newChart._theme?.backgroundColor
|
|
369
|
-
//@ts-ignore
|
|
370
|
-
this.themeColor = newChart._theme?.title?.textStyle?.color
|
|
372
|
+
|
|
371
373
|
return chart
|
|
372
374
|
}
|
|
373
375
|
|
|
@@ -382,7 +384,6 @@ export class WidgetLinechart extends LitElement {
|
|
|
382
384
|
static styles = css`
|
|
383
385
|
:host {
|
|
384
386
|
display: block;
|
|
385
|
-
color: var(--re-text-color, #000);
|
|
386
387
|
font-family: sans-serif;
|
|
387
388
|
box-sizing: border-box;
|
|
388
389
|
position: relative;
|
|
@@ -400,7 +401,6 @@ export class WidgetLinechart extends LitElement {
|
|
|
400
401
|
width: 100%;
|
|
401
402
|
padding: 16px;
|
|
402
403
|
box-sizing: border-box;
|
|
403
|
-
color: var(--re-text-color, #000);
|
|
404
404
|
gap: 12px;
|
|
405
405
|
}
|
|
406
406
|
|
|
@@ -449,7 +449,6 @@ export class WidgetLinechart extends LitElement {
|
|
|
449
449
|
|
|
450
450
|
.no-data {
|
|
451
451
|
font-size: 20px;
|
|
452
|
-
color: var(--re-text-color, #000);
|
|
453
452
|
display: flex;
|
|
454
453
|
height: 100%;
|
|
455
454
|
width: 100%;
|
|
@@ -461,10 +460,19 @@ export class WidgetLinechart extends LitElement {
|
|
|
461
460
|
|
|
462
461
|
render() {
|
|
463
462
|
return html`
|
|
464
|
-
<div
|
|
463
|
+
<div
|
|
464
|
+
class="wrapper"
|
|
465
|
+
style="background-color: ${this.themeBgColor}; color: ${this.themeTitleColor}"
|
|
466
|
+
>
|
|
465
467
|
<header class="paging" ?active=${this.inputData?.title || this.inputData?.subTitle}>
|
|
466
468
|
<h3 class="paging" ?active=${this.inputData?.title}>${this.inputData?.title}</h3>
|
|
467
|
-
<p
|
|
469
|
+
<p
|
|
470
|
+
class="paging"
|
|
471
|
+
?active=${this.inputData?.subTitle}
|
|
472
|
+
style="color: ${this.themeSubtitleColor}"
|
|
473
|
+
>
|
|
474
|
+
${this.inputData?.subTitle}
|
|
475
|
+
</p>
|
|
468
476
|
</header>
|
|
469
477
|
<div class="paging no-data" ?active=${this.canvasList.size === 0}>No Data</div>
|
|
470
478
|
<div
|