@d3fc/d3fc-chart
Advanced tools
Comparing version 2.5.7 to 2.5.8
@@ -925,2 +925,6 @@ (function (global, factory) { | ||
axis.orient = function () { | ||
return orient; | ||
}; | ||
return axis; | ||
@@ -927,0 +931,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-path"),require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-scale","d3-selection","d3-shape","d3-path","d3-array"],n):n(t.fc=t.fc||{},t.d3,t.d3,t.d3,t.d3,t.d3)}(this,function(t,n,e,r,i,a){"use strict";function o(){var t=arguments;return function(n,e){for(var r=0,i=t.length;r<i;r++)if(null==t[r](n,e))return!1;return!0}}var c=function(t,n,e){var r=n[e];if("function"!=typeof r)throw new Error("Attempt to rebind "+e+" which isn't a function on the source object");return function(){for(var e=arguments.length,i=Array(e),a=0;a<e;a++)i[a]=arguments[a];var o=r.apply(n,i);return o===n?t:o}},l=function(t,n){for(var e=arguments.length,r=Array(e>2?e-2:0),i=2;i<e;i++)r[i-2]=arguments[i];var a=!0,o=!1,l=void 0;try{for(var u,f=r[Symbol.iterator]();!(a=(u=f.next()).done);a=!0){var s=u.value;t[s]=c(t,n,s)}}catch(t){o=!0,l=t}finally{try{!a&&f.return&&f.return()}finally{if(o)throw l}}return t},u=function(t){return function(n){return t.reduce(function(t,n){return t&&n(t)},n)}},f=function(t,n){for(var e=arguments.length,r=Array(e>2?e-2:0),i=2;i<e;i++)r[i-2]=arguments[i];var a=u(r),o=!0,l=!1,f=void 0;try{for(var s,d=Object.keys(n)[Symbol.iterator]();!(o=(s=d.next()).done);o=!0){var g=s.value,h=a(g);h&&(t[h]=c(t,n,g))}}catch(t){l=!0,f=t}finally{try{!o&&d.return&&d.return()}finally{if(l)throw f}}return t},s=function(t){return t.map(function(t){return"string"==typeof t?new RegExp("^"+t+"$"):t})},d=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return n=s(n),function(t){return n.every(function(n){return!n.test(t)})&&t}},g=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return n=s(n),function(t){return n.some(function(n){return n.test(t)})&&t}},h=function(t){return t[0].toUpperCase()+t.slice(1)},v=function(t){return function(n){return t+h(n)}},m=function(t,n){t=t||"g";var e=function(t,n){return n},r=null,i=function(i,a){a=a||function(t){return t};var o=i.selection?i:null;o&&(i=i.selection());var c=i.selectAll(function(t,n,e){return Array.from(e[n].childNodes).filter(function(t){return 1===t.nodeType})}).filter(null==n?t:t+"."+n),l=c.data(a,e),u=l.enter().append(t).attr("class",n),f=l.exit();l=l.merge(u);var s=o||r;return s&&(l=l.transition(s).style("opacity",1),u.style("opacity",1e-6),f=f.transition(s).style("opacity",1e-6)),f.remove(),l.enter=function(){return u},l.exit=function(){return f},l};return i.element=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],i):t},i.className=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],i):n},i.key=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],i):e},i.transition=function(){return arguments.length?(r=arguments.length<=0?void 0:arguments[0],i):r},i},y=function(t){return"function"==typeof t?t:function(){return t}},p=function(t,n){switch(t){case"left":return n/2;case"right":return-n/2;default:return 0}},x=function(t){var n=Object.assign({},t),e=function(){};return Object.keys(n).forEach(function(t){e[t]=function(){return arguments.length?(n[t]=arguments.length<=0?void 0:arguments[0],e):n[t]}}),e},b=function(){var t=function(){return 0},e=function(t){return t.x},r=function(t){return t.y},i="center",a=function(){return 5},c="vertical",l=x({decorate:function(){},defined:function(n,i){return o(t,e,r)(n,i)},xScale:n.scaleIdentity(),yScale:n.scaleIdentity()});return l.values=function(n,o){var u=a(n,o),f=p(i,u),s=l.xScale(),d=l.yScale();if("vertical"===c){var g=d(r(n,o),o),h=d(t(n,o),o),v=s(e(n,o),o)+f;return{d:n,x:v,y:g,y0:h,width:u,height:g-h,origin:[v,g],baseOrigin:[v,h],transposedX:v,transposedY:g}}var m=s(r(n,o),o),y=s(t(n,o),o),x=d(e(n,o),o)+f;return{d:n,x:x,y:m,y0:y,width:u,height:m-y,origin:[m,x],baseOrigin:[y,x],transposedX:m,transposedY:x}},l.baseValue=function(){return arguments.length?(t=y(arguments.length<=0?void 0:arguments[0]),l):t},l.crossValue=function(){return arguments.length?(e=y(arguments.length<=0?void 0:arguments[0]),l):e},l.mainValue=function(){return arguments.length?(r=y(arguments.length<=0?void 0:arguments[0]),l):r},l.bandwidth=function(){return arguments.length?(a=y(arguments.length<=0?void 0:arguments[0]),l):a},l.align=function(){return arguments.length?(i=arguments.length<=0?void 0:arguments[0],l):i},l.orient=function(){return arguments.length?(c=arguments.length<=0?void 0:arguments[0],l):c},l},w={red:"#c60",green:"#6c0",black:"#000",gray:"#ddd",darkGray:"#999"},k=function(){var t=b(),n=r.line().x(function(n,e){return t.values(n,e).transposedX}).y(function(n,e){return t.values(n,e).transposedY}),i=m("path","line"),a=function(r){r.selection&&i.transition(r),n.defined(t.defined()),r.each(function(r,a,o){var c=i(e.select(o[a]),[r]);c.enter().attr("fill","none").attr("stroke",w.black),c.attr("d",n),t.decorate()(c,r,a)})};return f(a,t,d("baseValue","bandwidth","align")),l(a,i,"key"),l(a,n,"curve"),a},S=function(){var t=b(),n=r.line().x(function(n,e){return t.values(n,e).transposedX}).y(function(n,e){return t.values(n,e).transposedY}),e=function(e){var r=n.context();r.beginPath(),n.defined(t.defined())(e),r.strokeStyle=w.black,r.fillStyle="transparent",t.decorate()(r,e),r.fill(),r.stroke(),r.closePath()};return f(e,t,d("baseValue","bandwidth","align")),l(e,n,"curve","context"),e},A=function(){var t=[],e=function(t){return t},r=function(t,n){return n},i=x({decorate:function(){},xScale:n.scaleIdentity(),yScale:n.scaleIdentity()});return i.mapping=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],i):e},i.key=function(){return arguments.length?(r=arguments.length<=0?void 0:arguments[0],i):r},i.series=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],i):t},i},O=function(){var t=A(),n=m("g"),r=m("g","multi"),i=function(i){i.selection&&(r.transition(i),n.transition(i));var a=t.mapping(),o=t.series(),c=t.xScale(),l=t.yScale();i.each(function(i,u,f){var s=r(e.select(f[u]),o);s.each(function(t,r,u){t.xScale(c).yScale(l);var f=a(i,r,o);n(e.select(u[r]),[f]).call(t)}),(s.selection?s.selection():s).order(),t.decorate()(s,i,u)})};return f(i,t),l(i,r,"key"),i},j=function(){var t=null,n=A(),e=function(e){var r=n.mapping(),i=n.series(),a=n.xScale(),o=n.yScale();i.forEach(function(c,l){var u=r(e,l,i);c.context(t).xScale(a).yScale(o);var f=void 0;c.decorate?(f=c.decorate(),c.decorate(function(t,r,i){n.decorate()(t,e,l),f(t,r,i)})):n.decorate()(t,e,l),c(u),f&&c.decorate(f)})};return e.context=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],e):t},f(e,n),e},_=function(){function t(t,n){var e=[],r=!0,i=!1,a=void 0;try{for(var o,c=t[Symbol.iterator]();!(r=(o=c.next()).done)&&(e.push(o.value),!n||e.length!==n);r=!0);}catch(t){i=!0,a=t}finally{try{!r&&c.return&&c.return()}finally{if(i)throw a}}return e}return function(n,e){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return t(n,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),P=function(t){if(Array.isArray(t)){for(var n=0,e=Array(t.length);n<t.length;n++)e[n]=t[n];return e}return Array.from(t)},z=function(t){return t},C=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=[10],o=null,c=function(){},l=null,u=6,f=6,s=3,d=r.line(),g=m("g","tick").key(z),h=m("path","domain"),v=function(){return{offset:[0,f+s]}},y=function(){return{path:[[0,0],[0,f]]}},p=i.labelOffset||v,x=i.tickPath||y,b=function(t,n){var e=0;return t.bandwidth&&(e=t.bandwidth()/2,t.round()&&(e=Math.round(e))),function(r){return n(t(r)+e,0)}},w=function(t,n){return S()?"translate("+n+", "+t+")":"translate("+t+", "+n+")"},k=function(t){return S()?t.map(function(t){return[t[1],t[0]]}):t},S=function(){return"left"===t||"right"===t},A=function(t,e,r){return n[t]?n[t].apply(n,e):r},O=function(r){r.selection&&(g.transition(r),h.transition(r)),r.each(function(r,i,f){var s=f[i],v=e.select(s);s.__scale__||v.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor","right"===t?"start":"left"===t?"end":"middle");var m=s.__scale__||n;s.__scale__=n.copy();var y=null==o?A("ticks",a,n.domain()):o,O=null==l?A("tickFormat",a,z):l,j="bottom"===t||"right"===t?1:-1,C=function(t){var n=_(t,2),e=n[0],r=n[1];return[e,j*r]},I=n.range(),V=k([[I[0],j*u],[I[0],0],[I[1],0],[I[1],j*u]]);h(v,[r]).attr("d",d(V)).attr("stroke","#000");var q=g(v,y),L=y.map(function(t,n){return p(t,n,y)}),E=y.map(function(t,n){return x(t,n,y)});q.enter().attr("transform",b(m,w)).append("path").attr("stroke","#000"),q.enter().append("text").attr("transform",function(t,n){return w.apply(void 0,P(C(L[n].offset)))}).attr("fill","#000"),q.exit().attr("transform",b(n,w)),q.select("path").attr("visibility",function(t,n){return E[n].hidden&&"hidden"}).attr("d",function(t,n){return d(k(E[n].path.map(C)))}),q.select("text").attr("visibility",function(t,n){return L[n].hidden&&"hidden"}).attr("transform",function(t,n){return w.apply(void 0,P(C(L[n].offset)))}).attr("dy",function(){var n="0em";return S()?n="0.32em":"bottom"===t&&(n="0.71em"),n}).text(O),q.attr("transform",b(n,w)),c(q,r,i)})};return O.tickFormat=function(){return arguments.length?(l=arguments.length<=0?void 0:arguments[0],O):l},O.tickSize=function(){return arguments.length?(f=u=Number(arguments.length<=0?void 0:arguments[0]),O):f},O.tickSizeInner=function(){return arguments.length?(f=Number(arguments.length<=0?void 0:arguments[0]),O):f},O.tickSizeOuter=function(){return arguments.length?(u=Number(arguments.length<=0?void 0:arguments[0]),O):u},O.tickPadding=function(){return arguments.length?(s=arguments.length<=0?void 0:arguments[0],O):s},O.decorate=function(){return arguments.length?(c=arguments.length<=0?void 0:arguments[0],O):c},O.scale=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],O):n},O.ticks=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return a=[].concat(n),O},O.tickArguments=function(){return arguments.length?(a=null==(arguments.length<=0?void 0:arguments[0])?[]:[].concat(P(arguments.length<=0?void 0:arguments[0])),O):a.slice()},O.tickValues=function(){return arguments.length?(o=null==(arguments.length<=0?void 0:arguments[0])?[]:[].concat(P(arguments.length<=0?void 0:arguments[0])),O):o.slice()},O},I=function(t,n){var e=!1,r=function(t,r,a){var o=0,c=i.tickSizeInner()+i.tickPadding(),l=!1;if(e){var u=n(t),f=r<a.length-1?n(a[r+1]):n.range()[1];o=(f-u)/2,c=i.tickPadding(),l=r===a.length-1&&u===f}return{offset:[o,c],hidden:l}},i=C(t,n,{labelOffset:r}),a=function(t){return i(t)};return a.tickCenterLabel=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],a):e},f(a,i),a},V=function(t){return I("top",t)},q=function(t){return I("bottom",t)},L=function(t){return I("left",t)},E=function(t){return I("right",t)},F=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];var r={},i=function(t){var n=!0,e=!1,i=void 0;try{for(var a,o=Object.keys(r)[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var c=a.value;t[c](r[c])}}catch(t){e=!0,i=t}finally{try{!n&&o.return&&o.return()}finally{if(e)throw i}}return t},a=!0,o=!1,c=void 0;try{for(var l,u=n[Symbol.iterator]();!(a=(l=u.next()).done);a=!0){var f=l.value;!function(t){i[t]=function(){return arguments.length?(r[t]=arguments.length<=0?void 0:arguments[0],i):r[t]}}(f)}}catch(t){o=!0,c=t}finally{try{!a&&u.return&&u.return()}finally{if(o)throw c}}return i},N="d3fc-group.cartesian-chart{width:100%;height:100%;overflow:hidden;display:grid;display:-ms-grid;grid-template-columns:minmax(1em,max-content) auto 1fr auto minmax(1em,max-content);-ms-grid-columns:minmax(1em,max-content) auto 1fr auto minmax(1em,max-content);grid-template-rows:minmax(1em,max-content) auto 1fr auto minmax(1em,max-content);-ms-grid-rows:minmax(1em,max-content) auto 1fr auto minmax(1em,max-content);}\nd3fc-group.cartesian-chart>.top-label{align-self:center;-ms-grid-column-align:center;justify-self:center;-ms-grid-row-align:center;grid-column:3;-ms-grid-column:3;-ms-grid-row:1;-ms-grid-row:1;}\nd3fc-group.cartesian-chart>.top-axis{height:2em;grid-column:3;-ms-grid-column:3;grid-row:2;-ms-grid-row:2;}\nd3fc-group.cartesian-chart>.left-label{align-self:center;-ms-grid-column-align:center;justify-self:center;-ms-grid-row-align:center;grid-column:1;-ms-grid-column:1;grid-row:3;-ms-grid-row:3;}\nd3fc-group.cartesian-chart>.left-axis{width:3em;grid-column:2;-ms-grid-column:2;grid-row:3;-ms-grid-row:3;}\nd3fc-group.cartesian-chart>.plot-area{overflow:hidden;grid-column:3;-ms-grid-column:3;grid-row:3;-ms-grid-row:3;}\nd3fc-group.cartesian-chart>.right-axis{width:3em;grid-column:4;-ms-grid-column:4;grid-row:3;-ms-grid-row:3;}\nd3fc-group.cartesian-chart>.right-label{align-self:center;-ms-grid-column-align:center;justify-self:center;-ms-grid-row-align:center;grid-column:5;-ms-grid-column:5;grid-row:3;-ms-grid-row:3;}\nd3fc-group.cartesian-chart>.bottom-axis{height:2em;grid-column:3;-ms-grid-column:3;grid-row:4;-ms-grid-row:4;}\nd3fc-group.cartesian-chart>.bottom-label{align-self:center;-ms-grid-column-align:center;justify-self:center;-ms-grid-row-align:center;grid-column:3;-ms-grid-column:3;grid-row:5;-ms-grid-row:5;}",X=document.createElement("style");X.setAttribute("type","text/css"),document.querySelector("head").appendChild(X),X.styleSheet?X.styleSheet.cssText+=N:X.textContent+=N;var Y=function(t){return"function"==typeof t?t:function(){return t}},T=function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=B.apply(void 0,n),a=i.xScale,o=i.yScale,c=i.xAxis,l=i.yAxis,u=Y(""),s=Y(""),g=Y(null),h=Y(null),y=Y("right"),p=Y("bottom"),x=j(),b=O(),w=F("tickFormat","ticks","tickArguments","tickSize","tickSizeInner","tickSizeOuter","tickValues","tickPadding","tickCenterLabel"),k=function(){},S=F("tickFormat","ticks","tickArguments","tickSize","tickSizeInner","tickSizeOuter","tickValues","tickPadding","tickCenterLabel"),A=function(){},_=function(){},P=m("d3fc-group","cartesian-chart"),z=m("d3fc-svg","x-axis").key(function(t){return t}),C=m("d3fc-svg","y-axis").key(function(t){return t}),I=m("div","x-label").key(function(t){return t}),V=m("div","y-label").key(function(t){return t}),q=function(t){return function(n){return t.selection?n.transition(t):n}},L=function(t){var n=q(t);t.each(function(t,r,i){var f=P(e.select(i[r]),[t]);f.enter().attr("auto-resize","").html('<d3fc-svg class="plot-area"></d3fc-svg><d3fc-canvas class="plot-area"></d3fc-canvas>'),I(f,[p(t)]).attr("class",function(t){return"x-label "+t+"-label"}).text(u(t)),V(f,[y(t)]).attr("class",function(t){return"y-label "+t+"-label"}).text(s(t)),z(f,[p(t)]).attr("class",function(t){return"x-axis "+t+"-axis"}).style("height",g(t)).on("measure",function(t,n,r){var i=e.event.detail,o=i.width,c=i.height;"top"===t&&e.select(r[n]).select("svg").attr("viewBox","0 "+-c+" "+o+" "+c),a.range([0,o])}).on("draw",function(t,r,i){var o="top"===t?c.top(a):c.bottom(a);o.decorate(k),n(e.select(i[r])).select("svg").call(w(o))}),C(f,[y(t)]).attr("class",function(t){return"y-axis "+t+"-axis"}).style("width",h(t)).on("measure",function(t,n,r){var i=e.event.detail,a=i.width,c=i.height;"left"===t&&e.select(r[n]).select("svg").attr("viewBox",-a+" 0 "+a+" "+c),o.range([c,0])}).on("draw",function(t,r,i){var a="left"===t?l.left(o):l.right(o);a.decorate(A),n(e.select(i[r])).select("svg").call(S(a))}),f.select("d3fc-canvas.plot-area").on("draw",function(t,n,r){var i=e.select(r[n]).select("canvas").node();x.context(i.getContext("2d")).xScale(a).yScale(o),x(t)}),f.select("d3fc-svg.plot-area").on("draw",function(t,r,i){b.xScale(a).yScale(o),n(e.select(i[r])).select("svg").call(b)}),f.each(function(t,n,e){return e[n].requestRedraw()}),_(f,t,r)})},E=d(/range\w*/,/tickFormat/);return f(L,a,E,v("x")),f(L,o,E,v("y")),f(L,w,v("x")),f(L,S,v("y")),L.xOrient=function(){return arguments.length?(p=Y(arguments.length<=0?void 0:arguments[0]),L):p},L.yOrient=function(){return arguments.length?(y=Y(arguments.length<=0?void 0:arguments[0]),L):y},L.xDecorate=function(){return arguments.length?(k=arguments.length<=0?void 0:arguments[0],L):k},L.yDecorate=function(){return arguments.length?(A=arguments.length<=0?void 0:arguments[0],L):A},L.xLabel=function(){return arguments.length?(u=Y(arguments.length<=0?void 0:arguments[0]),L):u},L.yLabel=function(){return arguments.length?(s=Y(arguments.length<=0?void 0:arguments[0]),L):s},L.xAxisHeight=function(){return arguments.length?(g=Y(arguments.length<=0?void 0:arguments[0]),L):g},L.yAxisWidth=function(){return arguments.length?(h=Y(arguments.length<=0?void 0:arguments[0]),L):h},L.canvasPlotArea=function(){return arguments.length?(x=arguments.length<=0?void 0:arguments[0],L):x},L.svgPlotArea=function(){return arguments.length?(b=arguments.length<=0?void 0:arguments[0],L):b},L.decorate=function(){return arguments.length?(_=arguments.length<=0?void 0:arguments[0],L):_},L},B=function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];var i={xScale:n.scaleIdentity(),yScale:n.scaleIdentity(),xAxis:{bottom:q,top:V},yAxis:{right:E,left:L}};return 1!==e.length||e[0].domain||e[0].range?Object.assign(i,{xScale:e[0]||i.xScale,yScale:e[1]||i.yScale}):Object.assign(i,e[0])},D=function(t){return"function"==typeof t?t:function(){return t}},M=function(t,n){return function(){for(var e=arguments.length,r=Array(e),i=0;i<e;i++)r[i]=arguments[i];var a=D(""),o=D(""),c=n,l=function(){},u=T.apply(void 0,r),s=function(n){t(u,c),u.decorate(function(t,n,e){t.enter().select(".x-label").style("height","1em").style("line-height","1em");var r=u.yOrient()(n);t.enter().append("div").attr("class","y-label-container").style("grid-column","left"===r?1:5).style("-ms-grid-column","left"===r?1:5).style("grid-row",3).style("-ms-grid-row",3).style("width","1em").style("display","flex").style("align-items","center").style("justify-content","center").append("div").attr("class","y-label").style("transform","rotate(-90deg)"),t.select(".y-label-container>.y-label").text(o),t.select(".top-label").style("margin-top","2em"),t.enter().append("div").attr("class","chart-label").style("grid-column",3).style("-ms-grid-column",3).style("grid-row",1).style("-ms-grid-row",1).style("height","2em").style("line-height","2em").style("text-align","center"),t.select(".chart-label").text(a(n)),l(t,n,e)}),n.call(u)};return f(s,u,g(/^x/,/^y/)),s.chartLabel=function(){return arguments.length?(a=D(arguments.length<=0?void 0:arguments[0]),s):a},s.yLabel=function(){return arguments.length?(o=D(arguments.length<=0?void 0:arguments[0]),s):o},s.plotArea=function(){return arguments.length?(c=arguments.length<=0?void 0:arguments[0],s):c},s.decorate=function(){return arguments.length?(l=arguments.length<=0?void 0:arguments[0],s):l},s}},R=M(function(t,n){return t.svgPlotArea(n)},k),G=M(function(t,n){return t.canvasPlotArea(n)},S);t.chartSvgCartesian=R,t.chartCanvasCartesian=G,t.chartCartesian=T,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-path"),require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-scale","d3-selection","d3-shape","d3-path","d3-array"],n):n(t.fc=t.fc||{},t.d3,t.d3,t.d3,t.d3,t.d3)}(this,function(t,n,e,r,i,a){"use strict";function o(){var t=arguments;return function(n,e){for(var r=0,i=t.length;r<i;r++)if(null==t[r](n,e))return!1;return!0}}var c=function(t,n,e){var r=n[e];if("function"!=typeof r)throw new Error("Attempt to rebind "+e+" which isn't a function on the source object");return function(){for(var e=arguments.length,i=Array(e),a=0;a<e;a++)i[a]=arguments[a];var o=r.apply(n,i);return o===n?t:o}},l=function(t,n){for(var e=arguments.length,r=Array(e>2?e-2:0),i=2;i<e;i++)r[i-2]=arguments[i];var a=!0,o=!1,l=void 0;try{for(var u,f=r[Symbol.iterator]();!(a=(u=f.next()).done);a=!0){var s=u.value;t[s]=c(t,n,s)}}catch(t){o=!0,l=t}finally{try{!a&&f.return&&f.return()}finally{if(o)throw l}}return t},u=function(t){return function(n){return t.reduce(function(t,n){return t&&n(t)},n)}},f=function(t,n){for(var e=arguments.length,r=Array(e>2?e-2:0),i=2;i<e;i++)r[i-2]=arguments[i];var a=u(r),o=!0,l=!1,f=void 0;try{for(var s,d=Object.keys(n)[Symbol.iterator]();!(o=(s=d.next()).done);o=!0){var g=s.value,h=a(g);h&&(t[h]=c(t,n,g))}}catch(t){l=!0,f=t}finally{try{!o&&d.return&&d.return()}finally{if(l)throw f}}return t},s=function(t){return t.map(function(t){return"string"==typeof t?new RegExp("^"+t+"$"):t})},d=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return n=s(n),function(t){return n.every(function(n){return!n.test(t)})&&t}},g=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return n=s(n),function(t){return n.some(function(n){return n.test(t)})&&t}},h=function(t){return t[0].toUpperCase()+t.slice(1)},v=function(t){return function(n){return t+h(n)}},m=function(t,n){t=t||"g";var e=function(t,n){return n},r=null,i=function(i,a){a=a||function(t){return t};var o=i.selection?i:null;o&&(i=i.selection());var c=i.selectAll(function(t,n,e){return Array.from(e[n].childNodes).filter(function(t){return 1===t.nodeType})}).filter(null==n?t:t+"."+n),l=c.data(a,e),u=l.enter().append(t).attr("class",n),f=l.exit();l=l.merge(u);var s=o||r;return s&&(l=l.transition(s).style("opacity",1),u.style("opacity",1e-6),f=f.transition(s).style("opacity",1e-6)),f.remove(),l.enter=function(){return u},l.exit=function(){return f},l};return i.element=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],i):t},i.className=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],i):n},i.key=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],i):e},i.transition=function(){return arguments.length?(r=arguments.length<=0?void 0:arguments[0],i):r},i},y=function(t){return"function"==typeof t?t:function(){return t}},p=function(t,n){switch(t){case"left":return n/2;case"right":return-n/2;default:return 0}},x=function(t){var n=Object.assign({},t),e=function(){};return Object.keys(n).forEach(function(t){e[t]=function(){return arguments.length?(n[t]=arguments.length<=0?void 0:arguments[0],e):n[t]}}),e},b=function(){var t=function(){return 0},e=function(t){return t.x},r=function(t){return t.y},i="center",a=function(){return 5},c="vertical",l=x({decorate:function(){},defined:function(n,i){return o(t,e,r)(n,i)},xScale:n.scaleIdentity(),yScale:n.scaleIdentity()});return l.values=function(n,o){var u=a(n,o),f=p(i,u),s=l.xScale(),d=l.yScale();if("vertical"===c){var g=d(r(n,o),o),h=d(t(n,o),o),v=s(e(n,o),o)+f;return{d:n,x:v,y:g,y0:h,width:u,height:g-h,origin:[v,g],baseOrigin:[v,h],transposedX:v,transposedY:g}}var m=s(r(n,o),o),y=s(t(n,o),o),x=d(e(n,o),o)+f;return{d:n,x:x,y:m,y0:y,width:u,height:m-y,origin:[m,x],baseOrigin:[y,x],transposedX:m,transposedY:x}},l.baseValue=function(){return arguments.length?(t=y(arguments.length<=0?void 0:arguments[0]),l):t},l.crossValue=function(){return arguments.length?(e=y(arguments.length<=0?void 0:arguments[0]),l):e},l.mainValue=function(){return arguments.length?(r=y(arguments.length<=0?void 0:arguments[0]),l):r},l.bandwidth=function(){return arguments.length?(a=y(arguments.length<=0?void 0:arguments[0]),l):a},l.align=function(){return arguments.length?(i=arguments.length<=0?void 0:arguments[0],l):i},l.orient=function(){return arguments.length?(c=arguments.length<=0?void 0:arguments[0],l):c},l},w={red:"#c60",green:"#6c0",black:"#000",gray:"#ddd",darkGray:"#999"},k=function(){var t=b(),n=r.line().x(function(n,e){return t.values(n,e).transposedX}).y(function(n,e){return t.values(n,e).transposedY}),i=m("path","line"),a=function(r){r.selection&&i.transition(r),n.defined(t.defined()),r.each(function(r,a,o){var c=i(e.select(o[a]),[r]);c.enter().attr("fill","none").attr("stroke",w.black),c.attr("d",n),t.decorate()(c,r,a)})};return f(a,t,d("baseValue","bandwidth","align")),l(a,i,"key"),l(a,n,"curve"),a},S=function(){var t=b(),n=r.line().x(function(n,e){return t.values(n,e).transposedX}).y(function(n,e){return t.values(n,e).transposedY}),e=function(e){var r=n.context();r.beginPath(),n.defined(t.defined())(e),r.strokeStyle=w.black,r.fillStyle="transparent",t.decorate()(r,e),r.fill(),r.stroke(),r.closePath()};return f(e,t,d("baseValue","bandwidth","align")),l(e,n,"curve","context"),e},A=function(){var t=[],e=function(t){return t},r=function(t,n){return n},i=x({decorate:function(){},xScale:n.scaleIdentity(),yScale:n.scaleIdentity()});return i.mapping=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],i):e},i.key=function(){return arguments.length?(r=arguments.length<=0?void 0:arguments[0],i):r},i.series=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],i):t},i},O=function(){var t=A(),n=m("g"),r=m("g","multi"),i=function(i){i.selection&&(r.transition(i),n.transition(i));var a=t.mapping(),o=t.series(),c=t.xScale(),l=t.yScale();i.each(function(i,u,f){var s=r(e.select(f[u]),o);s.each(function(t,r,u){t.xScale(c).yScale(l);var f=a(i,r,o);n(e.select(u[r]),[f]).call(t)}),(s.selection?s.selection():s).order(),t.decorate()(s,i,u)})};return f(i,t),l(i,r,"key"),i},j=function(){var t=null,n=A(),e=function(e){var r=n.mapping(),i=n.series(),a=n.xScale(),o=n.yScale();i.forEach(function(c,l){var u=r(e,l,i);c.context(t).xScale(a).yScale(o);var f=void 0;c.decorate?(f=c.decorate(),c.decorate(function(t,r,i){n.decorate()(t,e,l),f(t,r,i)})):n.decorate()(t,e,l),c(u),f&&c.decorate(f)})};return e.context=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],e):t},f(e,n),e},_=function(){function t(t,n){var e=[],r=!0,i=!1,a=void 0;try{for(var o,c=t[Symbol.iterator]();!(r=(o=c.next()).done)&&(e.push(o.value),!n||e.length!==n);r=!0);}catch(t){i=!0,a=t}finally{try{!r&&c.return&&c.return()}finally{if(i)throw a}}return e}return function(n,e){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return t(n,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),P=function(t){if(Array.isArray(t)){for(var n=0,e=Array(t.length);n<t.length;n++)e[n]=t[n];return e}return Array.from(t)},z=function(t){return t},C=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=[10],o=null,c=function(){},l=null,u=6,f=6,s=3,d=r.line(),g=m("g","tick").key(z),h=m("path","domain"),v=function(){return{offset:[0,f+s]}},y=function(){return{path:[[0,0],[0,f]]}},p=i.labelOffset||v,x=i.tickPath||y,b=function(t,n){var e=0;return t.bandwidth&&(e=t.bandwidth()/2,t.round()&&(e=Math.round(e))),function(r){return n(t(r)+e,0)}},w=function(t,n){return S()?"translate("+n+", "+t+")":"translate("+t+", "+n+")"},k=function(t){return S()?t.map(function(t){return[t[1],t[0]]}):t},S=function(){return"left"===t||"right"===t},A=function(t,e,r){return n[t]?n[t].apply(n,e):r},O=function(r){r.selection&&(g.transition(r),h.transition(r)),r.each(function(r,i,f){var s=f[i],v=e.select(s);s.__scale__||v.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor","right"===t?"start":"left"===t?"end":"middle");var m=s.__scale__||n;s.__scale__=n.copy();var y=null==o?A("ticks",a,n.domain()):o,O=null==l?A("tickFormat",a,z):l,j="bottom"===t||"right"===t?1:-1,C=function(t){var n=_(t,2),e=n[0],r=n[1];return[e,j*r]},I=n.range(),V=k([[I[0],j*u],[I[0],0],[I[1],0],[I[1],j*u]]);h(v,[r]).attr("d",d(V)).attr("stroke","#000");var q=g(v,y),L=y.map(function(t,n){return p(t,n,y)}),E=y.map(function(t,n){return x(t,n,y)});q.enter().attr("transform",b(m,w)).append("path").attr("stroke","#000"),q.enter().append("text").attr("transform",function(t,n){return w.apply(void 0,P(C(L[n].offset)))}).attr("fill","#000"),q.exit().attr("transform",b(n,w)),q.select("path").attr("visibility",function(t,n){return E[n].hidden&&"hidden"}).attr("d",function(t,n){return d(k(E[n].path.map(C)))}),q.select("text").attr("visibility",function(t,n){return L[n].hidden&&"hidden"}).attr("transform",function(t,n){return w.apply(void 0,P(C(L[n].offset)))}).attr("dy",function(){var n="0em";return S()?n="0.32em":"bottom"===t&&(n="0.71em"),n}).text(O),q.attr("transform",b(n,w)),c(q,r,i)})};return O.tickFormat=function(){return arguments.length?(l=arguments.length<=0?void 0:arguments[0],O):l},O.tickSize=function(){return arguments.length?(f=u=Number(arguments.length<=0?void 0:arguments[0]),O):f},O.tickSizeInner=function(){return arguments.length?(f=Number(arguments.length<=0?void 0:arguments[0]),O):f},O.tickSizeOuter=function(){return arguments.length?(u=Number(arguments.length<=0?void 0:arguments[0]),O):u},O.tickPadding=function(){return arguments.length?(s=arguments.length<=0?void 0:arguments[0],O):s},O.decorate=function(){return arguments.length?(c=arguments.length<=0?void 0:arguments[0],O):c},O.scale=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],O):n},O.ticks=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return a=[].concat(n),O},O.tickArguments=function(){return arguments.length?(a=null==(arguments.length<=0?void 0:arguments[0])?[]:[].concat(P(arguments.length<=0?void 0:arguments[0])),O):a.slice()},O.tickValues=function(){return arguments.length?(o=null==(arguments.length<=0?void 0:arguments[0])?[]:[].concat(P(arguments.length<=0?void 0:arguments[0])),O):o.slice()},O.orient=function(){return t},O},I=function(t,n){var e=!1,r=function(t,r,a){var o=0,c=i.tickSizeInner()+i.tickPadding(),l=!1;if(e){var u=n(t),f=r<a.length-1?n(a[r+1]):n.range()[1];o=(f-u)/2,c=i.tickPadding(),l=r===a.length-1&&u===f}return{offset:[o,c],hidden:l}},i=C(t,n,{labelOffset:r}),a=function(t){return i(t)};return a.tickCenterLabel=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],a):e},f(a,i),a},V=function(t){return I("top",t)},q=function(t){return I("bottom",t)},L=function(t){return I("left",t)},E=function(t){return I("right",t)},F=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];var r={},i=function(t){var n=!0,e=!1,i=void 0;try{for(var a,o=Object.keys(r)[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var c=a.value;t[c](r[c])}}catch(t){e=!0,i=t}finally{try{!n&&o.return&&o.return()}finally{if(e)throw i}}return t},a=!0,o=!1,c=void 0;try{for(var l,u=n[Symbol.iterator]();!(a=(l=u.next()).done);a=!0){var f=l.value;!function(t){i[t]=function(){return arguments.length?(r[t]=arguments.length<=0?void 0:arguments[0],i):r[t]}}(f)}}catch(t){o=!0,c=t}finally{try{!a&&u.return&&u.return()}finally{if(o)throw c}}return i},N="d3fc-group.cartesian-chart{width:100%;height:100%;overflow:hidden;display:grid;display:-ms-grid;grid-template-columns:minmax(1em,max-content) auto 1fr auto minmax(1em,max-content);-ms-grid-columns:minmax(1em,max-content) auto 1fr auto minmax(1em,max-content);grid-template-rows:minmax(1em,max-content) auto 1fr auto minmax(1em,max-content);-ms-grid-rows:minmax(1em,max-content) auto 1fr auto minmax(1em,max-content);}\nd3fc-group.cartesian-chart>.top-label{align-self:center;-ms-grid-column-align:center;justify-self:center;-ms-grid-row-align:center;grid-column:3;-ms-grid-column:3;-ms-grid-row:1;-ms-grid-row:1;}\nd3fc-group.cartesian-chart>.top-axis{height:2em;grid-column:3;-ms-grid-column:3;grid-row:2;-ms-grid-row:2;}\nd3fc-group.cartesian-chart>.left-label{align-self:center;-ms-grid-column-align:center;justify-self:center;-ms-grid-row-align:center;grid-column:1;-ms-grid-column:1;grid-row:3;-ms-grid-row:3;}\nd3fc-group.cartesian-chart>.left-axis{width:3em;grid-column:2;-ms-grid-column:2;grid-row:3;-ms-grid-row:3;}\nd3fc-group.cartesian-chart>.plot-area{overflow:hidden;grid-column:3;-ms-grid-column:3;grid-row:3;-ms-grid-row:3;}\nd3fc-group.cartesian-chart>.right-axis{width:3em;grid-column:4;-ms-grid-column:4;grid-row:3;-ms-grid-row:3;}\nd3fc-group.cartesian-chart>.right-label{align-self:center;-ms-grid-column-align:center;justify-self:center;-ms-grid-row-align:center;grid-column:5;-ms-grid-column:5;grid-row:3;-ms-grid-row:3;}\nd3fc-group.cartesian-chart>.bottom-axis{height:2em;grid-column:3;-ms-grid-column:3;grid-row:4;-ms-grid-row:4;}\nd3fc-group.cartesian-chart>.bottom-label{align-self:center;-ms-grid-column-align:center;justify-self:center;-ms-grid-row-align:center;grid-column:3;-ms-grid-column:3;grid-row:5;-ms-grid-row:5;}",X=document.createElement("style");X.setAttribute("type","text/css"),document.querySelector("head").appendChild(X),X.styleSheet?X.styleSheet.cssText+=N:X.textContent+=N;var Y=function(t){return"function"==typeof t?t:function(){return t}},T=function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=B.apply(void 0,n),a=i.xScale,o=i.yScale,c=i.xAxis,l=i.yAxis,u=Y(""),s=Y(""),g=Y(null),h=Y(null),y=Y("right"),p=Y("bottom"),x=j(),b=O(),w=F("tickFormat","ticks","tickArguments","tickSize","tickSizeInner","tickSizeOuter","tickValues","tickPadding","tickCenterLabel"),k=function(){},S=F("tickFormat","ticks","tickArguments","tickSize","tickSizeInner","tickSizeOuter","tickValues","tickPadding","tickCenterLabel"),A=function(){},_=function(){},P=m("d3fc-group","cartesian-chart"),z=m("d3fc-svg","x-axis").key(function(t){return t}),C=m("d3fc-svg","y-axis").key(function(t){return t}),I=m("div","x-label").key(function(t){return t}),V=m("div","y-label").key(function(t){return t}),q=function(t){return function(n){return t.selection?n.transition(t):n}},L=function(t){var n=q(t);t.each(function(t,r,i){var f=P(e.select(i[r]),[t]);f.enter().attr("auto-resize","").html('<d3fc-svg class="plot-area"></d3fc-svg><d3fc-canvas class="plot-area"></d3fc-canvas>'),I(f,[p(t)]).attr("class",function(t){return"x-label "+t+"-label"}).text(u(t)),V(f,[y(t)]).attr("class",function(t){return"y-label "+t+"-label"}).text(s(t)),z(f,[p(t)]).attr("class",function(t){return"x-axis "+t+"-axis"}).style("height",g(t)).on("measure",function(t,n,r){var i=e.event.detail,o=i.width,c=i.height;"top"===t&&e.select(r[n]).select("svg").attr("viewBox","0 "+-c+" "+o+" "+c),a.range([0,o])}).on("draw",function(t,r,i){var o="top"===t?c.top(a):c.bottom(a);o.decorate(k),n(e.select(i[r])).select("svg").call(w(o))}),C(f,[y(t)]).attr("class",function(t){return"y-axis "+t+"-axis"}).style("width",h(t)).on("measure",function(t,n,r){var i=e.event.detail,a=i.width,c=i.height;"left"===t&&e.select(r[n]).select("svg").attr("viewBox",-a+" 0 "+a+" "+c),o.range([c,0])}).on("draw",function(t,r,i){var a="left"===t?l.left(o):l.right(o);a.decorate(A),n(e.select(i[r])).select("svg").call(S(a))}),f.select("d3fc-canvas.plot-area").on("draw",function(t,n,r){var i=e.select(r[n]).select("canvas").node();x.context(i.getContext("2d")).xScale(a).yScale(o),x(t)}),f.select("d3fc-svg.plot-area").on("draw",function(t,r,i){b.xScale(a).yScale(o),n(e.select(i[r])).select("svg").call(b)}),f.each(function(t,n,e){return e[n].requestRedraw()}),_(f,t,r)})},E=d(/range\w*/,/tickFormat/);return f(L,a,E,v("x")),f(L,o,E,v("y")),f(L,w,v("x")),f(L,S,v("y")),L.xOrient=function(){return arguments.length?(p=Y(arguments.length<=0?void 0:arguments[0]),L):p},L.yOrient=function(){return arguments.length?(y=Y(arguments.length<=0?void 0:arguments[0]),L):y},L.xDecorate=function(){return arguments.length?(k=arguments.length<=0?void 0:arguments[0],L):k},L.yDecorate=function(){return arguments.length?(A=arguments.length<=0?void 0:arguments[0],L):A},L.xLabel=function(){return arguments.length?(u=Y(arguments.length<=0?void 0:arguments[0]),L):u},L.yLabel=function(){return arguments.length?(s=Y(arguments.length<=0?void 0:arguments[0]),L):s},L.xAxisHeight=function(){return arguments.length?(g=Y(arguments.length<=0?void 0:arguments[0]),L):g},L.yAxisWidth=function(){return arguments.length?(h=Y(arguments.length<=0?void 0:arguments[0]),L):h},L.canvasPlotArea=function(){return arguments.length?(x=arguments.length<=0?void 0:arguments[0],L):x},L.svgPlotArea=function(){return arguments.length?(b=arguments.length<=0?void 0:arguments[0],L):b},L.decorate=function(){return arguments.length?(_=arguments.length<=0?void 0:arguments[0],L):_},L},B=function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];var i={xScale:n.scaleIdentity(),yScale:n.scaleIdentity(),xAxis:{bottom:q,top:V},yAxis:{right:E,left:L}};return 1!==e.length||e[0].domain||e[0].range?Object.assign(i,{xScale:e[0]||i.xScale,yScale:e[1]||i.yScale}):Object.assign(i,e[0])},D=function(t){return"function"==typeof t?t:function(){return t}},M=function(t,n){return function(){for(var e=arguments.length,r=Array(e),i=0;i<e;i++)r[i]=arguments[i];var a=D(""),o=D(""),c=n,l=function(){},u=T.apply(void 0,r),s=function(n){t(u,c),u.decorate(function(t,n,e){t.enter().select(".x-label").style("height","1em").style("line-height","1em");var r=u.yOrient()(n);t.enter().append("div").attr("class","y-label-container").style("grid-column","left"===r?1:5).style("-ms-grid-column","left"===r?1:5).style("grid-row",3).style("-ms-grid-row",3).style("width","1em").style("display","flex").style("align-items","center").style("justify-content","center").append("div").attr("class","y-label").style("transform","rotate(-90deg)"),t.select(".y-label-container>.y-label").text(o),t.select(".top-label").style("margin-top","2em"),t.enter().append("div").attr("class","chart-label").style("grid-column",3).style("-ms-grid-column",3).style("grid-row",1).style("-ms-grid-row",1).style("height","2em").style("line-height","2em").style("text-align","center"),t.select(".chart-label").text(a(n)),l(t,n,e)}),n.call(u)};return f(s,u,g(/^x/,/^y/)),s.chartLabel=function(){return arguments.length?(a=D(arguments.length<=0?void 0:arguments[0]),s):a},s.yLabel=function(){return arguments.length?(o=D(arguments.length<=0?void 0:arguments[0]),s):o},s.plotArea=function(){return arguments.length?(c=arguments.length<=0?void 0:arguments[0],s):c},s.decorate=function(){return arguments.length?(l=arguments.length<=0?void 0:arguments[0],s):l},s}},R=M(function(t,n){return t.svgPlotArea(n)},k),G=M(function(t,n){return t.canvasPlotArea(n)},S);t.chartSvgCartesian=R,t.chartCanvasCartesian=G,t.chartCartesian=T,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -6,2 +6,10 @@ # Change Log | ||
<a name="2.5.8"></a> | ||
## [2.5.8](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-chart@2.5.7...@d3fc/d3fc-chart@2.5.8) (2019-05-06) | ||
**Note:** Version bump only for package @d3fc/d3fc-chart | ||
<a name="2.5.7"></a> | ||
@@ -8,0 +16,0 @@ ## [2.5.7](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-chart@2.5.6...@d3fc/d3fc-chart@2.5.7) (2019-05-01) |
{ | ||
"name": "@d3fc/d3fc-chart", | ||
"version": "2.5.7", | ||
"version": "2.5.8", | ||
"description": "A simple Cartesian chart component that renders to canvas or SVG.", | ||
@@ -31,3 +31,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@d3fc/d3fc-axis": "^2.1.1", | ||
"@d3fc/d3fc-axis": "^2.2.0", | ||
"@d3fc/d3fc-data-join": "^5.0.7", | ||
@@ -34,0 +34,0 @@ "@d3fc/d3fc-element": "^5.2.2", |
136822
1921
Updated@d3fc/d3fc-axis@^2.2.0