This example, using satirical data from The Onion, demonstrates how to wrap long axis labels to fit on multiple lines.
forked from mbostock's block: Wrapping Long Labels 2.0
forked from anonymous's block: Wrapping Long Labels 2.0
/* | |
* Copyright (c) 2010 Claudio Alberto Andreoni. | |
* Modifications by Eric Socolofsky: http://transmote.com. | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: |
// Check if a thing is rotated 90°. | |
function isRotatedOffAxis (rotation) { | |
return rotation % 180 !== 0; | |
} | |
// Hm, what about -180? | |
console.log(-180 % 180); // -0. wtf #a | |
// So then why is this ok? | |
isRotated(-180); // false |
├─┬ @panorama/toolkit@0.0.12 | |
│ ├── koto@0.1.3 | |
│ └─┬ topojson@1.6.19 | |
│ ├── d3-geo-projection@0.2.15 | |
│ ├─┬ optimist@0.3.7 | |
│ │ └── wordwrap@0.0.3 | |
│ ├── rw@0.1.4 | |
│ └─┬ shapefile@0.3.0 | |
│ └── iconv-lite@0.2.11 | |
├─┬ babel-eslint@4.1.3 |
This example, using satirical data from The Onion, demonstrates how to wrap long axis labels to fit on multiple lines.
forked from mbostock's block: Wrapping Long Labels 2.0
forked from anonymous's block: Wrapping Long Labels 2.0
// use of interpolator: | |
selection.transition() | |
.attrTween('d', areaGenerator) | |
// interpolator: | |
areaGenerator = function (d) { | |
// do I need a d3.interpolate call here, sim. to https://gist.github.com/mbostock/5100636#file-index-html-L66 ? | |
return function (t) { | |
return d3.svg.area() | |
.x(d => xScale(d.x)) |
This aster plot displays pie slices as lengths extending outward to the edge (0 at inner to 100 at outer). Widths of the pie slices represent the weight of each pie, which gets used to arrive at a weighted mean of the length scores in the center.
Jim Regetz @regetz developed the initial aster plot function in R (see aster-plot on github)
Parker Abercrombie @parkerabercrombie developed the initial D3 prototype varying 3 of the 4 arc elements starting with Mike Bostock's Donut Chart:
This example demonstrates the construction of a polar plot of a parametric function, sin(2t)cos(2t). A d3.svg.line.radial is used to draw the red line. Note the definition of the line’s angle: D3’s radial lines and areas proceed clockwise starting at 12 o’clock, while this plot proceeds counterclockwise starting at 3 o’clock!
forked from mbostock's block: Polar Plot
bgw-test-geojson ericsocolofsky$ rm -rf bluegreenway/ | |
bgw-test-geojson ericsocolofsky$ git clone git@github.com:stamen/bluegreenway.git | |
Cloning into 'bluegreenway'... | |
remote: Counting objects: 1399, done. | |
remote: Compressing objects: 100% (42/42), done. | |
remote: Total 1399 (delta 14), reused 0 (delta 0), pack-reused 1357 | |
Receiving objects: 100% (1399/1399), 43.02 MiB | 5.64 MiB/s, done. | |
Resolving deltas: 100% (891/891), done. | |
Checking connectivity... done. | |
bgw-test-geojson ericsocolofsky$ cd bluegreenway/ |
import leaflet from 'leaflet'; | |
// ... | |
patchMapTileGapBug(); | |
// ... | |
function patchMapTileGapBug () { | |
// Workaround for 1px lines appearing in some browsers due to fractional transforms | |
// and resulting anti-aliasing. adapted from @cmulders' solution: | |
// https://github.com/Leaflet/Leaflet/issues/3575#issuecomment-150544739 | |
let originalInitTile = leaflet.GridLayer.prototype._initTile; |
license: gpl-3.0 |