@ -10,7 +10,7 @@ try {
d3 _style _setProperty . call ( this , name , value + "" , priority ) ;
} ;
}
d3 = { version : "2.9. 2 "} ; // semver
d3 = { version : "2.9. 6 "} ; // semver
function d3 _class ( ctor , properties ) {
try {
for ( var key in properties ) {
@ -449,7 +449,7 @@ function d3_splitter(d) {
return d == null ;
}
function d3 _collapse ( s ) {
return s . replace ( / ( ^\s+) |( \s+$) /g, "" ) . replace ( /\s+/g , " " ) ;
return s . replace ( / ^\s+|\s+$/g, "" ) . replace ( /\s+/g , " " ) ;
}
d3 . range = function ( start , stop , step ) {
if ( arguments . length < 3 ) {
@ -494,7 +494,7 @@ d3.xhr = function(url, mime, callback) {
req . onreadystatechange = function ( ) {
if ( req . readyState === 4 ) {
var s = req . status ;
callback ( s >= 200 && s < 300 || s === 304 ? req : null ) ;
callback ( ! s && req . response || s >= 200 && s < 300 || s === 304 ? req : null ) ;
}
} ;
req . send ( null ) ;
@ -1035,6 +1035,7 @@ d3.interpolateTransform = function(a, b) {
}
if ( ra != rb ) {
if ( ra - rb > 180 ) rb += 360 ; else if ( rb - ra > 180 ) ra += 360 ; // shortest path
q . push ( { i : s . push ( s . pop ( ) + "rotate(" , null , ")" ) - 2 , x : d3 . interpolateNumber ( ra , rb ) } ) ;
} else if ( rb ) {
s . push ( s . pop ( ) + "rotate(" + rb + ")" ) ;
@ -1088,6 +1089,7 @@ d3.interpolateHsl = function(a, b) {
h1 = b . h - h0 ,
s1 = b . s - s0 ,
l1 = b . l - l0 ;
if ( h1 > 180 ) h1 -= 360 ; else if ( h1 < - 180 ) h1 += 360 ; // shortest path
return function ( t ) {
return d3 _hsl _rgb ( h0 + h1 * t , s0 + s1 * t , l0 + l1 * t ) . toString ( ) ;
} ;
@ -1515,7 +1517,7 @@ var d3_select = function(s, n) { return n.querySelector(s); },
// Prefer Sizzle, if available.
if ( typeof Sizzle === "function" ) {
d3 _select = function ( s , n ) { return Sizzle ( s , n ) [ 0 ] ; } ;
d3 _select = function ( s , n ) { return Sizzle ( s , n ) [ 0 ] || null ; } ;
d3 _selectAll = function ( s , n ) { return Sizzle . uniqueSort ( Sizzle ( s , n ) ) ; } ;
d3 _selectMatches = Sizzle . matchesSelector ;
}
@ -1626,7 +1628,7 @@ d3_selectionPrototype.attr = function(name, value) {
: ( name . local ? attrConstantNS : attrConstant ) ) ) ;
} ;
d3 _selectionPrototype . classed = function ( name , value ) {
var names = name. split ( d3 _selection _classedWhitespace ) ,
var names = d3_collapse ( name ) . split ( " " ) ,
n = names . length ,
i = - 1 ;
if ( arguments . length > 1 ) {
@ -1638,8 +1640,6 @@ d3_selectionPrototype.classed = function(name, value) {
}
} ;
var d3 _selection _classedWhitespace = /\s+/g ;
function d3 _selection _classed ( name , value ) {
var re = new RegExp ( "(^|\\s+)" + d3 . requote ( name ) + "(\\s+|$)" , "g" ) ;
@ -2011,14 +2011,19 @@ d3_selectionPrototype.on = function(type, listener, capture) {
} ) ;
} ;
d3 _selectionPrototype . each = function ( callback ) {
for ( var j = - 1 , m = this . length ; ++ j < m ; ) {
for ( var group = this [ j ] , i = - 1 , n = group . length ; ++ i < n ; ) {
var node = group [ i ] ;
if ( node ) callback . call ( node , node . _ _data _ _ , i , j ) ;
return d3 _selection _each ( this , function ( node , i , j ) {
callback . call ( node , node . _ _data _ _ , i , j ) ;
} ) ;
} ;
function d3 _selection _each ( groups , callback ) {
for ( var j = 0 , m = groups . length ; j < m ; j ++ ) {
for ( var group = groups [ j ] , i = 0 , n = group . length , node ; i < n ; i ++ ) {
if ( node = group [ i ] ) callback ( node , i , j ) ;
}
}
return this ;
} ;
return group s;
}
//
// Note: assigning to the arguments array simultaneously changes the value of
// the corresponding argument!
@ -2145,12 +2150,12 @@ function d3_transition(groups, id, time) {
} ;
d3 . timer ( function ( elapsed ) {
groups . each ( function ( d , i , j ) {
return d3 _selection _each ( groups , function ( node , i , j ) {
var tweened = [ ] ,
node = this ,
d elay = groups [ j ] [ i ] . delay ,
duration = groups [ j ] [ i ] . duration ,
lock = node . _ _transition _ _ || ( node . _ _transition _ _ = { active : 0 , count : 0 } ) ;
delay = node . delay ,
d uration = node . duration ,
lock = ( node = node . node ) . _ _transition _ _ || ( node . _ _transition _ _ = { active : 0 , count : 0 } ) ,
d = node . _ _data _ _ ;
++ lock . count ;
@ -2196,7 +2201,6 @@ function d3_transition(groups, id, time) {
return 1 ;
}
} ) ;
return 1 ;
} , 0 , time ) ;
return groups ;
@ -2341,16 +2345,14 @@ d3_transitionPrototype.remove = function() {
} ) ;
} ;
d3 _transitionPrototype . delay = function ( value ) {
var groups = this ;
return groups . each ( typeof value === "function"
? function ( d , i , j ) { groups [ j ] [ i ] . delay = value . apply ( this , arguments ) | 0 ; }
: ( value = value | 0 , function ( d , i , j ) { groups [ j ] [ i ] . delay = value ; } ) ) ;
return d3 _selection _each ( this , typeof value === "function"
? function ( node , i , j ) { node . delay = value . call ( node = node . node , node . _ _data _ _ , i , j ) | 0 ; }
: ( value = value | 0 , function ( node ) { node . delay = value ; } ) ) ;
} ;
d3 _transitionPrototype . duration = function ( value ) {
var groups = this ;
return groups . each ( typeof value === "function"
? function ( d , i , j ) { groups [ j ] [ i ] . duration = Math . max ( 1 , value . apply ( this , arguments ) | 0 ) ; }
: ( value = Math . max ( 1 , value | 0 ) , function ( d , i , j ) { groups [ j ] [ i ] . duration = value ; } ) ) ;
return d3 _selection _each ( this , typeof value === "function"
? function ( node , i , j ) { node . duration = Math . max ( 1 , value . call ( node = node . node , node . _ _data _ _ , i , j ) | 0 ) ; }
: ( value = Math . max ( 1 , value | 0 ) , function ( node ) { node . duration = value ; } ) ) ;
} ;
function d3 _transition _each ( callback ) {
var id = d3 _transitionId ,
@ -2360,16 +2362,11 @@ function d3_transition_each(callback) {
d3 _transitionId = this . id ;
d3 _transitionEase = this . ease ( ) ;
for ( var j = 0 , m = this . length ; j < m ; j ++ ) {
for ( var group = this [ j ] , i = 0 , n = group . length ; i < n ; i ++ ) {
var node = group [ i ] ;
if ( node ) {
d3 _transitionDelay = this [ j ] [ i ] . delay ;
d3 _transitionDuration = this [ j ] [ i ] . duration ;
callback . call ( node = node . node , node . _ _data _ _ , i , j ) ;
}
}
}
d3 _selection _each ( this , function ( node , i , j ) {
d3 _transitionDelay = node . delay ;
d3 _transitionDuration = node . duration ;
callback . call ( node = node . node , node . _ _data _ _ , i , j ) ;
} ) ;
d3 _transitionId = id ;
d3 _transitionEase = ease ;
@ -2813,11 +2810,11 @@ function d3_scale_log(linear, log) {
scale . tickFormat = function ( n , format ) {
if ( arguments . length < 2 ) format = d3 _scale _logFormat ;
if ( arguments . length < 1 ) return format ;
var k = n / scale . ticks ( ) . length ,
var k = Math . max ( . 1 , n / scale . ticks ( ) . length ) ,
f = log === d3 _scale _logn ? ( e = - 1e-12 , Math . floor ) : ( e = 1e-12 , Math . ceil ) ,
e ;
return function ( d ) {
return d / pow ( f ( log ( d ) + e ) ) < k ? format ( d ) : "" ;
return d / pow ( f ( log ( d ) + e ) ) < = k ? format ( d ) : "" ;
} ;
} ;
@ -3547,19 +3544,21 @@ function d3_svg_lineBasisClosed(points) {
}
function d3 _svg _lineBundle ( points , tension ) {
var n = points . length - 1 ,
x0 = points [ 0 ] [ 0 ] ,
y0 = points [ 0 ] [ 1 ] ,
dx = points [ n ] [ 0 ] - x0 ,
dy = points [ n ] [ 1 ] - y0 ,
i = - 1 ,
p ,
t ;
while ( ++ i <= n ) {
p = points [ i ] ;
t = i / n ;
p [ 0 ] = tension * p [ 0 ] + ( 1 - tension ) * ( x0 + t * dx ) ;
p [ 1 ] = tension * p [ 1 ] + ( 1 - tension ) * ( y0 + t * dy ) ;
var n = points . length - 1 ;
if ( n ) {
var x0 = points [ 0 ] [ 0 ] ,
y0 = points [ 0 ] [ 1 ] ,
dx = points [ n ] [ 0 ] - x0 ,
dy = points [ n ] [ 1 ] - y0 ,
i = - 1 ,
p ,
t ;
while ( ++ i <= n ) {
p = points [ i ] ;
t = i / n ;
p [ 0 ] = tension * p [ 0 ] + ( 1 - tension ) * ( x0 + t * dx ) ;
p [ 1 ] = tension * p [ 1 ] + ( 1 - tension ) * ( y0 + t * dy ) ;
}
}
return d3 _svg _lineBasis ( points ) ;
}
@ -4121,17 +4120,23 @@ d3.svg.axis = function() {
tickEnter . append ( "line" ) . attr ( "class" , "tick" ) ;
tickEnter . append ( "text" ) ;
tickUpdate . select ( "text" ) . text ( tickFormat ) ;
var lineEnter = tickEnter . select ( "line" ) ,
lineUpdate = tickUpdate . select ( "line" ) ,
text = tick . select ( "text" ) . text ( tickFormat ) ,
textEnter = tickEnter . select ( "text" ) ,
textUpdate = tickUpdate . select ( "text" ) ;
switch ( orient ) {
case "bottom" : {
tickTransform = d3 _svg _axisX ;
subtickEnter . attr ( "y2" , tickMinorSize ) ;
subtickUpdate . attr ( "x2" , 0 ) . attr ( "y2" , tickMinorSize ) ;
tickEnter . select ( "line" ) . attr ( "y2" , tickMajorSize ) ;
tickEnter . select ( "text" ) . attr ( "y" , Math . max ( tickMajorSize , 0 ) + tickPadding ) ;
tickUpdate . select ( "line" ) . attr ( "x2" , 0 ) . attr ( "y2" , tickMajorSize ) ;
tickUpdate . select ( "text" ) . attr ( "x" , 0 ) . attr ( "y" , Math . max ( tickMajorSize , 0 ) + tickPadding ) . attr ( "dy" , ".71em" ) . attr ( "text-anchor" , "middle" ) ;
lineEnter . attr ( "y2" , tickMajorSize ) ;
textEnter . attr ( "y" , Math . max ( tickMajorSize , 0 ) + tickPadding ) ;
lineUpdate . attr ( "x2" , 0 ) . attr ( "y2" , tickMajorSize ) ;
textUpdate . attr ( "x" , 0 ) . attr ( "y" , Math . max ( tickMajorSize , 0 ) + tickPadding ) ;
text . attr ( "dy" , ".71em" ) . attr ( "text-anchor" , "middle" ) ;
pathUpdate . attr ( "d" , "M" + range [ 0 ] + "," + tickEndSize + "V0H" + range [ 1 ] + "V" + tickEndSize ) ;
break ;
}
@ -4139,10 +4144,11 @@ d3.svg.axis = function() {
tickTransform = d3 _svg _axisX ;
subtickEnter . attr ( "y2" , - tickMinorSize ) ;
subtickUpdate . attr ( "x2" , 0 ) . attr ( "y2" , - tickMinorSize ) ;
tickEnter . select ( "line" ) . attr ( "y2" , - tickMajorSize ) ;
tickEnter . select ( "text" ) . attr ( "y" , - ( Math . max ( tickMajorSize , 0 ) + tickPadding ) ) ;
tickUpdate . select ( "line" ) . attr ( "x2" , 0 ) . attr ( "y2" , - tickMajorSize ) ;
tickUpdate . select ( "text" ) . attr ( "x" , 0 ) . attr ( "y" , - ( Math . max ( tickMajorSize , 0 ) + tickPadding ) ) . attr ( "dy" , "0em" ) . attr ( "text-anchor" , "middle" ) ;
lineEnter . attr ( "y2" , - tickMajorSize ) ;
textEnter . attr ( "y" , - ( Math . max ( tickMajorSize , 0 ) + tickPadding ) ) ;
lineUpdate . attr ( "x2" , 0 ) . attr ( "y2" , - tickMajorSize ) ;
textUpdate . attr ( "x" , 0 ) . attr ( "y" , - ( Math . max ( tickMajorSize , 0 ) + tickPadding ) ) ;
text . attr ( "dy" , "0em" ) . attr ( "text-anchor" , "middle" ) ;
pathUpdate . attr ( "d" , "M" + range [ 0 ] + "," + - tickEndSize + "V0H" + range [ 1 ] + "V" + - tickEndSize ) ;
break ;
}
@ -4150,10 +4156,11 @@ d3.svg.axis = function() {
tickTransform = d3 _svg _axisY ;
subtickEnter . attr ( "x2" , - tickMinorSize ) ;
subtickUpdate . attr ( "x2" , - tickMinorSize ) . attr ( "y2" , 0 ) ;
tickEnter . select ( "line" ) . attr ( "x2" , - tickMajorSize ) ;
tickEnter . select ( "text" ) . attr ( "x" , - ( Math . max ( tickMajorSize , 0 ) + tickPadding ) ) ;
tickUpdate . select ( "line" ) . attr ( "x2" , - tickMajorSize ) . attr ( "y2" , 0 ) ;
tickUpdate . select ( "text" ) . attr ( "x" , - ( Math . max ( tickMajorSize , 0 ) + tickPadding ) ) . attr ( "y" , 0 ) . attr ( "dy" , ".32em" ) . attr ( "text-anchor" , "end" ) ;
lineEnter . attr ( "x2" , - tickMajorSize ) ;
textEnter . attr ( "x" , - ( Math . max ( tickMajorSize , 0 ) + tickPadding ) ) ;
lineUpdate . attr ( "x2" , - tickMajorSize ) . attr ( "y2" , 0 ) ;
textUpdate . attr ( "x" , - ( Math . max ( tickMajorSize , 0 ) + tickPadding ) ) . attr ( "y" , 0 ) ;
text . attr ( "dy" , ".32em" ) . attr ( "text-anchor" , "end" ) ;
pathUpdate . attr ( "d" , "M" + - tickEndSize + "," + range [ 0 ] + "H0V" + range [ 1 ] + "H" + - tickEndSize ) ;
break ;
}
@ -4161,10 +4168,11 @@ d3.svg.axis = function() {
tickTransform = d3 _svg _axisY ;
subtickEnter . attr ( "x2" , tickMinorSize ) ;
subtickUpdate . attr ( "x2" , tickMinorSize ) . attr ( "y2" , 0 ) ;
tickEnter . select ( "line" ) . attr ( "x2" , tickMajorSize ) ;
tickEnter . select ( "text" ) . attr ( "x" , Math . max ( tickMajorSize , 0 ) + tickPadding ) ;
tickUpdate . select ( "line" ) . attr ( "x2" , tickMajorSize ) . attr ( "y2" , 0 ) ;
tickUpdate . select ( "text" ) . attr ( "x" , Math . max ( tickMajorSize , 0 ) + tickPadding ) . attr ( "y" , 0 ) . attr ( "dy" , ".32em" ) . attr ( "text-anchor" , "start" ) ;
lineEnter . attr ( "x2" , tickMajorSize ) ;
textEnter . attr ( "x" , Math . max ( tickMajorSize , 0 ) + tickPadding ) ;
lineUpdate . attr ( "x2" , tickMajorSize ) . attr ( "y2" , 0 ) ;
textUpdate . attr ( "x" , Math . max ( tickMajorSize , 0 ) + tickPadding ) . attr ( "y" , 0 ) ;
text . attr ( "dy" , ".32em" ) . attr ( "text-anchor" , "start" ) ;
pathUpdate . attr ( "d" , "M" + tickEndSize + "," + range [ 0 ] + "H0V" + range [ 1 ] + "H" + tickEndSize ) ;
break ;
}
@ -7277,13 +7285,15 @@ function d3_geo_type(types, defaultValue) {
d3 . geo . path = function ( ) {
var pointRadius = 4.5 ,
pointCircle = d3 _path _circle ( pointRadius ) ,
projection = d3 . geo . albersUsa ( ) ;
projection = d3 . geo . albersUsa ( ) ,
buffer = [ ] ;
function path ( d , i ) {
if ( typeof pointRadius === "function" ) {
pointCircle = d3 _path _circle ( pointRadius . apply ( this , arguments ) ) ;
}
return pathType ( d ) || null ;
if ( typeof pointRadius === "function" ) pointCircle = d3 _path _circle ( pointRadius . apply ( this , arguments ) ) ;
pathType ( d ) ;
var result = buffer . length ? buffer . join ( "" ) : null ;
buffer = [ ] ;
return result ;
}
function project ( coordinates ) {
@ -7293,44 +7303,38 @@ d3.geo.path = function() {
var pathType = d3 _geo _type ( {
FeatureCollection : function ( o ) {
var path = [ ] ,
features = o . features ,
var features = o . features ,
i = - 1 , // features.index
n = features . length ;
while ( ++ i < n ) path . push ( pathType ( features [ i ] . geometry ) ) ;
return path . join ( "" ) ;
while ( ++ i < n ) buffer . push ( pathType ( features [ i ] . geometry ) ) ;
} ,
Feature : function ( o ) {
return pathType ( o . geometry ) ;
pathType ( o . geometry ) ;
} ,
Point : function ( o ) {
return "M" + project ( o . coordinates ) + pointCircle ;
buffer . push ( "M" , project ( o . coordinates ) , pointCircle ) ;
} ,
MultiPoint : function ( o ) {
var path = [ ] ,
coordinates = o . coordinates ,
var coordinates = o . coordinates ,
i = - 1 , // coordinates.index
n = coordinates . length ;
while ( ++ i < n ) path . push ( "M" , project ( coordinates [ i ] ) , pointCircle ) ;
return path . join ( "" ) ;
while ( ++ i < n ) buffer . push ( "M" , project ( coordinates [ i ] ) , pointCircle ) ;
} ,
LineString : function ( o ) {
var path = [ "M" ] ,
coordinates = o . coordinates ,
var coordinates = o . coordinates ,
i = - 1 , // coordinates.index
n = coordinates . length ;
while ( ++ i < n ) path . push ( project ( coordinates [ i ] ) , "L ") ;
path . pop ( ) ;
return path . join ( "" ) ;
buffer . push ( "M ") ;
while ( ++ i < n ) buffer . push ( project ( coordinates [ i ] ) , "L" ) ;
buffer . pop ( ) ;
} ,
MultiLineString : function ( o ) {
var path = [ ] ,
coordinates = o . coordinates ,
var coordinates = o . coordinates ,
i = - 1 , // coordinates.index
n = coordinates . length ,
subcoordinates , // coordinates[i]
@ -7340,16 +7344,14 @@ d3.geo.path = function() {
subcoordinates = coordinates [ i ] ;
j = - 1 ;
m = subcoordinates . length ;
path . push ( "M" ) ;
while ( ++ j < m ) path . push ( project ( subcoordinates [ j ] ) , "L" ) ;
path . pop ( ) ;
buffer . push ( "M" ) ;
while ( ++ j < m ) buffer . push ( project ( subcoordinates [ j ] ) , "L" ) ;
buffer . pop ( ) ;
}
return path . join ( "" ) ;
} ,
Polygon : function ( o ) {
var path = [ ] ,
coordinates = o . coordinates ,
var coordinates = o . coordinates ,
i = - 1 , // coordinates.index
n = coordinates . length ,
subcoordinates , // coordinates[i]
@ -7359,17 +7361,15 @@ d3.geo.path = function() {
subcoordinates = coordinates [ i ] ;
j = - 1 ;
if ( ( m = subcoordinates . length - 1 ) > 0 ) {
path . push ( "M" ) ;
while ( ++ j < m ) path . push ( project ( subcoordinates [ j ] ) , "L" ) ;
path[ path . length - 1 ] = "Z" ;
buffer . push ( "M" ) ;
while ( ++ j < m ) buffer . push ( project ( subcoordinates [ j ] ) , "L" ) ;
buffer[ buffer . length - 1 ] = "Z" ;
}
}
return path . join ( "" ) ;
} ,
MultiPolygon : function ( o ) {
var path = [ ] ,
coordinates = o . coordinates ,
var coordinates = o . coordinates ,
i = - 1 , // coordinates index
n = coordinates . length ,
subcoordinates , // coordinates[i]
@ -7386,22 +7386,19 @@ d3.geo.path = function() {
subsubcoordinates = subcoordinates [ j ] ;
k = - 1 ;
if ( ( p = subsubcoordinates . length - 1 ) > 0 ) {
path . push ( "M" ) ;
while ( ++ k < p ) path . push ( project ( subsubcoordinates [ k ] ) , "L" ) ;
path[ path . length - 1 ] = "Z" ;
buffer . push ( "M" ) ;
while ( ++ k < p ) buffer . push ( project ( subsubcoordinates [ k ] ) , "L" ) ;
buffer[ buffer . length - 1 ] = "Z" ;
}
}
}
return path . join ( "" ) ;
} ,
GeometryCollection : function ( o ) {
var path = [ ] ,
geometries = o . geometries ,
var geometries = o . geometries ,
i = - 1 , // geometries index
n = geometries . length ;
while ( ++ i < n ) path . push ( pathType ( geometries [ i ] ) ) ;
return path . join ( "" ) ;
while ( ++ i < n ) buffer . push ( pathType ( geometries [ i ] ) ) ;
}
} ) ;
@ -7627,7 +7624,7 @@ d3.geo.circle = function() {
var origin = [ 0 , 0 ] ,
degrees = 90 - 1e-2 ,
radians = degrees * d3 _geo _radians ,
arc = d3 . geo . greatArc ( ) . target( d3 _identity ) ;
arc = d3 . geo . greatArc ( ) . source( origin ) . target( d3 _identity ) ;
function circle ( ) {
// TODO render a circle as a Polygon
@ -7638,8 +7635,8 @@ d3.geo.circle = function() {
}
circle . clip = function ( d ) {
arc . source ( typeof origin === "function" ? origin . apply ( this , arguments ) : origin ) ;
return clipType ( d ) ;
if ( typeof origin === "function" ) arc . source ( origin . apply ( this , arguments ) ) ;
return clipType ( d ) || null ;
} ;
var clipType = d3 _geo _type ( {
@ -7719,9 +7716,11 @@ d3.geo.circle = function() {
d0 = d1 ;
}
if ( p1 && clipped . length ) {
d1 = arc . distance ( p2 = clipped [ 0 ] ) ;
clipped . push ( d3 _geo _greatArcInterpolate ( p1 , p2 ) ( ( d0 - radians ) / ( d0 - d1 ) ) ) ;
// Close the clipped polygon if necessary.
p0 = coordinates [ 0 ] ;
p1 = clipped [ 0 ] ;
if ( p1 && p2 [ 0 ] === p0 [ 0 ] && p2 [ 1 ] === p0 [ 1 ] && ! ( p2 [ 0 ] === p1 [ 0 ] && p2 [ 1 ] === p1 [ 1 ] ) ) {
clipped . push ( p1 ) ;
}
return resample ( clipped ) ;
@ -7749,6 +7748,7 @@ d3.geo.circle = function() {
circle . origin = function ( x ) {
if ( ! arguments . length ) return origin ;
origin = x ;
if ( typeof origin !== "function" ) arc . source ( origin ) ;
return circle ;
} ;
@ -7758,58 +7758,49 @@ d3.geo.circle = function() {
return circle ;
} ;
// Precision is specified in degrees.
circle . precision = function ( x ) {
if ( ! arguments . length ) return arc . precision ( ) ;
arc . precision ( x ) ;
return circle ;
} ;
return circle ;
return d3 . rebind ( circle , arc , "precision" ) ;
}
d3 . geo . greatArc = function ( ) {
var source = d3 _geo _greatArcSource ,
target = d3 _geo _greatArcTarget ,
precision = 6 * d3 _geo _radians ;
var source = d3 _geo _greatArcSource , p0 ,
target = d3 _geo _greatArcTarget , p1 ,
precision = 6 * d3 _geo _radians ,
interpolate = d3 _geo _greatArcInterpolator ( ) ;
function greatArc ( ) {
var a = typeof source === "function" ? source . apply ( this , arguments ) : source ,
b = typeof target === "function" ? target . apply ( this , arguments ) : target ,
i = d3 _geo _greatArcInterpolate ( a , b ) ,
dt = precision / i . d ,
var d = greatArc . distance . apply ( this , arguments ) , // initializes the interpolator, too
t = 0 ,
coordinates = [ a ] ;
while ( ( t += dt ) < 1 ) coordinates . push ( i ( t ) ) ;
coordinates . push ( b ) ;
return {
type : "LineString" ,
coordinates : coordinates
} ;
dt = precision / d ,
coordinates = [ p0 ] ;
while ( ( t += dt ) < 1 ) coordinates . push ( interpolate ( t ) ) ;
coordinates . push ( p1 ) ;
return { type : "LineString" , coordinates : coordinates } ;
}
// Length returned in radians; multiply by radius for distance.
greatArc . distance = function ( ) {
var a = typeof source === "function" ? source . apply ( this , arguments ) : source ,
b = typeof target === "function" ? target . apply ( this , arguments ) : target ;
return d3 _geo _greatArcInterpolate ( a , b ) . d ;
if ( typeof source === "function" ) interpolate . source ( p0 = source . apply ( this , arguments ) ) ;
if ( typeof target === "function" ) interpolate . target ( p1 = target . apply ( this , arguments ) ) ;
return interpolate . distance ( ) ;
} ;
greatArc . source = function ( x ) {
greatArc . source = function ( _ ) {
if ( ! arguments . length ) return source ;
source = x ;
source = _ ;
if ( typeof source !== "function" ) interpolate . source ( p0 = source ) ;
return greatArc ;
} ;
greatArc . target = function ( x ) {
greatArc . target = function ( _ ) {
if ( ! arguments . length ) return target ;
target = x ;
target = _ ;
if ( typeof target !== "function" ) interpolate . target ( p1 = target ) ;
return greatArc ;
} ;
// Precision is specified in degrees.
greatArc . precision = function ( x ) {
greatArc . precision = function ( _ ) {
if ( ! arguments . length ) return precision / d3 _geo _radians ;
precision = x * d3 _geo _radians ;
precision = _ * d3 _geo _radians ;
return greatArc ;
} ;
@ -7824,29 +7815,59 @@ function d3_geo_greatArcTarget(d) {
return d . target ;
}
function d3 _geo _greatArcInterpolate ( a , b ) {
var x0 = a [ 0 ] * d3 _geo _radians , cx0 = Math . cos ( x0 ) , sx0 = Math . sin ( x0 ) ,
y0 = a [ 1 ] * d3 _geo _radians , cy0 = Math . cos ( y0 ) , sy0 = Math . sin ( y0 ) ,
x1 = b [ 0 ] * d3 _geo _radians , cx1 = Math . cos ( x1 ) , sx1 = Math . sin ( x1 ) ,
y1 = b [ 1 ] * d3 _geo _radians , cy1 = Math . cos ( y1 ) , sy1 = Math . sin ( y1 ) ,
d = interpolate . d = Math . acos ( Math . max ( - 1 , Math . min ( 1 , sy0 * sy1 + cy0 * cy1 * Math . cos ( x1 - x0 ) ) ) ) ,
sd = Math . sin ( d ) ;
// From http://williams.best.vwh.net/avform.htm#Intermediate
function d3 _geo _greatArcInterpolator ( ) {
var x0 , y0 , cy0 , sy0 , kx0 , ky0 ,
x1 , y1 , cy1 , sy1 , kx1 , ky1 ,
d ,
k ;
function interpolate ( t ) {
var A = Math . sin ( d - ( t *= d ) ) / sd ,
B = Math . sin ( t ) / sd ,
x = A * cy0 * cx0 + B * cy1 * c x1,
y = A * cy0 * sx0 + B * cy1 * sx 1,
z = A * sy0 + B * sy1 ;
var B = Math . sin ( t *= d ) * k ,
A = Math . sin ( d - t ) * k ,
x = A * kx0 + B * k x1,
y = A * ky0 + B * ky 1,
z = A * sy0 + B * sy1 ;
return [
Math . atan2 ( y , x ) / d3 _geo _radians ,
Math . atan2 ( z , Math . sqrt ( x * x + y * y ) ) / d3 _geo _radians
] ;
}
interpolate . distance = function ( ) {
if ( d == null ) k = 1 / Math . sin ( d = Math . acos ( Math . max ( - 1 , Math . min ( 1 , sy0 * sy1 + cy0 * cy1 * Math . cos ( x1 - x0 ) ) ) ) ) ;
return d ;
} ;
interpolate . source = function ( _ ) {
var cx0 = Math . cos ( x0 = _ [ 0 ] * d3 _geo _radians ) ,
sx0 = Math . sin ( x0 ) ;
cy0 = Math . cos ( y0 = _ [ 1 ] * d3 _geo _radians ) ;
sy0 = Math . sin ( y0 ) ;
kx0 = cy0 * cx0 ;
ky0 = cy0 * sx0 ;
d = null ;
return interpolate ;
} ;
interpolate . target = function ( _ ) {
var cx1 = Math . cos ( x1 = _ [ 0 ] * d3 _geo _radians ) ,
sx1 = Math . sin ( x1 ) ;
cy1 = Math . cos ( y1 = _ [ 1 ] * d3 _geo _radians ) ;
sy1 = Math . sin ( y1 ) ;
kx1 = cy1 * cx1 ;
ky1 = cy1 * sx1 ;
d = null ;
return interpolate ;
} ;
return interpolate ;
}
function d3 _geo _greatArcInterpolate ( a , b ) {
var i = d3 _geo _greatArcInterpolator ( ) . source ( a ) . target ( b ) ;
i . distance ( ) ;
return i ;
}
d3 . geo . greatCircle = d3 . geo . circle ;
d3 . geom = { } ;
/ * *
@ -9035,7 +9056,8 @@ function d3_time_formatIsoNative(date) {
}
d3 _time _formatIsoNative . parse = function ( string ) {
return new Date ( string ) ;
var date = new Date ( string ) ;
return isNaN ( date ) ? null : date ;
} ;
d3 _time _formatIsoNative . toString = d3 _time _formatIso . toString ;
@ -9381,4 +9403,4 @@ d3_time_scaleUTCMethods.year = function(extent, m) {
d3 . time . scale . utc = function ( ) {
return d3 _time _scale ( d3 . scale . linear ( ) , d3 _time _scaleUTCMethods , d3 _time _scaleUTCFormat ) ;
} ;
} ) ( ) ;
} ) ( ) ;