Open s-egge opened 6 months ago
Another approach (for accumulated_real points, Memorial Union shown below)
Mark gaps in data as just "zero" datapoints (so technically no gaps). Doesn't seems supported on energy_change for the moment, not sure why.
For "x axis labels at regular intervals regardless of if there is data there", see chartJS documentation maybe?
After speaking with Brandon and Lety about this, they're not too concerned about fixing it since we now look for missing data and upload it. I'm leaving it open as it could still happen with other data and also with historical data that's missing, but lowering the priority. It could be a good issue to solve while getting familiar with the front-end/chart.js.
The x-axis tick labels are too close together, see this chart for example: https://dashboard.sustainability.oregonstate.edu/#/building/79/2
The spacing issue happens when the page gets wide enough to transition from angled labels to non-angled labels. Needs more testing, but it seems like it's only happening to charts that have missing days of data. This is possibly due to Chart.js calculating how much space the labels need based on how many ticks are actually showing up, not how many should be showing up, and expecting them to be more spaced out than they are.
For example, the following chart has no missing data and making it any smaller transitions it to angled labels without any overlap before-hand:
Potential fix
I haven't tested this, but a potential fix might be adding a callback function here to see if there are missing labels and calculating the
autoskippadding
based on that to force it to transition to angled labels sooner: https://github.com/OSU-Sustainability-Office/energy-dashboard/blob/master/src/components/charts/linechart.js#L141 See Chart.js documentation for more info on how theautoSkipPadding
and general axis options work: https://www.chartjs.org/docs/latest/axes/cartesian/