@record-evolution/widget-linechart 1.6.4 → 1.6.5

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.4",
6
+ "version": "1.6.5",
7
7
  "type": "module",
8
8
  "main": "dist/widget-linechart.js",
9
9
  "types": "dist/src/widget-linechart.d.ts",
@@ -19,9 +19,7 @@
19
19
  "build": "rollup -c rollup.config.js",
20
20
  "watch": "rollup -w -c rollup.config.js",
21
21
  "types": "cat src/definition-schema.json | json2ts --style.tabWidth=4 > src/definition-schema.d.ts",
22
- "patch": "npm version patch --tag-version-prefix=''",
23
- "minor": "npm version minor --tag-version-prefix=''",
24
- "release": "npm run build && npm run types && git push && git push --tag"
22
+ "release": "npm run build && npm run types && npm version patch --tag-version-prefix='' && git push && git push --tag"
25
23
  },
26
24
  "dependencies": {
27
25
  "echarts": "5.6.0",
@@ -52,7 +52,7 @@ export type ChartName = string;
52
52
  * If timeseries is checked in the settings, then this should be an ISO String date like 2023-11-04T22:47:52.351152+00:00. But this works with many other formats as well.
53
53
  */
54
54
  export type XValue = string;
55
- export type YValue = number;
55
+ export type YValue = string;
56
56
  /**
57
57
  * Controls the symbol size for line and scatter charts.
58
58
  */
@@ -179,7 +179,7 @@
179
179
  },
180
180
  "y": {
181
181
  "title": "Y-Value",
182
- "type": "number",
182
+ "type": "string",
183
183
  "order": 2,
184
184
  "required": true
185
185
  },
@@ -270,9 +270,7 @@ export class WidgetLinechart extends LitElement {
270
270
  data: data2 ?? []
271
271
  }
272
272
  let chartName = ds.advanced?.chartName ?? ''
273
- if (chartName.includes('#split#')) {
274
- chartName = prefix + '-' + chartName
275
- }
273
+ chartName = chartName.replace('#split#', prefix)
276
274
 
277
275
  const chart = this.setupChart(chartName)
278
276
  chart?.series.push(pds)
@@ -298,6 +296,12 @@ export class WidgetLinechart extends LitElement {
298
296
  return 'category'
299
297
  }
300
298
 
299
+ yAxisType(): 'value' | 'log' | 'category' | undefined {
300
+ const onePoint = this.inputData?.dataseries?.[0]?.data?.[0]
301
+ if (!isNaN(Number(onePoint?.y))) return 'value'
302
+ return 'category'
303
+ }
304
+
301
305
  applyData() {
302
306
  const modifier = 1
303
307
 
@@ -317,6 +321,7 @@ export class WidgetLinechart extends LitElement {
317
321
  // option.xAxis.axisLine.lineStyle.width = 2 * modifier
318
322
  // option.xAxis.axisLabel.fontSize = 20 * modifier
319
323
  option.xAxis.type = this.xAxisType()
324
+ option.yAxis.type = this.yAxisType()
320
325
 
321
326
  option.yAxis.name = this.inputData?.axis?.yAxisLabel ?? ''
322
327
  // option.yAxis.axisLine.lineStyle.width = 2 * modifier
@@ -324,7 +329,7 @@ export class WidgetLinechart extends LitElement {
324
329
  option.yAxis.scale = this.inputData?.axis?.yAxisScaling ?? false
325
330
 
326
331
  option.series = chart.series
327
-
332
+ // console.log('Applying data to chart', label, option)
328
333
  if (chart.series.length <= 1) option.legend.show = false
329
334
  const oldOption: any = chart.echart?.getOption() ?? {}
330
335
  const notMerge = oldOption.series?.length !== chart.series.length