Skip to content

Commit

Permalink
fix: bar should be column
Browse files Browse the repository at this point in the history
  • Loading branch information
RomRider committed Jan 25, 2021
1 parent c5c2d73 commit ff188ee
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
13 changes: 6 additions & 7 deletions .devcontainer/ui-lovelace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
duration: 1h
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion src/apexcharts-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/types-config-ti.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
2 changes: 1 addition & 1 deletion src/types-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ff188ee

Please sign in to comment.