Skip to content

Commit

Permalink
Add option to hide null values in header
Browse files Browse the repository at this point in the history
  • Loading branch information
TheHolyRoger committed Apr 24, 2023
1 parent 1b63c0f commit 8d91569
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/apexcharts-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ class ChartsCard extends LitElement {
return html`
<div id="header__states">
${this._config?.series.map((serie, index) => {
if (serie.show.in_header) {
if (serie.show.in_header && (serie.show.in_header != 'hide_null' || this._headerState?.[index] !== null)) {
return html`
<div
id="states__state"
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 @@ -110,7 +110,7 @@ export const ActionsConfig = t.iface([], {
export const ChartCardSeriesShowConfigExt = t.iface([], {
"as_duration": t.opt("ChartCardPrettyTime"),
"legend_value": t.opt("boolean"),
"in_header": t.opt(t.union("boolean", t.lit('raw'), t.lit('before_now'), t.lit('after_now'))),
"in_header": t.opt(t.union("boolean", t.lit('raw'), t.lit('before_now'), t.lit('after_now'), t.lit('hide_null'))),
"name_in_header": t.opt("boolean"),
"header_color_threshold": t.opt("boolean"),
"in_chart": t.opt("boolean"),
Expand Down
2 changes: 1 addition & 1 deletion src/types-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export interface ActionsConfig {
export interface ChartCardSeriesShowConfigExt {
as_duration?: ChartCardPrettyTime;
legend_value?: boolean;
in_header?: boolean | 'raw' | 'before_now' | 'after_now';
in_header?: boolean | 'raw' | 'before_now' | 'after_now' | 'hide_null';
name_in_header?: boolean;
header_color_threshold?: boolean;
in_chart?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface ChartCardSeriesConfig extends ChartCardSeriesExternalConfig {

export interface ChartCardSeriesShowConfig extends ChartCardSeriesShowConfigExt {
legend_value: boolean;
in_header: boolean | 'raw' | 'before_now' | 'after_now';
in_header: boolean | 'raw' | 'before_now' | 'after_now' | 'hide_null';
name_in_header: boolean;
in_chart: boolean;
offset_in_name: boolean;
Expand Down

0 comments on commit 8d91569

Please sign in to comment.