From afc92c457769c6bf72aa0894bcccad1131988085 Mon Sep 17 00:00:00 2001 From: Daniel Santillan Date: Fri, 27 Jun 2014 14:36:08 +0200 Subject: [PATCH] Added new build libs --- lib/index.html | 31 ++++++++----------------------- lib/scripts/analytics.min.js | 2 +- lib/scripts/main_analytics.js | 2 +- 3 files changed, 10 insertions(+), 25 deletions(-) diff --git a/lib/index.html b/lib/index.html index 887569a..a5d6f9a 100644 --- a/lib/index.html +++ b/lib/index.html @@ -11,17 +11,11 @@ - - - + - - - + - - - + @@ -35,16 +29,13 @@

ScatterPlot

BoxPlot

Stacked Bars

-

ParallelCoordinates

+

Parallel

+

Line

- - - - - + - - - + @@ -68,11 +57,7 @@ - - - - - + diff --git a/lib/scripts/analytics.min.js b/lib/scripts/analytics.min.js index 0dd197b..2a059a2 100644 --- a/lib/scripts/analytics.min.js +++ b/lib/scripts/analytics.min.js @@ -1 +1 @@ -function iqr(a){return function(b,c){for(var d=b.quartiles[0],e=b.quartiles[2],f=(e-d)*a,c=-1,g=b.length;b[++c]e+f;);return[c,g]}}!function(){function a(a){return[0,a.length-1]}function b(a){return[d3.quantile(a,.25),d3.quantile(a,.5),d3.quantile(a,.75)]}d3.box=function(){function c(a){a.each(function(a,b){a=a.map(h).sort(d3.ascending);var c=d3.select(this),l=a.length,m=a[0],n=a[l-1],o=a.quartiles=j(a),p=i&&i.call(this,a,b),q=p&&p.map(function(b){return a[b]}),r=p?d3.range(0,p[0]).concat(d3.range(p[1]+1,l)):d3.range(l),s=d3.scale.linear().domain(g&&g.call(this,a,b)||[m,n]).range([e,0]),t=this.__chart__||d3.scale.linear().domain([0,1/0]).range(s.range());this.__chart__=s;var u=c.selectAll("line.center").data(q?[q]:[]);u.enter().insert("line","rect").attr("class","center").attr("x1",d/2).attr("y1",function(a){return t(a[0])}).attr("x2",d/2).attr("y2",function(a){return t(a[1])}).style("opacity",1e-6).transition().duration(f).style("opacity",1).attr("y1",function(a){return s(a[0])}).attr("y2",function(a){return s(a[1])}),u.transition().duration(f).style("opacity",1).attr("y1",function(a){return s(a[0])}).attr("y2",function(a){return s(a[1])}),u.exit().transition().duration(f).style("opacity",1e-6).attr("y1",function(a){return s(a[0])}).attr("y2",function(a){return s(a[1])}).remove();var v=c.selectAll("rect.box").data([o]);v.enter().append("rect").attr("class","box").attr("x",0).attr("y",function(a){return t(a[2])}).attr("width",d).attr("height",function(a){return t(a[0])-t(a[2])}).transition().duration(f).attr("y",function(a){return s(a[2])}).attr("height",function(a){return s(a[0])-s(a[2])}),v.transition().duration(f).attr("y",function(a){return s(a[2])}).attr("height",function(a){return s(a[0])-s(a[2])});var w=c.selectAll("line.median").data([o[1]]);w.enter().append("line").attr("class","median").attr("x1",0).attr("y1",t).attr("x2",d).attr("y2",t).transition().duration(f).attr("y1",s).attr("y2",s),w.transition().duration(f).attr("y1",s).attr("y2",s);var x=c.selectAll("line.whisker").data(q||[]);x.enter().insert("line","circle, text").attr("class","whisker").attr("x1",0).attr("y1",t).attr("x2",d).attr("y2",t).style("opacity",1e-6).transition().duration(f).attr("y1",s).attr("y2",s).style("opacity",1),x.transition().duration(f).attr("y1",s).attr("y2",s).style("opacity",1),x.exit().transition().duration(f).attr("y1",s).attr("y2",s).style("opacity",1e-6).remove();var y=c.selectAll("circle.outlier").data(r,Number);y.enter().insert("circle","text").attr("class","outlier").attr("r",5).attr("cx",d/2).attr("cy",function(b){return t(a[b])}).style("opacity",1e-6).transition().duration(f).attr("cy",function(b){return s(a[b])}).style("opacity",1),y.transition().duration(f).attr("cy",function(b){return s(a[b])}).style("opacity",1),y.exit().transition().duration(f).attr("cy",function(b){return s(a[b])}).style("opacity",1e-6).remove();var z=k||s.tickFormat(8),A=c.selectAll("text.box").data(o);A.enter().append("text").attr("class","box").attr("dy",".3em").attr("dx",function(a,b){return 1&b?6:-6}).attr("x",function(a,b){return 1&b?d:0}).attr("y",t).attr("text-anchor",function(a,b){return 1&b?"start":"end"}).text(z).transition().duration(f).attr("y",s),A.transition().duration(f).text(z).attr("y",s);var B=c.selectAll("text.whisker").data(q||[]);B.enter().append("text").attr("class","whisker").attr("dy",".3em").attr("dx",6).attr("x",d).attr("y",t).text(z).style("opacity",1e-6).transition().duration(f).attr("y",s).style("opacity",1),B.transition().duration(f).text(z).attr("y",s).style("opacity",1),B.exit().transition().duration(f).attr("y",s).style("opacity",1e-6).remove()}),d3.timer.flush()}var d=1,e=1,f=0,g=null,h=Number,i=a,j=b,k=null;return c.width=function(a){return arguments.length?(d=a,c):d},c.height=function(a){return arguments.length?(e=a,c):e},c.tickFormat=function(a){return arguments.length?(k=a,c):k},c.duration=function(a){return arguments.length?(f=a,c):f},c.domain=function(a){return arguments.length?(g=null==a?a:d3.functor(a),c):g},c.value=function(a){return arguments.length?(h=a,c):h},c.whiskers=function(a){return arguments.length?(i=a,c):i},c.quartiles=function(a){return arguments.length?(j=a,c):j},c}}(),function(){function a(b,c,d){function e(a){var e=b(a),f=d>e,g=d3.extent(b.range()),h=g[0],i=g[1],j=f?d-h:i-d;return 0==j&&(j=i-h),(f?-1:1)*j*(c+1)/(c+j/Math.abs(e-d))+d}return e.distortion=function(a){return arguments.length?(c=+a,e):c},e.focus=function(a){return arguments.length?(d=+a,e):d},e.copy=function(){return a(b.copy(),c,d)},e.nice=b.nice,e.ticks=b.ticks,e.tickFormat=b.tickFormat,d3.rebind(e,b,"domain","range")}d3.fisheye={scale:function(b){return a(b(),3,0)},circular:function(){function a(a){var b=a.x-g[0],f=a.y-g[1],h=Math.sqrt(b*b+f*f);if(!h||h>=e)return{x:a.x,y:a.y,z:1};var i=c*(1-Math.exp(-h*d))/h*.75+.25;return{x:g[0]+b*i,y:g[1]+f*i,z:Math.min(i,10)}}function b(){return c=Math.exp(f),c=c/(c-1)*e,d=f/e,a}var c,d,e=200,f=2,g=[0,0];return a.radius=function(a){return arguments.length?(e=+a,b()):e},a.distortion=function(a){return arguments.length?(f=+a,b()):f},a.focus=function(b){return arguments.length?(g=b,a):g},b()}}}();var analytics={margin:{top:20,right:20,bottom:90,left:70},scatterPlot:function(a){function b(a){var b=[],c=[];for(i=0;i"+a+"

"});var d=d3.select(a.selector),d=d3.select(a.selector);$(a.selector).empty();var e=$(a.selector).width()-analytics.margin.left-analytics.margin.right,f=$(a.selector).height()-analytics.margin.top-analytics.margin.bottom,g=d3.csv.parse(a.data);d.append("svg").attr("display","block").attr("width",e).attr("height",f).datum(b(g)).call(c),nv.utils.windowResize(c.update),c.dispatch.on("stateChange",function(a){JSON.stringify(a)})},boxPlot:function(a){function b(a){var b=[],c=[];for(i=0;ih&&(h=f),g>f&&(g=f)}}return b}var c=d3.select(a.selector);$(a.selector).empty();var d=$(a.selector).width()-analytics.margin.left-analytics.margin.right,e=$(a.selector).height()-analytics.margin.top-analytics.margin.bottom,f=40,g=1/0,h=-1/0,l=d3.csv.parse(a.data),m=b(l),n=d/m.length-2*f;n>100&&(n=100);var o=d3.box().whiskers(iqr(1.5)).width(n).height(e-analytics.margin.top-analytics.margin.bottom);o.domain([g,h]);c.selectAll("svg").attr("display","none").append("g").data(m).enter().append("svg").attr("class","box").attr("width",d/m.length).attr("height",e+analytics.margin.bottom+analytics.margin.top).append("g").attr("transform","translate("+(d/m.length/2-n/2)+","+analytics.margin.top+")").call(o)},stackedPlot:function(a){function b(a){var b=[],c=[];for(i=0;ie+f;);return[c,g]}}!function(){function a(a){return[0,a.length-1]}function b(a){return[d3.quantile(a,.25),d3.quantile(a,.5),d3.quantile(a,.75)]}d3.box=function(){function c(a){a.each(function(a,b){a=a.values.map(h).sort(d3.ascending);var c=d3.select(this),l=a.length,m=a[0],n=a[l-1],o=a.quartiles=j(a),p=i&&i.call(this,a,b),q=p&&p.map(function(b){return a[b]}),r=p?d3.range(0,p[0]).concat(d3.range(p[1]+1,l)):d3.range(l),s=d3.scale.linear().domain(g&&g.call(this,a,b)||[m,n]).range([e,0]),t=this.__chart__||d3.scale.linear().domain([0,1/0]).range(s.range());this.__chart__=s;var u=c.selectAll("line.center").data(q?[q]:[]);u.enter().insert("line","rect").attr("class","center").attr("x1",d/2).attr("y1",function(a){return t(a[0])}).attr("x2",d/2).attr("y2",function(a){return t(a[1])}).style("opacity",1e-6).transition().duration(f).style("opacity",1).attr("y1",function(a){return s(a[0])}).attr("y2",function(a){return s(a[1])}),u.transition().duration(f).style("opacity",1).attr("y1",function(a){return s(a[0])}).attr("y2",function(a){return s(a[1])}),u.exit().transition().duration(f).style("opacity",1e-6).attr("y1",function(a){return s(a[0])}).attr("y2",function(a){return s(a[1])}).remove();var v=c.selectAll("rect.box").data([o]);v.enter().append("rect").attr("class","box").attr("x",0).attr("y",function(a){return t(a[2])}).attr("width",d).attr("height",function(a){return t(a[0])-t(a[2])}).transition().duration(f).attr("y",function(a){return s(a[2])}).attr("height",function(a){return s(a[0])-s(a[2])}),v.transition().duration(f).attr("y",function(a){return s(a[2])}).attr("height",function(a){return s(a[0])-s(a[2])});var w=c.selectAll("line.median").data([o[1]]);w.enter().append("line").attr("class","median").attr("x1",0).attr("y1",t).attr("x2",d).attr("y2",t).transition().duration(f).attr("y1",s).attr("y2",s),w.transition().duration(f).attr("y1",s).attr("y2",s);var x=c.selectAll("line.whisker").data(q||[]);x.enter().insert("line","circle, text").attr("class","whisker").attr("x1",0).attr("y1",t).attr("x2",d).attr("y2",t).style("opacity",1e-6).transition().duration(f).attr("y1",s).attr("y2",s).style("opacity",1),x.transition().duration(f).attr("y1",s).attr("y2",s).style("opacity",1),x.exit().transition().duration(f).attr("y1",s).attr("y2",s).style("opacity",1e-6).remove();var y=c.selectAll("circle.outlier").data(r,Number);y.enter().insert("circle","text").attr("class","outlier").attr("r",5).attr("cx",d/2).attr("cy",function(b){return t(a[b])}).style("opacity",1e-6).transition().duration(f).attr("cy",function(b){return s(a[b])}).style("opacity",1),y.transition().duration(f).attr("cy",function(b){return s(a[b])}).style("opacity",1),y.exit().transition().duration(f).attr("cy",function(b){return s(a[b])}).style("opacity",1e-6).remove();var z=k||s.tickFormat(8),A=c.selectAll("text.box").data(o);A.enter().append("text").attr("class","box").attr("dy",".3em").attr("dx",function(a,b){return 1&b?6:-6}).attr("x",function(a,b){return 1&b?d:0}).attr("y",t).attr("text-anchor",function(a,b){return 1&b?"start":"end"}).text(z).transition().duration(f).attr("y",s),A.transition().duration(f).text(z).attr("y",s);var B=c.selectAll("text.whisker").data(q||[]);B.enter().append("text").attr("class","whisker").attr("dy",".3em").attr("dx",6).attr("x",d).attr("y",t).text(z).style("opacity",1e-6).transition().duration(f).attr("y",s).style("opacity",1),B.transition().duration(f).text(z).attr("y",s).style("opacity",1),B.exit().transition().duration(f).attr("y",s).style("opacity",1e-6).remove()}),d3.timer.flush()}var d=1,e=1,f=0,g=null,h=Number,i=a,j=b,k=null;return c.width=function(a){return arguments.length?(d=a,c):d},c.height=function(a){return arguments.length?(e=a,c):e},c.tickFormat=function(a){return arguments.length?(k=a,c):k},c.duration=function(a){return arguments.length?(f=a,c):f},c.domain=function(a){return arguments.length?(g=null==a?a:d3.functor(a),c):g},c.value=function(a){return arguments.length?(h=a,c):h},c.whiskers=function(a){return arguments.length?(i=a,c):i},c.quartiles=function(a){return arguments.length?(j=a,c):j},c}}(),function(){function a(b,c,d){function e(a){var e=b(a),f=d>e,g=d3.extent(b.range()),h=g[0],i=g[1],j=f?d-h:i-d;return 0==j&&(j=i-h),(f?-1:1)*j*(c+1)/(c+j/Math.abs(e-d))+d}return e.distortion=function(a){return arguments.length?(c=+a,e):c},e.focus=function(a){return arguments.length?(d=+a,e):d},e.copy=function(){return a(b.copy(),c,d)},e.nice=b.nice,e.ticks=b.ticks,e.tickFormat=b.tickFormat,d3.rebind(e,b,"domain","range")}d3.fisheye={scale:function(b){return a(b(),3,0)},circular:function(){function a(a){var b=a.x-g[0],f=a.y-g[1],h=Math.sqrt(b*b+f*f);if(!h||h>=e)return{x:a.x,y:a.y,z:1};var i=c*(1-Math.exp(-h*d))/h*.75+.25;return{x:g[0]+b*i,y:g[1]+f*i,z:Math.min(i,10)}}function b(){return c=Math.exp(f),c=c/(c-1)*e,d=f/e,a}var c,d,e=200,f=2,g=[0,0];return a.radius=function(a){return arguments.length?(e=+a,b()):e},a.distortion=function(a){return arguments.length?(f=+a,b()):f},a.focus=function(b){return arguments.length?(g=b,a):g},b()}}}();var analytics={margin:{top:20,right:20,bottom:90,left:70},scatterPlot:function(a){function b(a){var b=[],c=[];for(i=0;i"+a+"

"});var e=d3.select(a.selector),e=d3.select(a.selector);$(a.selector).empty();var f=$(a.selector).width()-analytics.margin.left-analytics.margin.right,g=$(a.selector).height()-analytics.margin.top-analytics.margin.bottom,h=d3.csv.parse(a.data);e.append("svg").attr("display","block").attr("width",f).attr("height",g).datum(b(h)).call(d),nv.utils.windowResize(d.update),d.dispatch.on("stateChange",function(a){JSON.stringify(a)})},boxPlot:function(a){function b(a){var b=[],c=[];for(i=0;il&&(l=f),h>f&&(h=f)}}return b}var c=null;c=a.colors?a.colors:d3.scale.category10(),keyColor=function(a){var b=a.key.lastIndexOf("_"),d=a.key.substring(0,b);return c(d)};var d=d3.select(a.selector);$(a.selector).empty();var e=$(a.selector).width()-analytics.margin.left-analytics.margin.right,f=$(a.selector).height()-analytics.margin.top-analytics.margin.bottom,g=40,h=1/0,l=-1/0,m=d3.csv.parse(a.data),n=b(m),o=e/n.length-2*g;o>100&&(o=100);var p=d3.box().whiskers(iqr(1.5)).width(o).height(f-analytics.margin.top-analytics.margin.bottom);p.domain([h,l]);d.selectAll("svg").attr("display","none").append("g").data(n).enter().append("svg").attr("class","box").attr("width",e/n.length).attr("height",f+analytics.margin.bottom+analytics.margin.top).append("g").attr("transform","translate("+(e/n.length/2-o/2)+","+analytics.margin.top+")").call(p).attr("stroke",keyColor)},stackedPlot:function(a){function b(a){var b=[],c=[];for(i=0;i