larsen / rando-planner

Clerk viewers and utils to plan bikepacking trips
https://rando-planner.stefanorodighiero.net/
4 stars 0 forks source link

Pauses representation in elevation diagrams and maps #37

Closed larsen closed 5 months ago

larsen commented 6 months ago
larsen commented 6 months ago

While I am at this, I think I need to address a problem with the function signatures so far.

Here the current "signature" for elevation-diagram

(defn elevation-diagram [{:keys [elevation daily-pauses from to
                                 average-speed
                                 daily-kilometers
                                 viewbox with-legend]}]

It's becoming too much. There are parameters (key parameters, but it's the same thing) that pertain to data needed for the diagram (elevation daily-pauses average-speed daily-kilometers) and others that are more parameters to control the visualization (from to viewbox with-legend).

Since I'm now making the visualization more rich, I think I could just pass the entire plan to the function, and compute the specific elements needed (like, daily-kilometers).

This would mean some functions would be called more than once in a typical notebook, so it poses the problem of caching.