Skip to content

Instantly share code, notes, and snippets.

Avatar

Niclas Darville ndarville

View GitHub Profile
@ndarville
ndarville / README.md
Last active Aug 29, 2015 — forked from mbostock/.block
Visualisering af statistisk usikkerhed i Megafon-måling 27/11-14
View README.md

Illustreret er Megafons sensationelle meningsmåling, der ikke viser, at DF er større end V og S; det er der ikke statistisk belæg for, fordi usikkerheden er for høj.

Hver søjle er opdelt i to:

  • Den minimale (garanterede) stemmeandel.
  • Den maksimale (mulige) stemmeandel.

Som det fremgår af søjlen, kan ethvert af de tre partier være størst!

For at kunne sige (med 95% sandsynlighed) at DF er størst, skulle DFs nederste søjle—dén, der viser den garanterede stemmeandel—rage højere end den (maksimalt) mulige stemmeandel for de to andre partier; det er tydeligvis ikke tilfældet.

View README.md

d3.legend

d3.legend is a quick hack to add a legend to a d3 chart. Simply add a g and .call(d3.legend). Any elements that have a title set in the "data-legend" attribute will be included when d3.legend is called. Each title will appear only once (even when multiple items define the same data-legend) as the process uses a set based on a existing names, not an array of all items.

Color

By default the color in the legend will try to match the fill attribute or the stroke attribute of the relevant items. Color can be explicitly defined by attribute "data-legend-color"

Order

The order of items in the legend will be sorted using the top of the bounding box for each included item. The order can be explicitly defined by attribute "data-legend-pos"

You can’t perform that action at this time.