Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Yevgenium committed Aug 28, 2021
1 parent ca05a89 commit 366ef1e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@ class WeatherChartCard extends LitElement {
config: {},
language: {},
sun: {type: Object},
iconSize: {type: Number},
weather: {type: Object},
temperature: {type: Object},
forecastChart: {type: Object},
forecastItems: {type: Number}
forecastItems: {type: Number},
iconSize: {type: Number}
};
}

setConfig(config) {
this.config = config;
if (!config.weather) {
throw new Error('Please, define "weather" entity in the card config');
};
this.config = config;
}

set hass(hass) {
this._hass = hass;
this.language = this._hass.selectedLanguage || this._hass.language;
this.language = hass.selectedLanguage || hass.language;
this.sun = 'sun.sun' in hass.states ? hass.states['sun.sun'] : null;
this.weather = this.config.weather in hass.states ? hass.states[this.config.weather] : null;
this.temperature = this.config.temp in hass.states ? hass.states[this.config.temp].state : null;
Expand Down Expand Up @@ -186,7 +186,7 @@ class WeatherChartCard extends LitElement {
categoryPercentage: 1.0,
datalabels: {
display: function(context) {
return context.dataset.data[context.dataIndex] !== 0 ? 'auto' : false;
return context.dataset.data[context.dataIndex] > 0 ? 'auto' : false;
},
formatter: function(value, context) {
if (context.dataset.data[context.dataIndex] > 9) {
Expand Down

0 comments on commit 366ef1e

Please sign in to comment.