From ff188ee54ba4a3652dc2a6efaccd5d4d950251ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Wiedemann?= Date: Mon, 25 Jan 2021 17:45:31 +0000 Subject: [PATCH] fix: `bar` should be `column` --- .devcontainer/ui-lovelace.yaml | 13 ++++++------- README.md | 2 +- src/apexcharts-card.ts | 2 +- src/types-config-ti.ts | 2 +- src/types-config.ts | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.devcontainer/ui-lovelace.yaml b/.devcontainer/ui-lovelace.yaml index 660e65d..0c0b700 100644 --- a/.devcontainer/ui-lovelace.yaml +++ b/.devcontainer/ui-lovelace.yaml @@ -26,10 +26,10 @@ views: series: - entity: sensor.random_0_1000 name: test1 - type: bar + type: column - entity: sensor.random_0_1000 name: test2 - type: bar + type: column hours_to_show: 0.25 cache: true @@ -50,16 +50,15 @@ views: header: floating: true - - type: custom:apexcharts-card stacked: false series: - entity: sensor.random_0_1000 name: test1 - type: bar + type: column - entity: sensor.random_0_1000 name: test2 - type: bar + type: column hours_to_show: 0.25 cache: true - type: custom:apexcharts-card @@ -133,8 +132,8 @@ views: func: avg duration: 1h - entity: sensor.random0_100 - type: bar + type: column name: Outside Humidity group_by: func: avg - duration: 1h \ No newline at end of file + duration: 1h diff --git a/README.md b/README.md index 2912be4..7d09708 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ The card stricly validates all the options available (but not for the `apex_conf | ---- | :--: | :-----: | :---: | ----------- | | :white_check_mark: `entity` | string | | v1.0.0 | The `entity_id` of the sensor to display | | `name` | string | | v1.0.0 | Override the name of the entity | -| `type` | string | `line` | v1.0.0 | `line`, `area` or `bar` are supported for now | +| `type` | string | `line` | v1.0.0 | `line`, `area` or `column` are supported for now | | `curve` | string | `smooth` | v1.0.0 | `smooth` (nice curve), `straight` (direct line between points) or `stepline` (flat line until next point then straight up or down) | | `extend_to_end` | boolean | `true` | v1.0.0 | If the last data is older than the end time displayed on the graph, setting to true will extend the value until the end of the timeline. Only works for `line` and `area` types. | | `unit` | string | | v1.0.0 | Override the unit of the sensor | diff --git a/src/apexcharts-card.ts b/src/apexcharts-card.ts index f3f54a8..f2d4fea 100644 --- a/src/apexcharts-card.ts +++ b/src/apexcharts-card.ts @@ -250,7 +250,7 @@ class ChartsCard extends LitElement { const index = graph.index; return { data: - this._config?.series[index].extend_to_end && this._config?.series[index].type !== 'bar' + this._config?.series[index].extend_to_end && this._config?.series[index].type !== 'column' ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion [...graph.history, ...[[end.getTime(), graph.history.slice(-1)[0]![1]]]] : graph.history, diff --git a/src/types-config-ti.ts b/src/types-config-ti.ts index 71804ba..9ebbf54 100644 --- a/src/types-config-ti.ts +++ b/src/types-config-ti.ts @@ -21,7 +21,7 @@ export const ChartCardExternalConfig = t.iface([], { export const ChartCardSeriesExternalConfig = t.iface([], { "entity": "string", "name": t.opt("string"), - "type": t.opt(t.union(t.lit('line'), t.lit('bar'), t.lit('area'))), + "type": t.opt(t.union(t.lit('line'), t.lit('column'), t.lit('area'))), "curve": t.opt(t.union(t.lit('smooth'), t.lit('straight'), t.lit('stepline'))), "extend_to_end": t.opt("boolean"), "unit": t.opt("string"), diff --git a/src/types-config.ts b/src/types-config.ts index d7ab108..cba5b3e 100644 --- a/src/types-config.ts +++ b/src/types-config.ts @@ -16,7 +16,7 @@ export interface ChartCardExternalConfig { export interface ChartCardSeriesExternalConfig { entity: string; name?: string; - type?: 'line' | 'bar' | 'area'; + type?: 'line' | 'column' | 'area'; curve?: 'smooth' | 'straight' | 'stepline'; extend_to_end?: boolean; unit?: string;