Inspired by @severo and his histogram one-liner, I made a chloropeth (US county map) one-liner notebook:
It uses the awesome with
syntax for imports
. from Introduction to Imports / Observable / Observable
Inspired by @severo and his histogram one-liner, I made a chloropeth (US county map) one-liner notebook:
It uses the awesome with
syntax for imports
. from Introduction to Imports / Observable / Observable
Woah! I somehow missed that not only can you import {something as another_name}
, you can also reverse this as import {this_notebook_data as original_data}
[or am I hallucinating?]
If you are referring to the fact that you can use this_notebook’s data as the data when rendering the imported cell, then you are not hallucinating
So, import {chart as treemap} with {treemap_data as data} from "@d3/treemap"
would use the treemap_data from your notebook in place of the data in the imported notebook when rendering chart as treemap.
Although, I have to say that I love the importCell
method from this notebook very much… it imports and displays in a single cell.
I see your chart one-liner and raise you an app :
I like it. I don’t use Sankeys very much, unfortunately.
Note that this is an application with data-driven logic and UI as a function of the data passed to it. The pattern can be adopted for other applications.