mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-09 10:26:35 +00:00
Multiple weather card graphs (#181)
* Set different id for each weather card * Style fixes * Changed id interpolation * Use same function both for generating and finding chart id * Fix line too long
This commit is contained in:
parent
26c7cc38ca
commit
fa68419f77
@ -21,7 +21,7 @@
|
||||
<google-legacy-loader on-api-load='googleApiLoaded'></google-legacy-loader>
|
||||
<ha-card header='[[computeTitle(stateObj)]]'>
|
||||
<div class='content'>
|
||||
<div id='chart_area'></div>
|
||||
<div id$='[[computeChartId(stateObj)]]'></div>
|
||||
<ha-attributes state-obj='[[stateObj]]' extra-filters='forecast'></ha-attributes>
|
||||
</div>
|
||||
</ha-card>
|
||||
@ -50,6 +50,10 @@
|
||||
return stateObj.attributes.friendly_name;
|
||||
},
|
||||
|
||||
computeChartId: function (stateObj) {
|
||||
return 'chart_area_' + stateObj.id;
|
||||
},
|
||||
|
||||
getDataArray: function () {
|
||||
var dataArray = [];
|
||||
var data = this.stateObj.attributes.forecast;
|
||||
@ -79,7 +83,8 @@
|
||||
}
|
||||
|
||||
if (!this.chartEngine) {
|
||||
this.chartEngine = new window.google.visualization.LineChart(document.getElementById('chart_area'));
|
||||
this.chartEngine = new window.google.visualization.LineChart(
|
||||
document.getElementById(this.computeChartId(this.stateObj)));
|
||||
}
|
||||
|
||||
this.drawChart();
|
||||
|
Loading…
x
Reference in New Issue
Block a user