I am reading data (time series of forecast) via a REST API. I put the data in an attribute to then display it in Apex-chart-card. However, it can happen (e.g. if I have stupidly exceeded my quota of requests) that this data is not available. Then, of course, the attribute cannot be filled with data. The old data is then also gone and the chart no longer shows anything. Ideally, the attribute would simply remain unchanged.
You can try to use availability but not sure if this works for attribs
Availability template - Configuration - Home Assistant Community (home-assistant.io)