Newbie: select one group, find differences between it and others

I am just learning Observable (having participated in the super helpful online tutorial last week).
I’ve not used the types of programming being used here so would really appreciate some help or pointers to really newbie friendly guides.
My question today is:
Let’s say as an example I am looking at the energy data from the Observable example here: https://observablehq.com/d/d8bb9f3ca6fc57fb
I’d like a drop-down box where the user can select which type of energy to compare to (e.g. coal) and then to graph the differences between coal and each of the other energy types.
My brain would solve it in my usual programming language by

  1. reshaping the long data to wide so that each date has a column for each energy production type.
  2. subtracting the coal value from each of the others to create “difference” values
  3. going back to long format
  4. graphing the difference values

I’d love any help or pointers as I just don’t know where to start in this programming environment!
Thanks heaps,
Sim.

I can’t see your example, you need to share the notebook for others to see it.

Oh, I shared the wrong link, here’s the page I’m talking about:

I was using it as an example, for example, the third graph, rather than showing the line graphs of each type of energy production, showing line graphs of the difference between each type and (e.g.) coal.

Like the stacked chart shows?

I guess I don’t understand what you mean by difference. If that difference in relation to coal?

Yeah, so if you had a dropdown box to select one energy type, the graph would then show the difference between the selected energy type and the others (eg. select coal, show the values for solar - coal, wind - coal, gas - coal, hydro - coal…)