acep-uaf / aetr-web-book-2024

Alaska Electricity Trends Report as a web book
https://acep-uaf.github.io/aetr-web-book-2024/
Creative Commons Attribution Share Alike 4.0 International
0 stars 0 forks source link

Ensure consistent legends and number formatting #2

Closed jikaczmarski closed 3 months ago

jikaczmarski commented 3 months ago

The reason that Observable JS treats our year variable as an integer and adds a comma is because the auto type import doesn't correctly parse the value as a year (it has no way to know that is true).

Proper Solution After importing the data, run a transformation to convert the year column of the data with a version of year: new Date(year,0,1). This is still a little outside my expertise but I'll get there.

Current Solution Format the display of the year values to actually be years in two places:

  1. On the x-axis with: x: {tickFormat: "d"}
  2. In the actual plot tip with tip: {format: {x: "d"}}

Along with this commit I changed the Prices graphs to use the Tip mark.