All examples By author By category About

gallowayevan

Annotate US states with d3-annotation

Simeple example of using d3-annotation to annotate a map with state postal codes. There are a few ways to 'save' this map once you are done.

  1. Open the console (in Chrome) and enter makeAnnotations.json(). This will copy the annotation coordinates to your clipboard. You can then paste these into your code, replacing the dynamically created annotations, e.g.:
d3.annotation().type(d3.annotationLabel).annotations(newStaticAnnotations).editMode(true);
      ```
One caveat is that this will not save the 'disable' settings, so some states will show a connector when you would rather not see one. You can manually add these disable settings to the static annotation file, if you like.
2. You could use something like SVG Crowbar: https://nytimes.github.io/svg-crowbar/
3. You could just open the console and copy the outer html for the svg element.