@d3fc/d3fc-chart
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -420,3 +420,3 @@ (function (global, factory) { | ||
var lineData = d3Shape.line().defined(base.defined()).x(function (d, i) { | ||
var lineData = d3Shape.line().x(function (d, i) { | ||
return base.values(d, i).transposedX; | ||
@@ -435,2 +435,4 @@ }).y(function (d, i) { | ||
lineData.defined(base.defined()); | ||
selection$$1.each(function (data, index, group) { | ||
@@ -457,3 +459,3 @@ var path$$1 = join(d3Selection.select(group[index]), [data]); | ||
var lineData = d3Shape.line().defined(base.defined()).x(function (d, i) { | ||
var lineData = d3Shape.line().x(function (d, i) { | ||
return base.values(d, i).transposedX; | ||
@@ -468,3 +470,3 @@ }).y(function (d, i) { | ||
context.beginPath(); | ||
lineData(data); | ||
lineData.defined(base.defined())(data); | ||
context.strokeStyle = colors.black; | ||
@@ -471,0 +473,0 @@ context.fillStyle = 'transparent'; |
@@ -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,o){"use strict";function a(){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),o=0;o<e;o++)i[o]=arguments[o];var a=r.apply(n,i);return a===n?t:a}},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 o=!0,a=!1,l=void 0;try{for(var u,s=r[Symbol.iterator]();!(o=(u=s.next()).done);o=!0){var f=u.value;t[f]=c(t,n,f)}}catch(t){a=!0,l=t}finally{try{!o&&s.return&&s.return()}finally{if(a)throw l}}return t},u=function(t){return function(n){return t.reduce(function(t,n){return t&&n(t)},n)}},s=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 o=u(r),a=!0,l=!1,s=void 0;try{for(var f,d=Object.keys(n)[Symbol.iterator]();!(a=(f=d.next()).done);a=!0){var g=f.value,h=o(g);h&&(t[h]=c(t,n,g))}}catch(t){l=!0,s=t}finally{try{!a&&d.return&&d.return()}finally{if(l)throw s}}return t},f=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=f(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=f(n),function(t){return n.some(function(n){return n.test(t)})&&t}},h=function(t){return t[0].toUpperCase()+t.slice(1)},m=function(t){return function(n){return t+h(n)}},v=function(t,n){t=t||"g";var e=function(t,n){return n},r=null,i=function(i,o){o=o||function(t){return t};var a=i.selection?i:null;a&&(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(o,e),u=l.enter().append(t).attr("class",n),s=l.exit();l=l.merge(u);var f=a||r;return f&&(l=l.transition(f).style("opacity",1),u.style("opacity",1e-6),s=s.transition(f).style("opacity",1e-6)),s.remove(),l.enter=function(){return u},l.exit=function(){return s},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},w=function(){var t=function(){return 0},e=function(t){return t.x},r=function(t){return t.y},i="center",o=function(){return 5},c="vertical",l=x({decorate:function(){},defined:function(n,i){return a(t,e,r)(n,i)},xScale:n.scaleIdentity(),yScale:n.scaleIdentity()});return l.values=function(n,a){var u=o(n,a),s=p(i,u),f=l.xScale(),d=l.yScale();if("vertical"===c){var g=d(r(n,a),a),h=d(t(n,a),a),m=f(e(n,a),a)+s;return{d:n,x:m,y:g,y0:h,width:u,height:g-h,origin:[m,g],baseOrigin:[m,h],transposedX:m,transposedY:g}}var v=f(r(n,a),a),y=f(t(n,a),a),x=d(e(n,a),a)+s;return{d:n,x:x,y:v,y0:y,width:u,height:v-y,origin:[v,x],baseOrigin:[y,x],transposedX:v,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?(o=y(arguments.length<=0?void 0:arguments[0]),l):o},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},b={red:"#c60",green:"#6c0",black:"#000",gray:"#ddd",darkGray:"#999"},k=function(){var t=w(),n=r.line().defined(t.defined()).x(function(n,e){return t.values(n,e).transposedX}).y(function(n,e){return t.values(n,e).transposedY}),i=v("path","line"),o=function(r){r.selection&&i.transition(r),r.each(function(r,o,a){var c=i(e.select(a[o]),[r]);c.enter().attr("fill","none").attr("stroke",b.black),c.attr("d",n),t.decorate()(c,r,o)})};return s(o,t,d("baseValue","bandwidth","align")),l(o,i,"key"),l(o,n,"curve"),o},S=function(){var t=w(),n=r.line().defined(t.defined()).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(e),r.strokeStyle=b.black,r.fillStyle="transparent",t.decorate()(r,e),r.fill(),r.stroke(),r.closePath()};return s(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},_=function(){var t=A(),n=v("g"),r=v("g","multi"),i=function(i){i.selection&&(r.transition(i),n.transition(i));var o=t.mapping(),a=t.series(),c=t.xScale(),l=t.yScale();i.each(function(i,u,s){var f=r(e.select(s[u]),a);f.each(function(t,r,u){t.xScale(c).yScale(l);var s=o(i,r,a);n(e.select(u[r]),[s]).call(t)}),(f.selection?f.selection():f).order(),t.decorate()(f,i,u)})};return s(i,t),l(i,r,"key"),i},O=function(){var t=null,n=A(),e=function(e){var r=n.mapping(),i=n.series(),o=n.xScale(),a=n.yScale();i.forEach(function(c,l){var u=r(e,l,i);c.context(t).xScale(o).yScale(a);var s=c.decorate();c.decorate(function(t,r,i){n.decorate()(t,e,l),s(t,r,i)}),c(u),c.decorate(s)})};return e.context=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],e):t},s(e,n),e},j=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},I=function(t,n){var i=[10],o=null,a=function(){},c=null,l=6,u=6,s=3,f=r.line(),d=v("g","tick").key(z),g=v("path","domain"),h=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)}},m=function(t,n){return p()?"translate("+n+", "+t+")":"translate("+t+", "+n+")"},y=function(t){return p()?t.map(function(t){return[t[1],t[0]]}):t},p=function(){return"left"===t||"right"===t},x=function(t,e,r){return n[t]?n[t].apply(n,e):r},w=function(r){r.selection&&(d.transition(r),g.transition(r)),r.each(function(r,v,w){var b=w[v],k=e.select(b);b.__scale__||k.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor","right"===t?"start":"left"===t?"end":"middle");var S=b.__scale__||n;b.__scale__=n.copy();var A=null==o?x("ticks",i,n.domain()):o,_=null==c?x("tickFormat",i,z):c,O="bottom"===t||"right"===t?1:-1,j=n.range(),I=y([[j[0],O*l],[j[0],0],[j[1],0],[j[1],O*l]]);g(k,[r]).attr("d",f(I)).attr("stroke","#000");var P=d(k,A);P.enter().attr("transform",h(S,m)).append("path").attr("stroke","#000");var C=O*(u+s);P.enter().append("text").attr("transform",m(0,C)).attr("fill","#000"),P.exit().attr("transform",h(n,m)),P.select("path").attr("d",function(t){return f(y([[0,0],[0,O*u]]))}),P.select("text").attr("transform",m(0,C)).attr("dy",function(){var n="0em";return p()?n="0.32em":"bottom"===t&&(n="0.71em"),n}).text(_),P.attr("transform",h(n,m)),a(P,r,v)})};return w.tickFormat=function(){return arguments.length?(c=arguments.length<=0?void 0:arguments[0],w):c},w.tickSize=function(){return arguments.length?(u=l=Number(arguments.length<=0?void 0:arguments[0]),w):u},w.tickSizeInner=function(){return arguments.length?(u=Number(arguments.length<=0?void 0:arguments[0]),w):u},w.tickSizeOuter=function(){return arguments.length?(l=Number(arguments.length<=0?void 0:arguments[0]),w):l},w.tickPadding=function(){return arguments.length?(s=arguments.length<=0?void 0:arguments[0],w):s},w.decorate=function(){return arguments.length?(a=arguments.length<=0?void 0:arguments[0],w):a},w.scale=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],w):n},w.ticks=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return i=[].concat(n),w},w.tickArguments=function(){return arguments.length?(i=null==(arguments.length<=0?void 0:arguments[0])?[]:[].concat(j(arguments.length<=0?void 0:arguments[0])),w):i.slice()},w.tickValues=function(){return arguments.length?(o=null==(arguments.length<=0?void 0:arguments[0])?[]:[].concat(j(arguments.length<=0?void 0:arguments[0])),w):o.slice()},w},P=function(t){return I("top",t)},C=function(t){return I("bottom",t)},V=function(t){return I("left",t)},q=function(t){return I("right",t)},E=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 o,a=Object.keys(r)[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var c=o.value;t[c](r[c])}}catch(t){e=!0,i=t}finally{try{!n&&a.return&&a.return()}finally{if(e)throw i}}return t},o=!0,a=!1,c=void 0;try{for(var l,u=n[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){var s=l.value;!function(t){i[t]=function(){return arguments.length?(r[t]=arguments.length<=0?void 0:arguments[0],i):r[t]}}(s)}}catch(t){a=!0,c=t}finally{try{!o&&u.return&&u.return()}finally{if(a)throw c}}return i},F="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;}",N=document.createElement("style");N.setAttribute("type","text/css"),document.querySelector("head").appendChild(N),N.styleSheet?N.styleSheet.cssText+=F:N.textContent+=F;var L=function(t){return"function"==typeof t?t:function(){return t}},X=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.scaleIdentity(),r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.scaleIdentity(),i=L(""),o=L(""),a=L("right"),c=L("bottom"),l=O(),u=_(),f=E("tickFormat","ticks","tickArguments","tickSize","tickSizeInner","tickSizeOuter","tickValues","tickPadding"),g=function(){},h=E("tickFormat","ticks","tickArguments","tickSize","tickSizeInner","tickSizeOuter","tickValues","tickPadding"),y=function(){},p=function(){},x=v("d3fc-group","cartesian-chart"),w=v("d3fc-svg","x-axis").key(function(t){return t}),b=v("d3fc-svg","y-axis").key(function(t){return t}),k=v("div","x-label").key(function(t){return t}),S=v("div","y-label").key(function(t){return t}),A=function(t){return function(n){return t.selection?n.transition(t):n}},j=function(n){var s=A(n);n.each(function(n,d,m){var v=x(e.select(m[d]),[n]);v.enter().attr("auto-resize","").html('<d3fc-svg class="plot-area"></d3fc-svg><d3fc-canvas class="plot-area"></d3fc-canvas>'),k(v,[c(n)]).attr("class",function(t){return"x-label "+t+"-label"}).text(i(n)),S(v,[a(n)]).attr("class",function(t){return"y-label "+t+"-label"}).text(o(n)),w(v,[c(n)]).attr("class",function(t){return"x-axis "+t+"-axis"}).on("measure",function(n,r,i){var o=e.event.detail,a=o.width,c=o.height;"top"===n&&e.select(i[r]).select("svg").attr("viewBox","0 "+-c+" "+a+" "+c),t.range([0,a])}).on("draw",function(n,r,i){var o="top"===n?P(t):C(t);o.decorate(g),s(e.select(i[r])).select("svg").call(f(o))}),b(v,[a(n)]).attr("class",function(t){return"y-axis "+t+"-axis"}).on("measure",function(t,n,i){var o=e.event.detail,a=o.width,c=o.height;"left"===t&&e.select(i[n]).select("svg").attr("viewBox",-a+" 0 "+a+" "+c),r.range([c,0])}).on("draw",function(t,n,i){var o="left"===t?V(r):q(r);o.decorate(y),s(e.select(i[n])).select("svg").call(h(o))}),v.select("d3fc-canvas.plot-area").on("draw",function(n,i,o){var a=e.select(o[i]).select("canvas").node();l.context(a.getContext("2d")).xScale(t).yScale(r),l(n)}),v.select("d3fc-svg.plot-area").on("draw",function(n,i,o){u.xScale(t).yScale(r),s(e.select(o[i])).select("svg").call(u)}),v.each(function(t,n,e){return e[n].requestRedraw()}),p(v,n,d)})},z=d(/range\w*/,/tickFormat/);return s(j,t,z,m("x")),s(j,r,z,m("y")),s(j,f,m("x")),s(j,h,m("y")),j.xOrient=function(){return arguments.length?(c=L(arguments.length<=0?void 0:arguments[0]),j):c},j.yOrient=function(){return arguments.length?(a=L(arguments.length<=0?void 0:arguments[0]),j):a},j.xDecorate=function(){return arguments.length?(g=arguments.length<=0?void 0:arguments[0],j):g},j.yDecorate=function(){return arguments.length?(y=arguments.length<=0?void 0:arguments[0],j):y},j.xLabel=function(){return arguments.length?(i=L(arguments.length<=0?void 0:arguments[0]),j):i},j.yLabel=function(){return arguments.length?(o=L(arguments.length<=0?void 0:arguments[0]),j):o},j.canvasPlotArea=function(){return arguments.length?(l=arguments.length<=0?void 0:arguments[0],j):l},j.svgPlotArea=function(){return arguments.length?(u=arguments.length<=0?void 0:arguments[0],j):u},j.decorate=function(){return arguments.length?(p=arguments.length<=0?void 0:arguments[0],j):p},j},Y=function(t){return"function"==typeof t?t:function(){return t}},B=function(t,e){return function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.scaleIdentity(),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.scaleIdentity(),o=Y(""),a=Y(""),c=e,l=function(){},u=X(r,i),f=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(a),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(o(n)),l(t,n,e)}),n.call(u)};return s(f,u,g(/^x/,/^y/)),f.chartLabel=function(){return arguments.length?(o=Y(arguments.length<=0?void 0:arguments[0]),f):o},f.yLabel=function(){return arguments.length?(a=Y(arguments.length<=0?void 0:arguments[0]),f):a},f.plotArea=function(){return arguments.length?(c=arguments.length<=0?void 0:arguments[0],f):c},f.decorate=function(){return arguments.length?(l=arguments.length<=0?void 0:arguments[0],f):l},f}},D=B(function(t,n){return t.svgPlotArea(n)},k),M=B(function(t,n){return t.canvasPlotArea(n)},S);t.chartSvgCartesian=D,t.chartCanvasCartesian=M,t.chartCartesian=X,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,o){"use strict";function a(){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),o=0;o<e;o++)i[o]=arguments[o];var a=r.apply(n,i);return a===n?t:a}},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 o=!0,a=!1,l=void 0;try{for(var u,s=r[Symbol.iterator]();!(o=(u=s.next()).done);o=!0){var f=u.value;t[f]=c(t,n,f)}}catch(t){a=!0,l=t}finally{try{!o&&s.return&&s.return()}finally{if(a)throw l}}return t},u=function(t){return function(n){return t.reduce(function(t,n){return t&&n(t)},n)}},s=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 o=u(r),a=!0,l=!1,s=void 0;try{for(var f,d=Object.keys(n)[Symbol.iterator]();!(a=(f=d.next()).done);a=!0){var g=f.value,h=o(g);h&&(t[h]=c(t,n,g))}}catch(t){l=!0,s=t}finally{try{!a&&d.return&&d.return()}finally{if(l)throw s}}return t},f=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=f(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=f(n),function(t){return n.some(function(n){return n.test(t)})&&t}},h=function(t){return t[0].toUpperCase()+t.slice(1)},m=function(t){return function(n){return t+h(n)}},v=function(t,n){t=t||"g";var e=function(t,n){return n},r=null,i=function(i,o){o=o||function(t){return t};var a=i.selection?i:null;a&&(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(o,e),u=l.enter().append(t).attr("class",n),s=l.exit();l=l.merge(u);var f=a||r;return f&&(l=l.transition(f).style("opacity",1),u.style("opacity",1e-6),s=s.transition(f).style("opacity",1e-6)),s.remove(),l.enter=function(){return u},l.exit=function(){return s},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},w=function(){var t=function(){return 0},e=function(t){return t.x},r=function(t){return t.y},i="center",o=function(){return 5},c="vertical",l=x({decorate:function(){},defined:function(n,i){return a(t,e,r)(n,i)},xScale:n.scaleIdentity(),yScale:n.scaleIdentity()});return l.values=function(n,a){var u=o(n,a),s=p(i,u),f=l.xScale(),d=l.yScale();if("vertical"===c){var g=d(r(n,a),a),h=d(t(n,a),a),m=f(e(n,a),a)+s;return{d:n,x:m,y:g,y0:h,width:u,height:g-h,origin:[m,g],baseOrigin:[m,h],transposedX:m,transposedY:g}}var v=f(r(n,a),a),y=f(t(n,a),a),x=d(e(n,a),a)+s;return{d:n,x:x,y:v,y0:y,width:u,height:v-y,origin:[v,x],baseOrigin:[y,x],transposedX:v,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?(o=y(arguments.length<=0?void 0:arguments[0]),l):o},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},b={red:"#c60",green:"#6c0",black:"#000",gray:"#ddd",darkGray:"#999"},k=function(){var t=w(),n=r.line().x(function(n,e){return t.values(n,e).transposedX}).y(function(n,e){return t.values(n,e).transposedY}),i=v("path","line"),o=function(r){r.selection&&i.transition(r),n.defined(t.defined()),r.each(function(r,o,a){var c=i(e.select(a[o]),[r]);c.enter().attr("fill","none").attr("stroke",b.black),c.attr("d",n),t.decorate()(c,r,o)})};return s(o,t,d("baseValue","bandwidth","align")),l(o,i,"key"),l(o,n,"curve"),o},S=function(){var t=w(),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=b.black,r.fillStyle="transparent",t.decorate()(r,e),r.fill(),r.stroke(),r.closePath()};return s(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},_=function(){var t=A(),n=v("g"),r=v("g","multi"),i=function(i){i.selection&&(r.transition(i),n.transition(i));var o=t.mapping(),a=t.series(),c=t.xScale(),l=t.yScale();i.each(function(i,u,s){var f=r(e.select(s[u]),a);f.each(function(t,r,u){t.xScale(c).yScale(l);var s=o(i,r,a);n(e.select(u[r]),[s]).call(t)}),(f.selection?f.selection():f).order(),t.decorate()(f,i,u)})};return s(i,t),l(i,r,"key"),i},O=function(){var t=null,n=A(),e=function(e){var r=n.mapping(),i=n.series(),o=n.xScale(),a=n.yScale();i.forEach(function(c,l){var u=r(e,l,i);c.context(t).xScale(o).yScale(a);var s=c.decorate();c.decorate(function(t,r,i){n.decorate()(t,e,l),s(t,r,i)}),c(u),c.decorate(s)})};return e.context=function(){return arguments.length?(t=arguments.length<=0?void 0:arguments[0],e):t},s(e,n),e},j=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},I=function(t,n){var i=[10],o=null,a=function(){},c=null,l=6,u=6,s=3,f=r.line(),d=v("g","tick").key(z),g=v("path","domain"),h=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)}},m=function(t,n){return p()?"translate("+n+", "+t+")":"translate("+t+", "+n+")"},y=function(t){return p()?t.map(function(t){return[t[1],t[0]]}):t},p=function(){return"left"===t||"right"===t},x=function(t,e,r){return n[t]?n[t].apply(n,e):r},w=function(r){r.selection&&(d.transition(r),g.transition(r)),r.each(function(r,v,w){var b=w[v],k=e.select(b);b.__scale__||k.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor","right"===t?"start":"left"===t?"end":"middle");var S=b.__scale__||n;b.__scale__=n.copy();var A=null==o?x("ticks",i,n.domain()):o,_=null==c?x("tickFormat",i,z):c,O="bottom"===t||"right"===t?1:-1,j=n.range(),I=y([[j[0],O*l],[j[0],0],[j[1],0],[j[1],O*l]]);g(k,[r]).attr("d",f(I)).attr("stroke","#000");var P=d(k,A);P.enter().attr("transform",h(S,m)).append("path").attr("stroke","#000");var C=O*(u+s);P.enter().append("text").attr("transform",m(0,C)).attr("fill","#000"),P.exit().attr("transform",h(n,m)),P.select("path").attr("d",function(t){return f(y([[0,0],[0,O*u]]))}),P.select("text").attr("transform",m(0,C)).attr("dy",function(){var n="0em";return p()?n="0.32em":"bottom"===t&&(n="0.71em"),n}).text(_),P.attr("transform",h(n,m)),a(P,r,v)})};return w.tickFormat=function(){return arguments.length?(c=arguments.length<=0?void 0:arguments[0],w):c},w.tickSize=function(){return arguments.length?(u=l=Number(arguments.length<=0?void 0:arguments[0]),w):u},w.tickSizeInner=function(){return arguments.length?(u=Number(arguments.length<=0?void 0:arguments[0]),w):u},w.tickSizeOuter=function(){return arguments.length?(l=Number(arguments.length<=0?void 0:arguments[0]),w):l},w.tickPadding=function(){return arguments.length?(s=arguments.length<=0?void 0:arguments[0],w):s},w.decorate=function(){return arguments.length?(a=arguments.length<=0?void 0:arguments[0],w):a},w.scale=function(){return arguments.length?(n=arguments.length<=0?void 0:arguments[0],w):n},w.ticks=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return i=[].concat(n),w},w.tickArguments=function(){return arguments.length?(i=null==(arguments.length<=0?void 0:arguments[0])?[]:[].concat(j(arguments.length<=0?void 0:arguments[0])),w):i.slice()},w.tickValues=function(){return arguments.length?(o=null==(arguments.length<=0?void 0:arguments[0])?[]:[].concat(j(arguments.length<=0?void 0:arguments[0])),w):o.slice()},w},P=function(t){return I("top",t)},C=function(t){return I("bottom",t)},V=function(t){return I("left",t)},q=function(t){return I("right",t)},E=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 o,a=Object.keys(r)[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var c=o.value;t[c](r[c])}}catch(t){e=!0,i=t}finally{try{!n&&a.return&&a.return()}finally{if(e)throw i}}return t},o=!0,a=!1,c=void 0;try{for(var l,u=n[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){var s=l.value;!function(t){i[t]=function(){return arguments.length?(r[t]=arguments.length<=0?void 0:arguments[0],i):r[t]}}(s)}}catch(t){a=!0,c=t}finally{try{!o&&u.return&&u.return()}finally{if(a)throw c}}return i},F="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;}",N=document.createElement("style");N.setAttribute("type","text/css"),document.querySelector("head").appendChild(N),N.styleSheet?N.styleSheet.cssText+=F:N.textContent+=F;var L=function(t){return"function"==typeof t?t:function(){return t}},X=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.scaleIdentity(),r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.scaleIdentity(),i=L(""),o=L(""),a=L("right"),c=L("bottom"),l=O(),u=_(),f=E("tickFormat","ticks","tickArguments","tickSize","tickSizeInner","tickSizeOuter","tickValues","tickPadding"),g=function(){},h=E("tickFormat","ticks","tickArguments","tickSize","tickSizeInner","tickSizeOuter","tickValues","tickPadding"),y=function(){},p=function(){},x=v("d3fc-group","cartesian-chart"),w=v("d3fc-svg","x-axis").key(function(t){return t}),b=v("d3fc-svg","y-axis").key(function(t){return t}),k=v("div","x-label").key(function(t){return t}),S=v("div","y-label").key(function(t){return t}),A=function(t){return function(n){return t.selection?n.transition(t):n}},j=function(n){var s=A(n);n.each(function(n,d,m){var v=x(e.select(m[d]),[n]);v.enter().attr("auto-resize","").html('<d3fc-svg class="plot-area"></d3fc-svg><d3fc-canvas class="plot-area"></d3fc-canvas>'),k(v,[c(n)]).attr("class",function(t){return"x-label "+t+"-label"}).text(i(n)),S(v,[a(n)]).attr("class",function(t){return"y-label "+t+"-label"}).text(o(n)),w(v,[c(n)]).attr("class",function(t){return"x-axis "+t+"-axis"}).on("measure",function(n,r,i){var o=e.event.detail,a=o.width,c=o.height;"top"===n&&e.select(i[r]).select("svg").attr("viewBox","0 "+-c+" "+a+" "+c),t.range([0,a])}).on("draw",function(n,r,i){var o="top"===n?P(t):C(t);o.decorate(g),s(e.select(i[r])).select("svg").call(f(o))}),b(v,[a(n)]).attr("class",function(t){return"y-axis "+t+"-axis"}).on("measure",function(t,n,i){var o=e.event.detail,a=o.width,c=o.height;"left"===t&&e.select(i[n]).select("svg").attr("viewBox",-a+" 0 "+a+" "+c),r.range([c,0])}).on("draw",function(t,n,i){var o="left"===t?V(r):q(r);o.decorate(y),s(e.select(i[n])).select("svg").call(h(o))}),v.select("d3fc-canvas.plot-area").on("draw",function(n,i,o){var a=e.select(o[i]).select("canvas").node();l.context(a.getContext("2d")).xScale(t).yScale(r),l(n)}),v.select("d3fc-svg.plot-area").on("draw",function(n,i,o){u.xScale(t).yScale(r),s(e.select(o[i])).select("svg").call(u)}),v.each(function(t,n,e){return e[n].requestRedraw()}),p(v,n,d)})},z=d(/range\w*/,/tickFormat/);return s(j,t,z,m("x")),s(j,r,z,m("y")),s(j,f,m("x")),s(j,h,m("y")),j.xOrient=function(){return arguments.length?(c=L(arguments.length<=0?void 0:arguments[0]),j):c},j.yOrient=function(){return arguments.length?(a=L(arguments.length<=0?void 0:arguments[0]),j):a},j.xDecorate=function(){return arguments.length?(g=arguments.length<=0?void 0:arguments[0],j):g},j.yDecorate=function(){return arguments.length?(y=arguments.length<=0?void 0:arguments[0],j):y},j.xLabel=function(){return arguments.length?(i=L(arguments.length<=0?void 0:arguments[0]),j):i},j.yLabel=function(){return arguments.length?(o=L(arguments.length<=0?void 0:arguments[0]),j):o},j.canvasPlotArea=function(){return arguments.length?(l=arguments.length<=0?void 0:arguments[0],j):l},j.svgPlotArea=function(){return arguments.length?(u=arguments.length<=0?void 0:arguments[0],j):u},j.decorate=function(){return arguments.length?(p=arguments.length<=0?void 0:arguments[0],j):p},j},Y=function(t){return"function"==typeof t?t:function(){return t}},B=function(t,e){return function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.scaleIdentity(),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.scaleIdentity(),o=Y(""),a=Y(""),c=e,l=function(){},u=X(r,i),f=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(a),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(o(n)),l(t,n,e)}),n.call(u)};return s(f,u,g(/^x/,/^y/)),f.chartLabel=function(){return arguments.length?(o=Y(arguments.length<=0?void 0:arguments[0]),f):o},f.yLabel=function(){return arguments.length?(a=Y(arguments.length<=0?void 0:arguments[0]),f):a},f.plotArea=function(){return arguments.length?(c=arguments.length<=0?void 0:arguments[0],f):c},f.decorate=function(){return arguments.length?(l=arguments.length<=0?void 0:arguments[0],f):l},f}},D=B(function(t,n){return t.svgPlotArea(n)},k),M=B(function(t,n){return t.canvasPlotArea(n)},S);t.chartSvgCartesian=D,t.chartCanvasCartesian=M,t.chartCartesian=X,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -6,2 +6,10 @@ # Change Log | ||
<a name="2.1.1"></a> | ||
## [2.1.1](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-chart@2.1.0...@d3fc/d3fc-chart@2.1.1) (2018-09-14) | ||
**Note:** Version bump only for package @d3fc/d3fc-chart | ||
<a name="2.1.0"></a> | ||
@@ -8,0 +16,0 @@ # [2.1.0](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-chart@2.0.17...@d3fc/d3fc-chart@2.1.0) (2018-09-07) |
{ | ||
"name": "@d3fc/d3fc-chart", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "A simple Cartesian chart component that renders to canvas or SVG.", | ||
@@ -24,3 +24,3 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@d3fc/d3fc-annotation": "^2.0.12", | ||
"@d3fc/d3fc-annotation": "^2.0.13", | ||
"@d3fc/d3fc-extent": "^3.1.1", | ||
@@ -34,5 +34,5 @@ "@d3fc/d3fc-scripts": "^2.0.4", | ||
"@d3fc/d3fc-data-join": "^5.0.6", | ||
"@d3fc/d3fc-element": "^5.1.1", | ||
"@d3fc/d3fc-element": "^5.1.2", | ||
"@d3fc/d3fc-rebind": "^5.0.5", | ||
"@d3fc/d3fc-series": "^4.0.10", | ||
"@d3fc/d3fc-series": "^4.0.11", | ||
"d3-scale": "^1.0.3", | ||
@@ -39,0 +39,0 @@ "d3-selection": "^1.0.2" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119405
1683
Updated@d3fc/d3fc-element@^5.1.2
Updated@d3fc/d3fc-series@^4.0.11