🏠 back to Observable

Chloropeth one-liner, AKA USA county map

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

3 Likes

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?]

1 Like

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 :slight_smile:

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.

2 Likes

Although, I have to say that I love the importCell method from this notebook very much… it imports and displays in a single cell.

4 Likes

I see your chart one-liner and raise you an app :slightly_smiling_face: :

1 Like

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.