wa0x6e / cal-heatmap

Cal-Heatmap is a javascript charting library to create a time-series calendar heatmap
http://cal-heatmap.com
MIT License
2.69k stars 292 forks source link

fix: preserve data updates to fill() when called with an argument #393

Open terencehonles opened 9 months ago

terencehonles commented 9 months ago

This change preserves the provided data source when fill is called with an argument so that cal.fill(records); cal.jumpTo(...); does not reset or blank out the previously provided data.

terencehonles commented 9 months ago

I believe this is possibly an issue with the previous version of cal heatmap, since we have been setting the data source manually even after calling paint, but now that there's a fill method I expected this to preserve the data passed. It appears that this is not the case, and this change should be fine based on how other things use the fill function (without arguments).

This allows the example given https://cal-heatmap.com/docs/API/fill#usage to allow navigation after filling with a new data source (and not reverting to the previous data set on navigation), or how we are using this, to provide data records that cover the whole domain that will not need to be fetched per navigation.