OSU-Sustainability-Office / energy-dashboard

Oregon State University's energy dashboard.
https://dashboard.sustainability.oregonstate.edu
GNU General Public License v3.0
11 stars 0 forks source link

Migrate vue2 to vue3 #346

Closed s-egge closed 1 month ago

s-egge commented 3 months ago

TODO

brandovlee commented 3 months ago

Before updating Vue-Chartjs from v3 to v4, there was a console error when attempting to display the graph: "Uncaught TypeError: createElement is not a function." This error occurs because Vue-Chartjs v3 does not support Vue3. Vue-Chartjs v4/v5 both support Vue3 so we'll have to upgrade. This article could be useful: Vue-Chartjs Migration Guide

s-egge commented 3 months ago

The chart is now visible, but has some pretty big formatting issues still. The chart on the small map view has a bug where the width keeps expanding and the canvas exceeds max size, but that seems like it's a map.vue issue and not a chart issue. image

Changes

We'll need to go through all of the chart options and update them to the new syntax as needed and fix the formatting options on the chart above. The Edit Block Modal is broken right now, so we can't test different time frames or multiple time periods until that's fixed

s-egge commented 3 months ago

ChartJS Linechart styling fixed (dev v. prod):

Firefox

image

Chrome

image

brandovlee commented 3 months ago

style-variables.scss changes

Before vs After

Screenshot 2025-01-11 at 3 18 48 PM

Issue The style-variables.scss file in the Energy Dashboard serves a dual purpose: it defines styling variables for global use while also overriding Element UI/Plus variables. The variables with leading hyphens (--) are specifically used to override Element UI/Plus default styles. Removing these hyphens caused the styles to revert to the default Element UI/Plus theme (blue), as shown in the screenshot.

Changes I broke up the variables into three groupings:

brandovlee commented 2 months ago

Some buildings seem to lack a name resulting in a blank tooltip when hovering on the map.

Key Things to Note:

brandovlee commented 2 months ago
image

Most documentations recommend not using $parent because it makes code less readable and harder to debug. Going forward we should consider removing references to $parent, and instead, use props. This is important to consider when transitioning the barchart.js into a vue component as it has similar characteristics to the linechart component.