@record-evolution/widget-linechart 1.6.5 → 1.6.6
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.6",
|
|
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
|
@@ -33,16 +33,17 @@ import { InputData } from './definition-schema'
|
|
|
33
33
|
import { EChartsOption, ScatterSeriesOption, SeriesOption } from 'echarts'
|
|
34
34
|
import { TitleOption } from 'echarts/types/dist/shared'
|
|
35
35
|
|
|
36
|
+
type Theme = {
|
|
37
|
+
theme_name: string
|
|
38
|
+
theme_object: any
|
|
39
|
+
}
|
|
36
40
|
@customElement('widget-linechart-versionplaceholder')
|
|
37
41
|
export class WidgetLinechart extends LitElement {
|
|
38
42
|
@property({ type: Object })
|
|
39
43
|
inputData?: InputData
|
|
40
44
|
|
|
41
45
|
@property({ type: Object })
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
@property({ type: String })
|
|
45
|
-
themeName?: string
|
|
46
|
+
theme?: Theme
|
|
46
47
|
|
|
47
48
|
@state()
|
|
48
49
|
private canvasList: Map<
|
|
@@ -172,12 +173,8 @@ export class WidgetLinechart extends LitElement {
|
|
|
172
173
|
this.applyData()
|
|
173
174
|
}
|
|
174
175
|
|
|
175
|
-
if (changedProperties.has('
|
|
176
|
-
this.registerTheme(this.
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (changedProperties.has('themeName')) {
|
|
180
|
-
this.registerTheme(this.themeName, this.themeObject)
|
|
176
|
+
if (changedProperties.has('theme')) {
|
|
177
|
+
this.registerTheme(this.theme)
|
|
181
178
|
this.deleteCharts()
|
|
182
179
|
this.transformData()
|
|
183
180
|
this.applyData()
|
|
@@ -200,10 +197,11 @@ export class WidgetLinechart extends LitElement {
|
|
|
200
197
|
}
|
|
201
198
|
}
|
|
202
199
|
|
|
203
|
-
registerTheme(
|
|
204
|
-
if (!
|
|
200
|
+
registerTheme(theme?: Theme) {
|
|
201
|
+
if (!theme || !theme.theme_object || !theme.theme_name) return
|
|
205
202
|
|
|
206
|
-
|
|
203
|
+
console.log('Registering theme', theme)
|
|
204
|
+
echarts.registerTheme(theme.theme_name, theme.theme_object)
|
|
207
205
|
}
|
|
208
206
|
|
|
209
207
|
transformData() {
|
|
@@ -363,7 +361,7 @@ export class WidgetLinechart extends LitElement {
|
|
|
363
361
|
newContainer.setAttribute('class', 'sizer')
|
|
364
362
|
this.chartContainer.appendChild(newContainer)
|
|
365
363
|
|
|
366
|
-
const newChart = echarts.init(newContainer, this.
|
|
364
|
+
const newChart = echarts.init(newContainer, this.theme?.theme_name)
|
|
367
365
|
const chart = { echart: newChart, series: [] as SeriesOption[], element: newContainer }
|
|
368
366
|
this.canvasList.set(label, chart)
|
|
369
367
|
//@ts-ignore
|