diff --git a/dist/weather-chart-card.js b/dist/weather-chart-card.js
index 5cad33d..06d228f 100644
--- a/dist/weather-chart-card.js
+++ b/dist/weather-chart-card.js
@@ -141,6 +141,7 @@ const locale = {
'tempHi': 'Temperature',
'tempLo': 'Temperature night',
'precip': 'Precipitations',
+ 'dewpoint': 'Dew Point',
'feelsLike': 'Feels like',
'units': {
'km/h': 'km/h',
@@ -1545,6 +1546,15 @@ class WeatherChartCardEditor extends s {
Show Wind Forecast
+
+ this._valueChanged(e, 'forecast.show_dew_point_forecast')}"
+ .checked="${forecastConfig.show_dew_point_forecast !== false}"
+ >
+
+
this._valueChanged(e, 'forecast.round_temp')}"
@@ -17833,6 +17843,7 @@ static getStubConfig(hass, unusedEntities, allEntities) {
show_wind_forecast: true,
condition_icons: true,
round_temp: false,
+ show_dew_point_forecast: false,
type: 'daily',
number_of_forecasts: '0',
disable_animation: false,
@@ -17883,9 +17894,11 @@ setConfig(config) {
temperature1_color: 'rgba(255, 152, 0, 1.0)',
temperature2_color: 'rgba(68, 115, 158, 1.0)',
precipitation_color: 'rgba(132, 209, 253, 1.0)',
+ dewpoint_color: 'blue',
condition_icons: true,
show_wind_forecast: true,
round_temp: false,
+ show_dew_point_forecast: false,
type: 'daily',
number_of_forecasts: '0',
'12hourformat': false,
@@ -18341,6 +18354,15 @@ drawChart({ config, language, weather, forecastItems } = this) {
offset: -10,
},
},
+ {
+ label: this.ll('dewpoint'),
+ type: 'line',
+ data: data.dewPoint,
+ yAxisID: 'DPAxis',
+ borderColor: config.forecast.dewpoint_color,
+ backgroundColor: config.forecast.dewpoint_color,
+ pointRadius: 1,
+ },
];
const chart_text_color = (config.forecast.chart_text_color === 'auto') ? textColor : config.forecast.chart_text_color;
@@ -18381,6 +18403,24 @@ drawChart({ config, language, weather, forecastItems } = this) {
lineHeight: 0.7,
},
};
+
+ datasets[3].datalabels = {
+ display: function (context) {
+ return 'auto';
+ },
+ formatter: function (value, context) {
+ return context.dataset.data[context.dataIndex] + '°';
+ },
+ align: 'bottom',
+ anchor: 'center',
+ backgroundColor: 'transparent',
+ borderColor: 'transparent',
+ color: config.forecast.chart_text_color,
+ font: {
+ size: parseInt(config.forecast.labels_font_size) + 1,
+ lineHeight: 0.7,
+ },
+ };
}
this.forecastChart = new Chart(ctx, {
@@ -18468,6 +18508,19 @@ drawChart({ config, language, weather, forecastItems } = this) {
display: false,
},
},
+ DPAxis: {
+ position: 'left',
+ beginAtZero: false,
+ suggestedMin: Math.min(...data.tempHigh, ...data.tempLow, ...data.dewPoint) - 5,
+ suggestedMax: Math.max(...data.tempHigh, ...data.tempLow, ...data.dewPoint) + 3,
+ grid: {
+ display: false,
+ drawTicks: false,
+ },
+ ticks: {
+ display: false,
+ },
+ },
},
plugins: {
legend: {
@@ -18525,10 +18578,12 @@ drawChart({ config, language, weather, forecastItems } = this) {
computeForecastData({ config, forecastItems } = this) {
var forecast = this.forecasts ? this.forecasts.slice(0, forecastItems) : [];
var roundTemp = config.forecast.round_temp == true;
+ var showDewpointForecast = config.forecast.show_dew_point_forecast == true;
var dateTime = [];
var tempHigh = [];
var tempLow = [];
var precip = [];
+ var dewPoint = [];
for (var i = 0; i < forecast.length; i++) {
var d = forecast[i];
@@ -18555,6 +18610,9 @@ computeForecastData({ config, forecastItems } = this) {
} else {
precip.push(d.precipitation);
}
+ if (showDewpointForecast && typeof d.dew_point !== 'undefined') {
+ dewPoint.push(d.dew_point);
+ }
}
return {
@@ -18563,6 +18621,7 @@ computeForecastData({ config, forecastItems } = this) {
tempHigh,
tempLow,
precip,
+ dewPoint,
}
}
@@ -18578,6 +18637,7 @@ updateChart({ forecasts, forecastChart } = this) {
forecastChart.data.datasets[0].data = data.tempHigh;
forecastChart.data.datasets[1].data = data.tempLow;
forecastChart.data.datasets[2].data = data.precip;
+ forecastChart.data.datasets[3].data = data.dewPoint;
forecastChart.update();
}
}
diff --git a/src/locale.js b/src/locale.js
index a421251..a7ff25f 100644
--- a/src/locale.js
+++ b/src/locale.js
@@ -139,6 +139,7 @@ const locale = {
'tempHi': 'Temperature',
'tempLo': 'Temperature night',
'precip': 'Precipitations',
+ 'dewpoint': 'Dew Point',
'feelsLike': 'Feels like',
'units': {
'km/h': 'km/h',
diff --git a/src/main.js b/src/main.js
index 59a1f34..aa6db7c 100644
--- a/src/main.js
+++ b/src/main.js
@@ -58,6 +58,7 @@ static getStubConfig(hass, unusedEntities, allEntities) {
show_wind_forecast: true,
condition_icons: true,
round_temp: false,
+ show_dew_point_forecast: false,
type: 'daily',
number_of_forecasts: '0',
disable_animation: false,
@@ -108,9 +109,11 @@ setConfig(config) {
temperature1_color: 'rgba(255, 152, 0, 1.0)',
temperature2_color: 'rgba(68, 115, 158, 1.0)',
precipitation_color: 'rgba(132, 209, 253, 1.0)',
+ dewpoint_color: 'blue',
condition_icons: true,
show_wind_forecast: true,
round_temp: false,
+ show_dew_point_forecast: false,
type: 'daily',
number_of_forecasts: '0',
'12hourformat': false,
@@ -566,6 +569,15 @@ drawChart({ config, language, weather, forecastItems } = this) {
offset: -10,
},
},
+ {
+ label: this.ll('dewpoint'),
+ type: 'line',
+ data: data.dewPoint,
+ yAxisID: 'DPAxis',
+ borderColor: config.forecast.dewpoint_color,
+ backgroundColor: config.forecast.dewpoint_color,
+ pointRadius: 1,
+ },
];
const chart_text_color = (config.forecast.chart_text_color === 'auto') ? textColor : config.forecast.chart_text_color;
@@ -606,6 +618,24 @@ drawChart({ config, language, weather, forecastItems } = this) {
lineHeight: 0.7,
},
};
+
+ datasets[3].datalabels = {
+ display: function (context) {
+ return 'auto';
+ },
+ formatter: function (value, context) {
+ return context.dataset.data[context.dataIndex] + '°';
+ },
+ align: 'bottom',
+ anchor: 'center',
+ backgroundColor: 'transparent',
+ borderColor: 'transparent',
+ color: config.forecast.chart_text_color,
+ font: {
+ size: parseInt(config.forecast.labels_font_size) + 1,
+ lineHeight: 0.7,
+ },
+ };
}
this.forecastChart = new Chart(ctx, {
@@ -693,6 +723,19 @@ drawChart({ config, language, weather, forecastItems } = this) {
display: false,
},
},
+ DPAxis: {
+ position: 'left',
+ beginAtZero: false,
+ suggestedMin: Math.min(...data.tempHigh, ...data.tempLow, ...data.dewPoint) - 5,
+ suggestedMax: Math.max(...data.tempHigh, ...data.tempLow, ...data.dewPoint) + 3,
+ grid: {
+ display: false,
+ drawTicks: false,
+ },
+ ticks: {
+ display: false,
+ },
+ },
},
plugins: {
legend: {
@@ -750,10 +793,12 @@ drawChart({ config, language, weather, forecastItems } = this) {
computeForecastData({ config, forecastItems } = this) {
var forecast = this.forecasts ? this.forecasts.slice(0, forecastItems) : [];
var roundTemp = config.forecast.round_temp == true;
+ var showDewpointForecast = config.forecast.show_dew_point_forecast == true;
var dateTime = [];
var tempHigh = [];
var tempLow = [];
var precip = [];
+ var dewPoint = [];
for (var i = 0; i < forecast.length; i++) {
var d = forecast[i];
@@ -780,6 +825,9 @@ computeForecastData({ config, forecastItems } = this) {
} else {
precip.push(d.precipitation);
}
+ if (showDewpointForecast && typeof d.dew_point !== 'undefined') {
+ dewPoint.push(d.dew_point);
+ }
}
return {
@@ -788,6 +836,7 @@ computeForecastData({ config, forecastItems } = this) {
tempHigh,
tempLow,
precip,
+ dewPoint,
}
}
@@ -803,6 +852,7 @@ updateChart({ forecasts, forecastChart } = this) {
forecastChart.data.datasets[0].data = data.tempHigh;
forecastChart.data.datasets[1].data = data.tempLow;
forecastChart.data.datasets[2].data = data.precip;
+ forecastChart.data.datasets[3].data = data.dewPoint;
forecastChart.update();
}
}
diff --git a/src/weather-chart-card-editor.js b/src/weather-chart-card-editor.js
index 267ac86..5799968 100644
--- a/src/weather-chart-card-editor.js
+++ b/src/weather-chart-card-editor.js
@@ -680,6 +680,15 @@ class WeatherChartCardEditor extends LitElement {
Show Wind Forecast
+
+ this._valueChanged(e, 'forecast.show_dew_point_forecast')}"
+ .checked="${forecastConfig.show_dew_point_forecast !== false}"
+ >
+
+
this._valueChanged(e, 'forecast.round_temp')}"