/* * D3Evolution 1.1.0 (https://github.com/moisseev/D3Evolution) * Copyright (c) 2016-2017, Alexander Moisseev, BSD 2-Clause */ function D3Evolution(A,r){var u=$.extend(true,{title:"",width:800,height:400,margin:{top:80,right:60,bottom:40,left:60},yAxisLabel:"",type:"line",yScale:"lin",duration:1250,interpolate:"curveLinear",legend:{buttonRadius:7,space:130,entries:[]}},r);const b={curveLinear:d3.curveLinear,curveStep:d3.curveStep,curveStepBefore:d3.curveStepBefore,curveStepAfter:d3.curveStepAfter,curveMonotoneX:d3.curveMonotoneX,curveBasis:d3.curveBasis,curveBasisOpen:d3.curveBasisOpen,curveBundle:d3.curveBundle,curveCardinal:d3.curveCardinal,curveCardinalOpen:d3.curveCardinalOpen,curveCatmullRom:d3.curveCatmullRom,curveCatmullRomOpen:d3.curveCatmullRomOpen,curveNatural:d3.curveNatural,};var K;var G;var m;var a=u.width-u.margin.left-u.margin.right;var c=u.height-u.margin.top-u.margin.bottom;var l=d3.scaleTime().range([0,a]);var E;var i;const t=function(){if(u.yScale==="log"){E=d3.scaleLog().clamp(true).range([c,0]);i=d3.scaleLog().range([c-30,0])}else{E=d3.scaleLinear().range([c,0]);i=E.copy()}};t();var p=d3.axisBottom().scale(l);var h=d3.axisLeft().scale(i).ticks(5);var H=d3.axisBottom().tickFormat("").scale(l).tickSize(-c,0);var k=d3.axisLeft().tickFormat("").scale(i).tickSize(-a,0);var B=d3.scaleQuantize().range([c,0]);var v=d3.area().x(function(g){return l(g.x)}).y0(function(g){return c}).y1(function(g){return B(g.y==null)}).curve(d3.curveStep);var j=d3.line().defined(function(g){return g.y!=null}).x(function(g){return l(g.x)}).y(function(g){return E(g.y)}).curve(b[u.interpolate]);var z=d3.area().defined(function(g){return g.y!=null}).x(function(g){return l(g.x)}).y0(function(g){return E(g.y0)}).y1(function(g){return E(g.y0+g.y)}).curve(b[u.interpolate]);var s=function(g){g.reduce(function(L,M){M.map(function(O,N){O.y0=(L.length?L[N].y+L[N].y0:0)});return M},[])};var q=function(){var g;if(u.type==="area"){s(K);g=(u.yScale==="log")?d3.extent(d3.merge(K),function(Q){return((Q.y0+Q.y)===0)?null:Q.y0+Q.y}):d3.extent(d3.merge(K),function(Q){return Q.y0+Q.y})}else{g=(u.yScale==="log")?d3.extent(d3.merge(K),function(Q){return(Q.y===0)?null:Q.y}):d3.extent(d3.merge(K),function(Q){return Q.y})}if(u.yScale==="log"){if(g[0]===undefined){g=[0.0095,0.0105]}else{if(g[0]===g[1]){g[0]*=0.9}}i.domain([g[0],g[1]]);var P=i.invert(c);E.domain([P,g[1]])}else{E.domain([(g[0]>0)?0:g[0],g[1]]);i.domain(E.domain())}function O(U,T,S){const R=15;const Q=Math.pow(10,Math.round(Math.log(U)/Math.LN10));if(!(Math.abs(Q-U)<0.000001)&&((Math.abs(E(Q)-E(U))