Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use georeferencer MrSID data

  • Loading branch information...
commit 90bc9984465be4c0ba99768c07d982ccd15888f8 1 parent e3b7050
@jasondavies authored
View
17 data/convert_csv.py
@@ -0,0 +1,17 @@
+#!/usr/bin/python
+
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
+varname = 'categories'
+name = 'georeferencer.csv'
+
+f = open(name, 'r')
+data = f.read()
+f.close()
+
+f = open('%s.js' % name, 'w+')
+f.write('var %s=%s' % (varname, json.dumps(data)))
+f.close()
View
1  data/georeferencer.csv.js
1 addition, 0 deletions not shown
View
36 index.html
@@ -2,7 +2,9 @@
<html>
<head>
<title>National Library of Scotland Maps Viewer</title>
- <script src="data/categories.js" type="text/javascript"></script>
+ <script src="data/georeferencer.csv.js" type="text/javascript"></script>
+ <script src="js/d3.min.js" type="text/javascript"></script>
+ <script src="js/d3.csv.min.js" type="text/javascript"></script>
<script src="js/polymaps.min.js" type="text/javascript"></script>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/jquery.base64.min.js" type="text/javascript"></script>
@@ -48,10 +50,14 @@
.copy {
color: #ccc;
}
+ #maps, #subgroup {
+ width: 300px;
+ }
</style>
</head>
<body>
<div id="menu">
+ <select id="subgroup"></select>
<select id="maps"></select>
</div>
<div id="map">
@@ -61,12 +67,28 @@
</div>
</div>
<script type="text/javascript">
- $.each(categories, function() {
- $.each(this.maps, function() {
- var map = this;
- var option = $('<option/>').attr('value', map.sid).text(map.name);
- $('#maps').append(option);
- });
+ var data = d3.csv.parse(categories);
+ var groups = {}, maps = {};
+ $.each(data, function() {
+ var map = this;
+ var option = $('<option/>').attr('value', map.sidfile).html(map.title);
+ $('#maps').append(option);
+ var group = groups[map.map_group_name];
+ if (!group) groups[map.map_group_name] = group = [];
+ group.push(map.sidfile);
+ var groupMaps = maps[map.map_group_name];
+ if (!groupMaps) maps[map.map_group_name] = groupMaps = [];
+ groupMaps.push(option);
+ });
+ for (var group in groups) {
+ $('#subgroup').append($('<option/>').text(group))
+ }
+ $('#subgroup').change(function() {
+ $('#maps').empty();
+ groupMaps = maps[$(this).find('option:selected').text()];
+ for (var i=0; i<groupMaps.length; i++) {
+ $('#maps').append(groupMaps[i]);
+ }
});
$('#maps').change(function() {
location.hash = '#' + $(this).val();
View
2  js/d3.csv.min.js
@@ -0,0 +1,2 @@
+(function(){function m(a){return a.map(n).join(",")}function n(a){return/[",\n]/.test(a)?'"'+a.replace(/\"/g,'""')+'"':a}d3.csv=function(a,c){d3.text(a,"text/csv",function(d){c(d&&d3.csv.parse(d))})};d3.csv.parse=function(a){var c;return d3.csv.parseRows(a,function(d,j){if(j){for(var f={},g=-1,e=c.length;++g<e;)f[c[g]]=d[g];return f}else{c=d;return null}})};d3.csv.parseRows=function(a,c){function d(){if(e.lastIndex==a.length)return f;if(k){k=false;return j}var h=e.lastIndex;if(a.charCodeAt(h)==34){for(var b=
+h;b++<a.length;)if(a.charCodeAt(b)==34){if(a.charCodeAt(b+1)!=34)break;b++}if(a.charCodeAt(b+1)==10)k=true;e.lastIndex=b+2;return a.substring(h+1,b).replace(/""/g,'"')}if(b=e.exec(a)){if(b[0]=="\n")k=true;return a.substring(h,b.index)}e.lastIndex=a.length;return a.substring(h)}for(var j={},f={},g=[],e=/[,\n]/g,o=0,i,k;(i=d())!==f;){for(var l=[];i!==j&&i!==f;){l.push(i);i=d()}c&&!(l=c(l,o++))||g.push(l)}return g};d3.csv.format=function(a){return a.map(m).join("\n")}})();
View
56 js/d3.min.js
@@ -0,0 +1,56 @@
+(function(){function L(a){return Array.prototype.slice.call(a)}function w(a){return typeof a=="function"?a:function(){return a}}function ma(a){return a==null}function Z(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function $(a,b){b=L(arguments);b[0]=this;a.apply(this,b);return this}function na(){var a={},b=[];a.add=function(c){for(var f=0;f<b.length;f++)if(b[f].listener==c)return a;b.push({listener:c,on:true});return a};a.remove=function(c){for(var f=0;f<b.length;f++){var d=b[f];if(d.listener==
+c){d.on=false;b=b.slice(0,f).concat(b.slice(f+1));break}}return a};a.dispatch=function(){for(var c=b,f=0,d=c.length;f<d;f++){var e=c[f];e.on&&e.listener.apply(this,arguments)}};return a}function aa(a){return function(b){return 1-a(1-b)}}function ba(a){return function(b){return 0.5*(b<0.5?a(2*b):2-a(2-2*b))}}function oa(a){return a}function M(a){return function(b){return Math.pow(b,a)}}function pa(a){return 1-Math.cos(a*Math.PI/2)}function qa(a){return a?Math.pow(2,10*(a-1))-0.0010:0}function ra(a){return 1-
+Math.sqrt(1-a*a)}function sa(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375}function G(a,b,c){return{r:a,g:b,b:c,toString:ta}}function ta(){return"#"+N(this.r)+N(this.g)+N(this.b)}function N(a){return a<16?"0"+a.toString(16):a.toString(16)}function O(a,b,c){var f,d,e,h,g;if(h=/([a-z]+)\((.*)\)/i.exec(a)){g=h[2].split(",");switch(h[1]){case "hsl":return c(parseFloat(g[0]),parseFloat(g[1])/100,parseFloat(g[2])/
+100);case "rgb":return b(P(g[0]),P(g[1]),P(g[2]))}}if(c=F[a])return b(c.r,c.g,c.b);if(a==null)return b(0,0,0);if(a.charAt(0)=="#"){if(a.length==4){f=a.charAt(1);f+=f;d=a.charAt(2);d+=d;e=a.charAt(3);e+=e}else if(a.length==7){f=a.substring(1,3);d=a.substring(3,5);e=a.substring(5,7)}f=parseInt(f,16);d=parseInt(d,16);e=parseInt(e,16)}return b(f,d,e)}function ua(a,b,c){var f=Math.min(a/=255,b/=255,c/=255),d=Math.max(a,b,c),e=d-f,h=(d+f)/2;if(e){f=h<0.5?e/(d+f):e/(2-d-f);a=a==d?(b-c)/e+(b<c?6:0):b==d?
+(c-a)/e+2:(a-b)/e+4;a*=60}else f=a=0;return Q(a,f,h)}function P(a){var b=parseFloat(a);return a.charAt(a.length-1)=="%"?Math.round(b*2.55):b}function Q(a,b,c){return{h:a,s:b,l:c,toString:va}}function va(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"}function ca(a,b,c){function f(h){if(h>360)h-=360;else if(h<0)h+=360;if(h<60)return d+(e-d)*h/60;if(h<180)return e;if(h<240)return d+(e-d)*(240-h)/60;return d}var d,e;a%=360;if(a<0)a+=360;b=b<0?0:b>1?1:b;c=c<0?0:c>1?1:c;e=c<=0.5?c*(1+b):c+b-
+c*b;d=2*c-e;return G(Math.round(f(a+120)*255),Math.round(f(a)*255),Math.round(f(a-120)*255))}function x(a){function b(d){for(var e=[],h,g,i,j,l=0,o=a.length;l<o;l++){i=a[l];e.push(h=[]);h.parentNode=i.parentNode;h.parentData=i.parentData;for(var p=0,k=i.length;p<k;p++)if(j=i[p]){h.push(g=d(j));if(g&&"__data__"in j)g.__data__=j.__data__}else h.push(null)}return x(e)}function c(d){for(var e=[],h,g,i,j=0,l=a.length;j<l;j++){g=a[j];for(var o=0,p=g.length;o<p;o++)if(i=g[o]){e.push(h=d(i));h.parentNode=
+i;h.parentData=i.__data__}}return x(e)}function f(d){for(var e=0,h=a.length;e<h;e++)for(var g=a[e],i=0,j=g.length;i<j;i++){var l=g[i];if(l)return d.call(l,l.__data__,i)}return null}a.select=function(d){return b(function(e){return e.querySelector(d)})};a.selectAll=function(d){return c(function(e){return L(e.querySelectorAll(d))})};a.filter=function(d){for(var e=[],h,g,i,j=0,l=a.length;j<l;j++){g=a[j];e.push(h=[]);h.parentNode=g.parentNode;h.parentData=g.parentData;for(var o=0,p=g.length;o<p;o++)if((i=
+g[o])&&d.call(i,i.__data__,o))h.push(i)}return x(e)};a.data=function(d,e){function h(k,n){function q(wa){return k.parentNode.appendChild(wa)}var m=0,s=k.length,t=n.length,r=Math.min(s,t),u=Math.max(s,t),y=[],z=[],v=[],A,B;if(e){r={};u=[];var C;B=n.length;for(m=0;m<s;m++){C=e.nodeKey(A=k[m]);if(C in r)v[B++]=k[m];else{r[C]=A;u.push(C)}}for(m=0;m<t;m++){if(A=r[C=e.dataKey(B=n[m])]){A.__data__=B;y[m]=A;z[m]=v[m]=null}else{z[m]={appendChild:q,__data__:B};y[m]=v[m]=null}delete r[C]}for(m=0;m<s;m++)if(u[m]in
+r)v[m]=k[m]}else{for(;m<r;m++){A=k[m];B=n[m];if(A){A.__data__=B;y[m]=A;z[m]=v[m]=null}else{z[m]={appendChild:q,__data__:B};y[m]=v[m]=null}}for(;m<t;m++){z[m]={appendChild:q,__data__:n[m]};y[m]=v[m]=null}for(;m<u;m++){v[m]=k[m];z[m]=y[m]=null}}z.parentNode=y.parentNode=v.parentNode=k.parentNode;z.parentData=y.parentData=v.parentData=k.parentData;l.push(z);o.push(y);p.push(v)}var g=-1,i=a.length,j,l=[],o=[],p=[];if(typeof e=="string")e=xa(e);if(typeof d=="function")for(;++g<i;)h(j=a[g],d.call(j,j.parentData,
+g));else for(;++g<i;)h(j=a[g],d);g=x(o);g.enter=function(k){return x(l).append(k)};g.exit=function(){return x(p)};return g};a.each=function(d){for(var e=0,h=a.length;e<h;e++)for(var g=a[e],i=0,j=g.length;i<j;i++){var l=g[i];l&&d.call(l,l.__data__,i)}return a};a.node=function(){return f(function(){return this})};a.attr=function(d,e){function h(){this.removeAttribute(d)}function g(){this.removeAttributeNS(d.space,d.local)}function i(){this.setAttribute(d,e)}function j(){this.setAttributeNS(d.space,
+d.local,e)}function l(){var p=e.apply(this,arguments);p==null?this.removeAttribute(d):this.setAttribute(d,p)}function o(){var p=e.apply(this,arguments);p==null?this.removeAttributeNS(d.space,d.local):this.setAttributeNS(d.space,d.local,p)}d=d3.ns.qualify(d);if(arguments.length<2)return f(d.local?function(){return this.getAttributeNS(d.space,d.local)}:function(){return this.getAttribute(d)});return a.each(e==null?d.local?g:h:typeof e=="function"?d.local?o:l:d.local?j:i)};a.classed=function(d,e){function h(){var l=
+this.className;j.lastIndex=0;if(!j.test(l))this.className=Z(l+" "+d)}function g(){var l=Z(this.className.replace(j," "));this.className=l.length?l:null}function i(){(e.apply(this,arguments)?h:g).call(this)}var j=RegExp("(^|\\s+)"+d3.requote(d)+"(\\s+|$)","g");if(arguments.length<2)return f(function(){j.lastIndex=0;return j.test(this.className)});return a.each(typeof e=="function"?i:e?h:g)};a.style=function(d,e,h){function g(){this.style.removeProperty(d)}function i(){this.style.setProperty(d,e,h)}
+function j(){var l=e.apply(this,arguments);l==null?this.style.removeProperty(d):this.style.setProperty(d,l,h)}if(arguments.length<3)h=null;if(arguments.length<2)return f(function(){return window.getComputedStyle(this,null).getPropertyValue(d)});return a.each(e==null?g:typeof e=="function"?j:i)};a.property=function(d,e){function h(){delete this[d]}function g(){this[d]=e}function i(){var j=e.apply(this,arguments);if(j==null)delete this[d];else this[d]=j}d=d3.ns.qualify(d);if(arguments.length<2)return f(function(){return this[d]});
+return a.each(e==null?h:typeof e=="function"?i:g)};a.text=function(d){function e(){this.appendChild(document.createTextNode(d))}function h(){var g=d.apply(this,arguments);g!=null&&this.appendChild(document.createTextNode(g))}if(arguments.length<1)return f(function(){return this.textContent});a.each(function(){for(;this.lastChild;)this.removeChild(this.lastChild)});return d==null?a:a.each(typeof d=="function"?h:e)};a.html=function(d){function e(){this.innerHTML=d}function h(){this.innerHTML=d.apply(this,
+arguments)}if(arguments.length<1)return f(function(){return this.innerHTML});return a.each(typeof d=="function"?h:e)};a.append=function(d){function e(g){return g.appendChild(document.createElement(d))}function h(g){return g.appendChild(document.createElementNS(d.space,d.local))}d=d3.ns.qualify(d);return b(d.local?h:e)};a.remove=function(){return b(function(d){var e=d.parentNode;e.removeChild(d);return e})};a.sort=function(d){d=ya.apply(this,arguments);for(var e=0,h=a.length;e<h;e++){var g=a[e];g.sort(d);
+for(var i=1,j=g.length,l=g[0];i<j;i++){var o=g[i];if(o){l&&l.parentNode.insertBefore(o,l.nextSibling);l=o}}}return a};a.on=function(d,e){d="on"+d;return a.each(function(h,g){this[d]=function(i){var j=d3.event;d3.event=i;try{e.call(this,h,g)}finally{d3.event=j}}})};a.transition=function(){return R(a)};a.call=$;return a}function xa(a){return{nodeKey:function(b){return b.getAttribute(a)},dataKey:function(b){return b[a]}}}function ya(a){if(!arguments.length)a=d3.ascending;return function(b,c){return a(b&&
+b.__data__,c&&c.__data__)}}function R(a){function b(k){var n=true,q=-1;a.each(function(){if(i[++q]!=2){var m=(k-j[q])/l[q],s=this.__transition__,t,r,u=e[q];if(m<1){n=false;if(m<0)return}else m=1;if(i[q]){if(s.active!=f){i[q]=2;return}}else if(!s||s.active>f){i[q]=2;return}else{i[q]=1;g.start.dispatch.apply(this,arguments);u=e[q]={};s.active=f;for(r in d)u[r]=d[r].apply(this,arguments)}t=p(m);for(r in d)u[r].call(this,t);if(m==1){i[q]=2;if(s.active==f){m=s.owner;if(m==f){delete this.__transition__;
+h&&this.parentNode.removeChild(this)}S=f;g.end.dispatch.apply(this,arguments);S=0;s.owner=m}}}});return n}var c={},f=S||++za,d={},e=[],h=false,g=d3.dispatch("start","end"),i=[],j=[],l=[],o,p=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=f});c.delay=function(k){var n=Infinity,q=-1;if(typeof k=="function")a.each(function(){var m=j[++q]=+k.apply(this,arguments);if(m<n)n=m});else{n=+k;a.each(function(){j[++q]=n})}Aa(b,n);return c};c.duration=function(k){var n=
+-1;if(typeof k=="function"){o=0;a.each(function(){var q=l[++n]=+k.apply(this,arguments);if(q>o)o=q})}else{o=+k;a.each(function(){l[++n]=o})}return c};c.ease=function(k){p=typeof k=="string"?d3.ease(k):k;return c};c.attrTween=function(k,n){function q(s,t){var r=n.call(this,s,t,this.getAttribute(k));return function(u){this.setAttribute(k,r(u))}}function m(s,t){var r=n.call(this,s,t,this.getAttributeNS(k.space,k.local));return function(u){this.setAttributeNS(k.space,k.local,r(u))}}d["attr."+k]=k.local?
+m:q;return c};c.attr=function(k,n){return c.attrTween(k,da(n))};c.styleTween=function(k,n,q){d["style."+k]=function(m,s){var t=n.call(this,m,s,window.getComputedStyle(this,null).getPropertyValue(k));return function(r){this.style.setProperty(k,t(r),q)}};return c};c.style=function(k,n,q){return c.styleTween(k,da(n),q)};c.select=function(k){var n;k=R(a.select(k)).ease(p);n=-1;k.delay(function(){return j[++n]});n=-1;k.duration(function(){return l[++n]});return k};c.selectAll=function(k){var n;k=R(a.selectAll(k)).ease(p);
+n=-1;k.delay(function(q,m){return j[m?n:++n]});n=-1;k.duration(function(q,m){return l[m?n:++n]});return k};c.remove=function(){h=true;return c};c.each=function(k,n){g[k].add(n);return c};c.call=$;return c.delay(0).duration(250)}function Aa(a,b){var c=Date.now(),f=false,d=c+b,e=D;if(isFinite(b)){for(;e;){if(e.callback==a){e.then=c;e.delay=b;f=true}else{var h=e.then+e.delay;if(h<d)d=h}e=e.next}f||(D={callback:a,then:c,delay:b,next:D});if(!H){clearTimeout(T);T=setTimeout(Ba,Math.max(24,d-c))}}}function Ba(){H=
+setInterval(Ca,24);T=0}function Ca(){for(var a,b=Date.now(),c=D;c;){a=b-c.then;if(a>c.delay)c.flush=c.callback(a);c=c.next}a=null;for(b=D;b;)b=b.flush?a?a.next=b.next:D=b.next:(a=b).next;a||(H=clearInterval(H))}function da(a){return typeof a=="function"?function(b,c,f){return d3.interpolate(f,a.call(this,b,c))}:function(b,c,f){return d3.interpolate(f,a)}}function Da(a){return a.innerRadius}function Ea(a){return a.outerRadius}function ea(a){return a.startAngle}function fa(a){return a.endAngle}function U(a,
+b,c,f){var d=[],e=-1,h=b.length,g=typeof c=="function",i=typeof f=="function",j;if(g&&i)for(;++e<h;)d.push([c.call(a,j=b[e],e),f.call(a,j,e)]);else if(g)for(;++e<h;)d.push([c.call(a,b[e],e),f]);else if(i)for(;++e<h;)d.push([c,f.call(a,b[e],e)]);else for(;++e<h;)d.push([c,f]);return d}function ga(a){return a.x}function ha(a){return a.y}function ia(a){if(a.length<1)return null;var b=[],c=0,f=a.length,d=a[0];for(b.push(d[0],",",d[1]);++c<f;)b.push("L",(d=a[c])[0],",",d[1]);return b.join("")}function E(a,
+b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function V(a,b,c){a.push("C",E(ja,b),",",E(ja,c),",",E(ka,b),",",E(ka,c),",",E(la,b),",",E(la,c))}function Fa(){return 0}function Ga(a){return a.source}function Ha(a){return a.target}function Ia(a){return a.radius}d3={version:"0.28.8"};if(!Date.now)Date.now=function(){return+new Date};if(!Object.create)Object.create=function(a){function b(){}b.prototype=a;return new b};d3.ascending=function(a,b){return a<b?-1:a>b?1:0};d3.descending=function(a,b){return b<
+a?-1:b>a?1:0};d3.merge=function(a){return Array.prototype.concat.apply([],a)};d3.split=function(a,b){var c=[],f=[],d,e=-1,h=a.length;if(arguments.length<2)b=ma;for(;++e<h;)if(b.call(f,d=a[e],e)){c.push(f);f=[]}else f.push(d);c.push(f);return c};d3.range=function(a,b,c){if(arguments.length==1){b=a;a=0}if(c==null)c=1;if((b-a)/c==Infinity)throw Error("infinite range");var f=[],d=-1,e;if(c<0)for(;(e=a+c*++d)>b;)f.push(e);else for(;(e=a+c*++d)<b;)f.push(e);return f};d3.requote=function(a){return a.replace(Ja,
+"\\$&")};var Ja=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.xhr=function(a,b,c){var f=new XMLHttpRequest;if(arguments.length<3)c=b;else b&&f.overrideMimeType(b);f.open("GET",a,true);f.onreadystatechange=function(){if(f.readyState==4)c(f.status<300?f:null)};f.send(null)};d3.text=function(a,b,c){if(arguments.length<3){c=b;b=null}d3.xhr(a,b,function(f){c(f&&f.responseText)})};d3.json=function(a,b){d3.text(a,"application/json",function(c){b(c?JSON.parse(c):null)})};d3.html=function(a,b){d3.text(a,"text/html",
+function(c){if(c!=null){var f=document.createRange();f.selectNode(document.body);c=f.createContextualFragment(c)}b(c)})};d3.xml=function(a,b,c){if(arguments.length<3){c=b;b=null}d3.xhr(a,b,function(f){c(f&&f.responseXML)})};d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,
+b)],local:a.substring(b+1)}}};d3.dispatch=function(){for(var a={},b,c=0,f=arguments.length;c<f;c++){b=arguments[c];a[b]=na(b)}return a};d3.format=function(a){a=Ka.exec(a);var b=a[1]||" ",c=a[5],f=+a[6],d=a[7],e=a[8],h=a[9];if(e)e=e.substring(1);if(c)b="0";if(h=="d")e="0";return function(g){if(h=="d"&&g%1)return"";if(e)g=(+g).toFixed(e);else g+="";if(d){for(var i=g.lastIndexOf("."),j=i>=0?g.substring(i):(i=g.length,""),l=[];i>0;)l.push(g.substring(i-=3,i+3));g=l.reverse().join(",")+j}i=g.length;if(i<
+f)g=Array(f-i+1).join(b)+g;return g}};var Ka=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,La=M(2),Ma=M(3),Na={linear:function(){return oa},poly:M,quad:function(){return La},cubic:function(){return Ma},sin:function(){return pa},exp:function(){return qa},circle:function(){return ra},elastic:function(a,b){var c;if(arguments.length<2)b=0.45;if(arguments.length<1){a=1;c=b/4}else c=b/(2*Math.PI)*Math.asin(1/a);return function(f){return 1+a*Math.pow(2,10*-f)*Math.sin((f-c)*
+2*Math.PI/b)}},back:function(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}},bounce:function(){return sa}},Oa={"in":function(a){return a},out:aa,"in-out":ba,"out-in":function(a){return ba(aa(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a;b=b>=0?a.substring(b+1):"in";return Oa[b](Na[c].apply(null,Array.prototype.slice.call(arguments,1)))};d3.event=null;d3.interpolate=function(a,b){if(typeof b=="number")return d3.interpolateNumber(+a,b);if(typeof b=="string")return b in
+F||/^(#|rgb\(|hsl\()/.test(b)?d3.interpolateRgb(String(a),b):d3.interpolateString(String(a),b);if(b instanceof Array)return d3.interpolateArray(a,b);return d3.interpolateObject(a,b)};d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}};d3.interpolateString=function(a,b){var c,f,d=0,e=[],h=[],g,i;for(f=0;c=W.exec(b);++f){c.index&&e.push(b.substring(d,c.index));h.push({i:e.length,x:c[0]});e.push(null);d=W.lastIndex}d<b.length&&e.push(b.substring(d));f=0;for(g=h.length;(c=W.exec(a))&&
+f<g;++f){i=h[f];if(i.x==c[0]){if(i.i)if(e[i.i+1]==null){e[i.i-1]+=i.x;e.splice(i.i,1);for(c=f+1;c<g;++c)h[c].i--}else{e[i.i-1]+=i.x+e[i.i+1];e.splice(i.i,2);for(c=f+1;c<g;++c)h[c].i-=2}else if(e[i.i+1]==null)e[i.i]=i.x;else{e[i.i]=i.x+e[i.i+1];e.splice(i.i+1,1);for(c=f+1;c<g;++c)h[c].i--}h.splice(f,1);g--;f--}else i.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(i.x))}for(;f<g;){i=h.pop();if(e[i.i+1]==null)e[i.i]=i.x;else{e[i.i]=i.x+e[i.i+1];e.splice(i.i+1,1)}g--}if(e.length==1)return e[0]==null?
+h[0].x:function(){return b};return function(j){for(f=0;f<g;++f)e[(i=h[f]).i]=i.x(j);return e.join("")}};d3.interpolateRgb=function(a,b){a=d3.rgb(a);b=d3.rgb(b);var c=a.r,f=a.g,d=a.b,e=b.r-c,h=b.g-f,g=b.b-d;return function(i){return"rgb("+Math.round(c+e*i)+","+Math.round(f+h*i)+","+Math.round(d+g*i)+")"}};d3.interpolateArray=function(a,b){var c=[],f=[],d=a.length,e=b.length,h=Math.min(a.length,b.length),g;for(g=0;g<h;++g)c.push(d3.interpolate(a[g],b[g]));for(;g<d;++g)f[g]=a[g];for(;g<e;++g)f[g]=b[g];
+return function(i){for(g=0;g<h;++g)f[g]=c[g](i);return f}};d3.interpolateObject=function(a,b){var c={},f={},d;for(d in a)if(d in b)c[d]=(d in Pa||/\bcolor\b/.test(d)?d3.interpolateRgb:d3.interpolate)(a[d],b[d]);else f[d]=a[d];for(d in b)d in a||(f[d]=b[d]);return function(e){for(d in c)f[d]=c[d](e);return f}};var W=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,Pa={background:1,fill:1,stroke:1};d3.rgb=function(a,b,c){return arguments.length==1?O(""+a,G,ca):G(~~a,~~b,~~c)};var F={aliceblue:"#f0f8ff",
+antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",
+darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",
+goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",
+lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",
+navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",
+silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},X;for(X in F)F[X]=O(F[X],G,ca);d3.hsl=function(a,b,c){return arguments.length==1?O(""+a,ua,Q):Q(+a,+b,+c)};var I=x([[document]]);I[0].parentNode=document.documentElement;
+d3.select=function(a){return typeof a=="string"?I.select(a):x([[a]])};d3.selectAll=function(a){return typeof a=="string"?I.selectAll(a):x([L(a)])};d3.transition=I.transition;var za=0,S=0,D=null,T=0,H;d3.scale={};d3.scale.linear=function(){function a(j){return i((j-c)*h)}function b(j){var l=Math.min(c,f),o=Math.max(c,f),p=o-l,k=Math.pow(10,Math.floor(Math.log(p/j)/Math.LN10));j=j/(p/k);if(j<=0.15)k*=10;else if(j<=0.35)k*=5;else if(j<=0.75)k*=2;return{start:Math.ceil(l/k)*k,stop:Math.floor(o/k)*k+k*
+0.5,step:k}}var c=0,f=1,d=0,e=1,h=1/(f-c),g=(f-c)/(e-d),i=d3.interpolate(d,e);a.invert=function(j){return(j-d)*g+c};a.domain=function(j){if(!arguments.length)return[c,f];c=j[0];f=j[1];h=1/(f-c);g=(f-c)/(e-d);return a};a.range=function(j){if(!arguments.length)return[d,e];d=j[0];e=j[1];g=(f-c)/(e-d);i=d3.interpolate(d,e);return a};a.ticks=function(j){j=b(j);return d3.range(j.start,j.stop,j.step)};a.tickFormat=function(j){j=Math.max(0,-Math.floor(Math.log(b(j).step)/Math.LN10+0.01));return d3.format(",."+
+j+"f")};return a};d3.scale.log=function(){function a(d){return Math.log(d)/Math.LN10}function b(d){return Math.pow(10,d)}function c(d){return f(a(d))}var f=d3.scale.linear();c.invert=function(d){return b(f.invert(d))};c.domain=function(d){if(!arguments.length)return f.domain().map(b);f.domain(d.map(a));return c};c.range=function(){var d=f.range.apply(f,arguments);return arguments.length?c:d};c.ticks=function(){var d=f.domain(),e=Math.floor(d[0]),h=Math.ceil(d[1]),g=[];if(d.every(isFinite)){for(;++e<=
+h;)for(d=1;d<10;d++)g.push(b(e)*d);g.push(b(e))}return g};c.tickFormat=function(){return function(d){return d.toPrecision(1)}};return c};d3.scale.pow=function(){function a(h){return Math.pow(h,d)}function b(h){return Math.pow(h,e)}function c(h){return f(a(h))}var f=d3.scale.linear(),d=1,e=1/d;c.invert=function(h){return b(f.invert(h))};c.domain=function(h){if(!arguments.length)return f.domain().map(b);f.domain(h.map(a));return c};c.range=function(){var h=f.range.apply(f,arguments);return arguments.length?
+c:h};c.ticks=function(h){return d3.scale.linear().domain(c.domain()).ticks(h)};c.tickFormat=function(h){return d3.scale.linear().domain(c.domain()).tickFormat(h)};c.exponent=function(h){if(!arguments.length)return d;var g=c.domain();d=h;e=1/h;return c.domain(g)};return c};d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};d3.scale.ordinal=function(){function a(e){e=e in c?c[e]:c[e]=b.push(e)-1;return f[e%f.length]}var b=[],c={},f=[],d=0;a.domain=function(e){if(!arguments.length)return b;
+b=e;c={};for(var h=-1,g=-1,i=b.length;++h<i;){e=b[h];e in c||(c[e]=++g)}return a};a.range=function(e){if(!arguments.length)return f;f=e;return a};a.rangePoints=function(e,h){if(arguments.length<2)h=0;var g=e[0],i=e[1],j=(i-g)/(b.length-1+h);f=b.length==1?[(g+i)/2]:d3.range(g+j*h/2,i+j/2,j);d=0;return a};a.rangeBands=function(e,h){if(arguments.length<2)h=0;var g=e[0],i=e[1],j=(i-g)/(b.length+h);f=d3.range(g+j*h,i,j);d=j*(1-h);return a};a.rangeBand=function(){return d};return a};d3.scale.category10=
+function(){return d3.scale.ordinal().range(Qa)};d3.scale.category20=function(){return d3.scale.ordinal().range(Ra)};d3.scale.category20b=function(){return d3.scale.ordinal().range(Sa)};d3.scale.category20c=function(){return d3.scale.ordinal().range(Ta)};var Qa=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ra=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2",
+"#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],Sa=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],Ta=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function a(){for(var h=
+-1,g=e.length=d.length,i=f.length/g;++h<g;)e[h]=f[~~(h*i)]}function b(h){if(isNaN(h=+h))return NaN;for(var g=0,i=e.length-1;g<=i;){var j=g+i>>1,l=e[j];if(l<h)g=j+1;else if(l>h)i=j-1;else return j}return i<0?0:i}function c(h){return d[b(h)]}var f=[],d=[],e=[];c.domain=function(h){if(!arguments.length)return f;f=h.filter(function(g){return!isNaN(g)}).sort(d3.ascending);a();return c};c.range=function(h){if(!arguments.length)return d;d=h;a();return c};c.quantiles=function(){return e};return c};d3.svg=
+{};d3.svg.arc=function(){function a(e,h){var g=b.call(this,e,h),i=c.call(this,e,h),j=f.call(this,e,h)+J,l=d.call(this,e,h)+J,o=l-j,p=o<Math.PI?"0":"1",k=Math.cos(j);j=Math.sin(j);var n=Math.cos(l);l=Math.sin(l);return o>=Ua?g?"M0,"+i+"A"+i+","+i+" 0 1,1 0,"+-i+"A"+i+","+i+" 0 1,1 0,"+i+"M0,"+g+"A"+g+","+g+" 0 1,1 0,"+-g+"A"+g+","+g+" 0 1,1 0,"+g+"Z":"M0,"+i+"A"+i+","+i+" 0 1,1 0,"+-i+"A"+i+","+i+" 0 1,1 0,"+i+"Z":g?"M"+i*k+","+i*j+"A"+i+","+i+" 0 "+p+",1 "+i*n+","+i*l+"L"+g*n+","+g*l+"A"+g+","+g+
+" 0 "+p+",0 "+g*k+","+g*j+"Z":"M"+i*k+","+i*j+"A"+i+","+i+" 0 "+p+",1 "+i*n+","+i*l+"L0,0Z"}var b=Da,c=Ea,f=ea,d=fa;a.innerRadius=function(e){if(!arguments.length)return b;b=w(e);return a};a.outerRadius=function(e){if(!arguments.length)return c;c=w(e);return a};a.startAngle=function(e){if(!arguments.length)return f;f=w(e);return a};a.endAngle=function(e){if(!arguments.length)return d;d=w(e);return a};return a};var J=-Math.PI/2,Ua=2*Math.PI-1.0E-6;d3.svg.line=function(){function a(e){return e.length<
+1?null:"M"+d(U(this,e,b,c))}var b=ga,c=ha,f="linear",d=K[f];a.x=function(e){if(!arguments.length)return b;b=e;return a};a.y=function(e){if(!arguments.length)return c;c=e;return a};a.interpolate=function(e){if(!arguments.length)return f;d=K[f=e];return a};return a};var K={linear:ia,basis:function(a){if(a.length<3)return ia(a);var b=[],c=1,f=a.length,d=a[0],e=d[0],h=d[1],g=[e,e,e,(d=a[1])[0]],i=[h,h,h,d[1]];b.push(e,",",h);for(V(b,g,i);++c<f;){d=a[c];g.shift();g.push(d[0]);i.shift();i.push(d[1]);V(b,
+g,i)}for(c=-1;++c<2;){g.shift();g.push(d[0]);i.shift();i.push(d[1]);V(b,g,i)}return b.join("")}},ja=[0,2/3,1/3,0],ka=[0,1/3,2/3,0],la=[0,1/6,2/3,1/6];d3.svg.area=function(){function a(h){return h.length<1?null:"M"+e(U(this,h,b,f))+"L"+e(U(this,h,b,c).reverse())+"Z"}var b=ga,c=Fa,f=ha,d="linear",e=K[d];a.x=function(h){if(!arguments.length)return b;b=h;return a};a.y0=function(h){if(!arguments.length)return c;c=h;return a};a.y1=function(h){if(!arguments.length)return f;f=h;return a};a.interpolate=function(h){if(!arguments.length)return d;
+e=K[d=h];return a};return a};d3.svg.chord=function(){function a(g,i){var j=b(this,c,g,i),l=b(this,f,g,i);return"M"+j.p0+("A"+j.r+","+j.r+" 0 0,1 "+j.p1)+(j.a0==l.a0&&j.a1==l.a1?"Q 0,0 "+j.p0:"Q 0,0 "+l.p0+("A"+l.r+","+l.r+" 0 0,1 "+l.p1)+("Q 0,0 "+j.p0))+"Z"}function b(g,i,j,l){var o=i.call(g,j,l);i=d.call(g,o,l);j=e.call(g,o,l)+J;g=h.call(g,o,l)+J;return{r:i,a0:j,a1:g,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(g),i*Math.sin(g)]}}var c=Ga,f=Ha,d=Ia,e=ea,h=fa;a.radius=function(g){if(!arguments.length)return d;
+d=w(g);return a};a.source=function(g){if(!arguments.length)return c;c=w(g);return a};a.target=function(g){if(!arguments.length)return f;f=w(g);return a};a.startAngle=function(g){if(!arguments.length)return e;e=w(g);return a};a.endAngle=function(g){if(!arguments.length)return h;h=w(g);return a};return a};d3.svg.mouse=function(a){var b=(a.ownerSVGElement||a).createSVGPoint();if(Y<0&&(window.scrollX||window.scrollY)){var c=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",
+0).style("left",0),f=c[0][0].getScreenCTM();Y=!(f.f||f.e);c.remove()}if(Y){b.x=d3.event.pageX;b.y=d3.event.pageY}else{b.x=d3.event.clientX;b.y=d3.event.clientY}b=b.matrixTransform(a.getScreenCTM().inverse());return[b.x,b.y]};var Y=/WebKit/.test(navigator.userAgent)?-1:0})();
Please sign in to comment.
Something went wrong with that request. Please try again.