Yevgenium / weather-chart-card

Custom weather card with charts
MIT License
275 stars 81 forks source link

HA 20212.7 No more Chart.... #59

Closed Mariusthvdb closed 3 years ago

Mariusthvdb commented 3 years ago

as HA changed its Charts, this is now no longer functional and showing the Chart card without Chart

Schermafbeelding 2021-07-02 om 09 55 50

error in inspector:

Cannot read property 'forEach' of undefined in:

          var meta = chartInstance.controller.getDatasetMeta(2);
            meta.data.forEach(function (bar, index) {
              var data = (Math.round((chartInstance.data.datasets[2].data[index]) * 10) / 10).toFixed(1);
              ctx.fillText(data, bar._model.x, bar._model.y - 5);
            });

called by: <ha-chart-base hass="[[_hass]]" data="[[ChartData]]"></ha-chart-base>

resource file in HA code: https://github.com/home-assistant/frontend/blob/dev/src/components/chart/ha-chart-base.ts

redwngsrul commented 3 years ago

Getting a different ERROR message in the log but seems to have the same result, i.e. no chart displayed.

Logger: frontend.js.latest.202107070
Source: components/system_log/__init__.py:190
First occurred: 11:18:00 PM (6 occurrences)
Last logged: 11:41:38 PM

https://[myHASS]/local/weather-card-chart.js:307:16 TypeError: this.weatherObj.attributes is undefined
:0:0 ResizeObserver loop completed with undelivered notifications.

image

Dreffi88 commented 3 years ago

The problem remains with core-2021.7.1.

Mariusthvdb commented 3 years ago

of course it does, why would you think updating HA fixed this? It is an issue in the custom card code for charts no longer being compatible with HA...

koying commented 3 years ago

Same here :( Will dig into it...

Mariusthvdb commented 3 years ago

See Bram's remark on what changed in Ha : https://discord.com/channels/330944238910963714/351047592588869643/863075287830757397

koying commented 3 years ago

See https://github.com/koying/lovelace-weather-card-chart/tree/chartjs3 for a working fix Please test, probably still some issues to be fixed

tomlut commented 3 years ago

Working for me.

gopheridze commented 3 years ago

See https://github.com/koying/lovelace-weather-card-chart/tree/chartjs3 for a working fix Please test, probably still some issues to be fixed

Works in Chrome, but doesn't in Safari

tomlut commented 3 years ago

FYI I'm using Firefox.

Dreffi88 commented 3 years ago

For me it is working in Safari (iOS and MacOS).

fancygaphtrn commented 3 years ago

I updated my fork to support HA 2021-7-6.
https://github.com/fancygaphtrn/lovelace-weather-card-chart.

Mariusthvdb commented 3 years ago
Schermafbeelding 2021-07-12 om 00 20 51 Schermafbeelding 2021-07-12 om 00 22 19

working in Safari and Chrome.

magic, thanks @koying

hope you can fix the colors too..shall I keep open to await that.

btw, are you going to create a PR here, so its easier to spot the changes? had to check line by line in my own file, and that wasn't too easily done I must admit....

edit: this is better:

Schermafbeelding 2021-07-12 om 00 46 33
koying commented 3 years ago

Yeah, I couldn't understand how colors are "auto-assigned", so I hardcoded them. I still see an issue in that, with no precipitations, "0.0" is displayed while it wasn't before. image

But good enough for a PR, I guess

koying commented 3 years ago

PR created: https://github.com/Yevgenium/lovelace-weather-card-chart/pull/60