@d3fc/d3fc-chart
Advanced tools
Comparing version 2.0.9 to 2.0.10
@@ -799,3 +799,3 @@ (function (global, factory) { | ||
container.enter().attr('style', 'display: flex; height: 100%; width: 100%; flex-direction: column; overflow: hidden').attr('auto-resize', '').html('<div class=\'chart-label\'\n style=\'height: ' + (chartLabel ? 2 : 0) + 'em; line-height: 2em; text-align: center; ' + xMargin(yOrientValue) + '\'>\n </div>\n <div style=\'flex: 1; display: flex; ' + colFlexDirection(xOrientValue) + '; ' + xPadding(yOrientValue) + '\'>\n <div style=\'flex: 1; display: flex; ' + rowFlexDirection(yOrientValue) + '\'>\n <' + d3fcElementType + ' class=\'plot-area\' style=\'flex: 1\'></' + d3fcElementType + '>\n ' + yAxisMarkup + '\n </div>\n ' + xAxisMarkup + '\n </div>'); | ||
container.enter().attr('style', 'display: flex; height: 100%; width: 100%; flex-direction: column; overflow: hidden').attr('auto-resize', '').html('<div class=\'chart-label\'\n style=\'height: ' + (chartLabel ? 2 : 0) + 'em; line-height: 2em; text-align: center; ' + xMargin(yOrientValue) + '\'>\n </div>\n <div style=\'flex: 1; display: flex; ' + colFlexDirection(xOrientValue) + '; ' + xPadding(yOrientValue) + '\'>\n <div style=\'flex: 1; display: flex; ' + rowFlexDirection(yOrientValue) + '\'>\n <' + d3fcElementType + ' class=\'plot-area\' style=\'flex: 1; overflow: hidden\'></' + d3fcElementType + '>\n ' + yAxisMarkup + '\n </div>\n ' + xAxisMarkup + '\n </div>'); | ||
@@ -802,0 +802,0 @@ container.select('.y-axis-label').text(yLabel(data)); |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-selection"),require("d3-scale"),require("d3-shape"),require("d3-path"),require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-scale","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 c(){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 u=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 c=i.selection?i:null;c&&(i=i.selection());var u=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),a=u.data(o,e),l=a.enter().append(t).attr("class",n),f=a.exit();a=a.merge(l);var d=c||r;return d?(a=a.transition(d),l.style("opacity",1e-6).transition(d).style("opacity",1),f=f.transition(d).style("opacity",1e-6).remove()):f.remove(),a.enter=function(){return l},a.exit=function(){return f},a};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},a=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 c=r.apply(n,i);return c===n?t:c}},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,c=!1,u=void 0;try{for(var l,f=r[Symbol.iterator]();!(o=(l=f.next()).done);o=!0){var d=l.value;t[d]=a(t,n,d)}}catch(t){c=!0,u=t}finally{try{!o&&f.return&&f.return()}finally{if(c)throw u}}return t},f=function(t){return function(n){return t.reduce(function(t,n){return t&&n(t)},n)}},d=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=f(r),c=!0,u=!1,l=void 0;try{for(var d,s=Object.keys(n)[Symbol.iterator]();!(c=(d=s.next()).done);c=!0){var h=d.value,g=o(h);g&&(t[g]=a(t,n,h))}}catch(t){u=!0,l=t}finally{try{!c&&s.return&&s.return()}finally{if(u)throw l}}return t},s=function(t){return t.map(function(t){return"string"==typeof t?new RegExp("^"+t+"$"):t})},h=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(t){return t[0].toUpperCase()+t.slice(1)},v=function(t){return function(n){return t+g(n)}},y=function(t){return"function"==typeof t?t:function(){return t}},m=function(t,n){switch(t){case"left":return n/2;case"right":return-n/2;default:return 0}},p=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},x=function(){var t=function(){return 0},n=function(t){return t.x},r=function(t){return t.y},i="center",o=function(){return 5},u="vertical",a=p({decorate:function(){},defined:function(e,i){return c(t,n,r)(e,i)},xScale:e.scaleIdentity(),yScale:e.scaleIdentity()});return a.values=function(e,c){var l=o(e,c),f=m(i,l),d=a.xScale(),s=a.yScale();if("vertical"===u){var h=s(r(e,c),c),g=s(t(e,c),c),v=d(n(e,c),c)+f;return{d:e,x:v,y:h,y0:g,width:l,height:h-g,origin:[v,h],baseOrigin:[v,g],transposedX:v,transposedY:h}}var y=d(r(e,c),c),p=d(t(e,c),c),x=s(n(e,c),c)+f;return{d:e,x:x,y:y,y0:p,width:l,height:y-p,origin:[y,x],baseOrigin:[p,x],transposedX:y,transposedY:x}},a.baseValue=function(){return arguments.length?(t=y(arguments.length<=0?void 0:arguments[0]),a):t},a.crossValue=function(){return arguments.length?(n=y(arguments.length<=0?void 0:arguments[0]),a):n},a.mainValue=function(){return arguments.length?(r=y(arguments.length<=0?void 0:arguments[0]),a):r},a.bandwidth=function(){return arguments.length?(o=y(arguments.length<=0?void 0:arguments[0]),a):o},a.align=function(){return arguments.length?(i=arguments.length<=0?void 0:arguments[0],a):i},a.orient=function(){return arguments.length?(u=arguments.length<=0?void 0:arguments[0],a):u},a},k={red:"#c60",green:"#6c0",black:"#000",gray:"#ddd",darkGray:"#999"},b=function(){var t=x(),e=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=u("path","line"),o=function(r){r.selection&&i.transition(r),r.each(function(r,o,c){var u=i(n.select(c[o]),[r]);u.enter().attr("fill","none").attr("stroke",k.black),u.attr("d",e),t.decorate()(u,r,o)})};return d(o,t,h("baseValue","bandwidth","align")),l(o,i,"key"),l(o,e,"curve"),o},w=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)},S=function(t){return t},A=function(t,e){var i=[10],o=null,c=function(){},a=null,l=6,f=6,d=3,s=r.line(),h=u("g","tick").key(S),g=u("path","domain"),v=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)}},y=function(t,n){return p()?"translate("+n+", "+t+")":"translate("+t+", "+n+")"},m=function(t){return p()?t.map(function(t){return[t[1],t[0]]}):t},p=function(){return"left"===t||"right"===t},x=function(t,n,r){return e[t]?e[t].apply(e,n):r},k=function(r){r.selection&&(h.transition(r),g.transition(r)),r.each(function(r,u,k){var b=k[u],w=n.select(b);b.__scale__||w.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor","right"===t?"start":"left"===t?"end":"middle");var A=b.__scale__||e;b.__scale__=e.copy();var z=null==o?x("ticks",i,e.domain()):o,T=null==a?x("tickFormat",i,S):a,_="bottom"===t||"right"===t?1:-1,O=e.range(),I=m([[O[0],_*l],[O[0],0],[O[1],0],[O[1],_*l]]);g(w,[r]).attr("d",s(I)).attr("stroke","#000");var V=h(w,z);V.enter().attr("transform",v(A,y)).append("path").attr("stroke","#000");var j=_*(f+d);V.enter().append("text").attr("transform",y(0,j)).attr("fill","#000"),V.exit().attr("transform",v(e,y)),V.select("path").attr("d",function(t){return s(m([[0,0],[0,_*f]]))}),V.select("text").attr("transform",y(0,j)).attr("dy",function(){var n="0em";return p()?n="0.32em":"bottom"===t&&(n="0.71em"),n}).text(T),V.attr("transform",v(e,y)),c(V,r,u)})};return k.tickFormat=function(){return arguments.length?(a=arguments.length<=0?void 0:arguments[0],k):a},k.tickSize=function(){return arguments.length?(f=l=Number(arguments.length<=0?void 0:arguments[0]),k):f},k.tickSizeInner=function(){return arguments.length?(f=Number(arguments.length<=0?void 0:arguments[0]),k):f},k.tickSizeOuter=function(){return arguments.length?(l=Number(arguments.length<=0?void 0:arguments[0]),k):l},k.tickPadding=function(){return arguments.length?(d=arguments.length<=0?void 0:arguments[0],k):d},k.decorate=function(){return arguments.length?(c=arguments.length<=0?void 0:arguments[0],k):c},k.scale=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],k):e},k.ticks=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return i=[].concat(n),k},k.tickArguments=function(){return arguments.length?(i=null==(arguments.length<=0?void 0:arguments[0])?[]:[].concat(w(arguments.length<=0?void 0:arguments[0])),k):i.slice()},k.tickValues=function(){return arguments.length?(o=null==(arguments.length<=0?void 0:arguments[0])?[]:[].concat(w(arguments.length<=0?void 0:arguments[0])),k):o.slice()},k},z=function(t){return A("top",t)},T=function(t){return A("bottom",t)},_=function(t){return A("left",t)},O=function(t){return A("right",t)},I=function(t){return"function"==typeof t?t:function(){return t}},V=function(t,r){return function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.scaleIdentity(),o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.scaleIdentity(),c=I(""),a=I(""),l=I("right"),f=I("bottom"),s=I(""),g=b(),y=null,m=void 0,p=void 0,x=void 0,k=void 0,S=void 0,A=void 0,V=void 0,j=function(){},F=null,q=void 0,N=void 0,P=void 0,C=void 0,E=void 0,L=void 0,X=void 0,Y=function(){},B=function(){},D=function(t){switch(t){case"bottom":return T();case"top":return z();case"left":return _();case"right":return O();case"none":return null}},M=function(t){switch(t){case"left":return"margin-left: 4em";case"right":return"margin-right: 4em";default:return""}},R=function(t){switch(t){case"left":return"padding-right: 1em";case"right":return"padding-left: 1em";case"none":return"padding-left: 1em; padding-right: 1em";default:return""}},G=function(t){switch(t){case"bottom":return"flex-direction: column";default:return"flex-direction: column-reverse"}},U=function(t){switch(t){case"right":return"flex-direction: row";default:return"flex-direction: row-reverse"}},$=u("d3fc-group","cartesian-chart"),H=function(t){return function(n){return t.selection?n.transition(t):n}},J=function(e){var u=H(e);e.each(function(e,d,h){var v=$(n.select(h[d]),[e]),b=f(e),z=l(e),T=D(b),_=D(z),O=T?"<d3fc-svg class='x-axis' style='height: 2em; "+M(z)+"'></d3fc-svg>\n <div class='x-axis-label' style='height: 1em; line-height: 1em; text-align: center; "+M(z)+"'></div>":"",I=_?"<d3fc-svg class='y-axis' style='width: 3em'></d3fc-svg>\n <div style='width: 1em; display: flex; align-items: center; justify-content: center'>\n <div class='y-axis-label' style='transform: rotate(-90deg)'></div>\n </div>":"";v.enter().attr("style","display: flex; height: 100%; width: 100%; flex-direction: column; overflow: hidden").attr("auto-resize","").html("<div class='chart-label'\n style='height: "+(s?2:0)+"em; line-height: 2em; text-align: center; "+M(z)+"'>\n </div>\n <div style='flex: 1; display: flex; "+G(b)+"; "+R(z)+"'>\n <div style='flex: 1; display: flex; "+U(z)+"'>\n <"+t+" class='plot-area' style='flex: 1'></"+t+">\n "+I+"\n </div>\n "+O+"\n </div>"),v.select(".y-axis-label").text(c(e)),v.select(".x-axis-label").text(a(e)),v.select(".chart-label").text(s(e)),v.select(".y-axis").on("measure",function(t,e,r){if("left"===z){var i=n.event.detail,o=i.width,c=i.height;n.select(r[e]).select("svg").attr("viewBox",-o+" 0 "+o+" "+c)}}).on("draw",function(t,e,r){_.tickFormat(F).decorate(Y),q&&_.ticks.apply(_,w(q)),N&&_.tickArguments(N),P&&_.tickSize(P),C&&_.tickSizeInner(C),E&&_.tickSizeOuter(E),L&&_.tickValues(L),X&&_.tickPadding(X),u(n.select(r[e])).select("svg").call(_.scale(o))}),v.select(".x-axis").on("measure",function(t,e,r){if("top"===b){var i=n.event.detail,o=i.width,c=i.height;n.select(r[e]).select("svg").attr("viewBox","0 "+-c+" "+o+" "+c)}}).on("draw",function(t,e,r){T.tickFormat(y).decorate(j),m&&T.ticks.apply(T,w(m)),p&&T.tickArguments(p),x&&T.tickSize(x),k&&T.tickSizeInner(k),S&&T.tickSizeOuter(S),A&&T.tickValues(A),V&&T.tickPadding(V),u(n.select(r[e])).select("svg").call(T.scale(i))}),v.select(".plot-area").on("measure",function(){var t=n.event.detail,e=t.width,r=t.height;i.range([0,e]),o.range([r,0])}).on("draw",function(t,n,e){g.xScale(i).yScale(o),r(t,e[n],g,u)}),v.each(function(t,n,e){return e[n].requestRedraw()}),B(v,e,d)})},K=h(/range\w*/,/tickFormat/);return d(J,i,K,v("x")),d(J,o,K,v("y")),J.xTickFormat=function(){return arguments.length?(y=arguments.length<=0?void 0:arguments[0],J):y},J.xTicks=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return n.length?(m=n,J):m},J.xTickArguments=function(){return arguments.length?(p=arguments.length<=0?void 0:arguments[0],J):p},J.xTickSize=function(){return arguments.length?(x=arguments.length<=0?void 0:arguments[0],J):x},J.xTickSizeInner=function(){return arguments.length?(k=arguments.length<=0?void 0:arguments[0],J):k},J.xTickSizeOuter=function(){return arguments.length?(S=arguments.length<=0?void 0:arguments[0],J):S},J.xTickValues=function(){return arguments.length?(A=arguments.length<=0?void 0:arguments[0],J):A},J.xTickPadding=function(){return arguments.length?(V=arguments.length<=0?void 0:arguments[0],J):V},J.xDecorate=function(){return arguments.length?(j=arguments.length<=0?void 0:arguments[0],J):j},J.yTickFormat=function(){return arguments.length?(F=arguments.length<=0?void 0:arguments[0],J):F},J.yTicks=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return n.length?(q=n,J):q},J.yTickArguments=function(){return arguments.length?(N=arguments.length<=0?void 0:arguments[0],J):N},J.yTickSize=function(){return arguments.length?(P=arguments.length<=0?void 0:arguments[0],J):P},J.yTickSizeInner=function(){return arguments.length?(C=arguments.length<=0?void 0:arguments[0],J):C},J.yTickSizeOuter=function(){return arguments.length?(E=arguments.length<=0?void 0:arguments[0],J):E},J.yTickValues=function(){return arguments.length?(L=arguments.length<=0?void 0:arguments[0],J):L},J.yTickPadding=function(){return arguments.length?(X=arguments.length<=0?void 0:arguments[0],J):X},J.yDecorate=function(){return arguments.length?(Y=arguments.length<=0?void 0:arguments[0],J):Y},J.yOrient=function(){return arguments.length?(l=I(arguments.length<=0?void 0:arguments[0]),J):l},J.xOrient=function(){return arguments.length?(f=I(arguments.length<=0?void 0:arguments[0]),J):f},J.chartLabel=function(){return arguments.length?(s=I(arguments.length<=0?void 0:arguments[0]),J):s},J.plotArea=function(){return arguments.length?(g=arguments.length<=0?void 0:arguments[0],J):g},J.xLabel=function(){return arguments.length?(a=I(arguments.length<=0?void 0:arguments[0]),J):a},J.yLabel=function(){return arguments.length?(c=I(arguments.length<=0?void 0:arguments[0]),J):c},J.decorate=function(){return arguments.length?(B=arguments.length<=0?void 0:arguments[0],J):B},J}},j=V("d3fc-svg",function(t,e,r,i){i(n.select(e)).select("svg").call(r)}),F=function(){return j.apply(void 0,arguments)},q=V("d3fc-canvas",function(t,n,e){var r=n.childNodes[0];e.context(r.getContext("2d")),e(t)}),N=function(){return q.apply(void 0,arguments)};t.chartSvgCartesian=F,t.chartCanvasCartesian=N,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-selection"),require("d3-scale"),require("d3-shape"),require("d3-path"),require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-scale","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 c(){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 u=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 c=i.selection?i:null;c&&(i=i.selection());var u=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),a=u.data(o,e),l=a.enter().append(t).attr("class",n),f=a.exit();a=a.merge(l);var d=c||r;return d?(a=a.transition(d),l.style("opacity",1e-6).transition(d).style("opacity",1),f=f.transition(d).style("opacity",1e-6).remove()):f.remove(),a.enter=function(){return l},a.exit=function(){return f},a};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},a=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 c=r.apply(n,i);return c===n?t:c}},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,c=!1,u=void 0;try{for(var l,f=r[Symbol.iterator]();!(o=(l=f.next()).done);o=!0){var d=l.value;t[d]=a(t,n,d)}}catch(t){c=!0,u=t}finally{try{!o&&f.return&&f.return()}finally{if(c)throw u}}return t},f=function(t){return function(n){return t.reduce(function(t,n){return t&&n(t)},n)}},d=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=f(r),c=!0,u=!1,l=void 0;try{for(var d,s=Object.keys(n)[Symbol.iterator]();!(c=(d=s.next()).done);c=!0){var h=d.value,g=o(h);g&&(t[g]=a(t,n,h))}}catch(t){u=!0,l=t}finally{try{!c&&s.return&&s.return()}finally{if(u)throw l}}return t},s=function(t){return t.map(function(t){return"string"==typeof t?new RegExp("^"+t+"$"):t})},h=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(t){return t[0].toUpperCase()+t.slice(1)},v=function(t){return function(n){return t+g(n)}},y=function(t){return"function"==typeof t?t:function(){return t}},m=function(t,n){switch(t){case"left":return n/2;case"right":return-n/2;default:return 0}},p=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},x=function(){var t=function(){return 0},n=function(t){return t.x},r=function(t){return t.y},i="center",o=function(){return 5},u="vertical",a=p({decorate:function(){},defined:function(e,i){return c(t,n,r)(e,i)},xScale:e.scaleIdentity(),yScale:e.scaleIdentity()});return a.values=function(e,c){var l=o(e,c),f=m(i,l),d=a.xScale(),s=a.yScale();if("vertical"===u){var h=s(r(e,c),c),g=s(t(e,c),c),v=d(n(e,c),c)+f;return{d:e,x:v,y:h,y0:g,width:l,height:h-g,origin:[v,h],baseOrigin:[v,g],transposedX:v,transposedY:h}}var y=d(r(e,c),c),p=d(t(e,c),c),x=s(n(e,c),c)+f;return{d:e,x:x,y:y,y0:p,width:l,height:y-p,origin:[y,x],baseOrigin:[p,x],transposedX:y,transposedY:x}},a.baseValue=function(){return arguments.length?(t=y(arguments.length<=0?void 0:arguments[0]),a):t},a.crossValue=function(){return arguments.length?(n=y(arguments.length<=0?void 0:arguments[0]),a):n},a.mainValue=function(){return arguments.length?(r=y(arguments.length<=0?void 0:arguments[0]),a):r},a.bandwidth=function(){return arguments.length?(o=y(arguments.length<=0?void 0:arguments[0]),a):o},a.align=function(){return arguments.length?(i=arguments.length<=0?void 0:arguments[0],a):i},a.orient=function(){return arguments.length?(u=arguments.length<=0?void 0:arguments[0],a):u},a},k={red:"#c60",green:"#6c0",black:"#000",gray:"#ddd",darkGray:"#999"},b=function(){var t=x(),e=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=u("path","line"),o=function(r){r.selection&&i.transition(r),r.each(function(r,o,c){var u=i(n.select(c[o]),[r]);u.enter().attr("fill","none").attr("stroke",k.black),u.attr("d",e),t.decorate()(u,r,o)})};return d(o,t,h("baseValue","bandwidth","align")),l(o,i,"key"),l(o,e,"curve"),o},w=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)},S=function(t){return t},A=function(t,e){var i=[10],o=null,c=function(){},a=null,l=6,f=6,d=3,s=r.line(),h=u("g","tick").key(S),g=u("path","domain"),v=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)}},y=function(t,n){return p()?"translate("+n+", "+t+")":"translate("+t+", "+n+")"},m=function(t){return p()?t.map(function(t){return[t[1],t[0]]}):t},p=function(){return"left"===t||"right"===t},x=function(t,n,r){return e[t]?e[t].apply(e,n):r},k=function(r){r.selection&&(h.transition(r),g.transition(r)),r.each(function(r,u,k){var b=k[u],w=n.select(b);b.__scale__||w.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor","right"===t?"start":"left"===t?"end":"middle");var A=b.__scale__||e;b.__scale__=e.copy();var z=null==o?x("ticks",i,e.domain()):o,T=null==a?x("tickFormat",i,S):a,_="bottom"===t||"right"===t?1:-1,O=e.range(),I=m([[O[0],_*l],[O[0],0],[O[1],0],[O[1],_*l]]);g(w,[r]).attr("d",s(I)).attr("stroke","#000");var V=h(w,z);V.enter().attr("transform",v(A,y)).append("path").attr("stroke","#000");var j=_*(f+d);V.enter().append("text").attr("transform",y(0,j)).attr("fill","#000"),V.exit().attr("transform",v(e,y)),V.select("path").attr("d",function(t){return s(m([[0,0],[0,_*f]]))}),V.select("text").attr("transform",y(0,j)).attr("dy",function(){var n="0em";return p()?n="0.32em":"bottom"===t&&(n="0.71em"),n}).text(T),V.attr("transform",v(e,y)),c(V,r,u)})};return k.tickFormat=function(){return arguments.length?(a=arguments.length<=0?void 0:arguments[0],k):a},k.tickSize=function(){return arguments.length?(f=l=Number(arguments.length<=0?void 0:arguments[0]),k):f},k.tickSizeInner=function(){return arguments.length?(f=Number(arguments.length<=0?void 0:arguments[0]),k):f},k.tickSizeOuter=function(){return arguments.length?(l=Number(arguments.length<=0?void 0:arguments[0]),k):l},k.tickPadding=function(){return arguments.length?(d=arguments.length<=0?void 0:arguments[0],k):d},k.decorate=function(){return arguments.length?(c=arguments.length<=0?void 0:arguments[0],k):c},k.scale=function(){return arguments.length?(e=arguments.length<=0?void 0:arguments[0],k):e},k.ticks=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return i=[].concat(n),k},k.tickArguments=function(){return arguments.length?(i=null==(arguments.length<=0?void 0:arguments[0])?[]:[].concat(w(arguments.length<=0?void 0:arguments[0])),k):i.slice()},k.tickValues=function(){return arguments.length?(o=null==(arguments.length<=0?void 0:arguments[0])?[]:[].concat(w(arguments.length<=0?void 0:arguments[0])),k):o.slice()},k},z=function(t){return A("top",t)},T=function(t){return A("bottom",t)},_=function(t){return A("left",t)},O=function(t){return A("right",t)},I=function(t){return"function"==typeof t?t:function(){return t}},V=function(t,r){return function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.scaleIdentity(),o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.scaleIdentity(),c=I(""),a=I(""),l=I("right"),f=I("bottom"),s=I(""),g=b(),y=null,m=void 0,p=void 0,x=void 0,k=void 0,S=void 0,A=void 0,V=void 0,j=function(){},F=null,q=void 0,N=void 0,P=void 0,C=void 0,E=void 0,L=void 0,X=void 0,Y=function(){},B=function(){},D=function(t){switch(t){case"bottom":return T();case"top":return z();case"left":return _();case"right":return O();case"none":return null}},M=function(t){switch(t){case"left":return"margin-left: 4em";case"right":return"margin-right: 4em";default:return""}},R=function(t){switch(t){case"left":return"padding-right: 1em";case"right":return"padding-left: 1em";case"none":return"padding-left: 1em; padding-right: 1em";default:return""}},G=function(t){switch(t){case"bottom":return"flex-direction: column";default:return"flex-direction: column-reverse"}},U=function(t){switch(t){case"right":return"flex-direction: row";default:return"flex-direction: row-reverse"}},$=u("d3fc-group","cartesian-chart"),H=function(t){return function(n){return t.selection?n.transition(t):n}},J=function(e){var u=H(e);e.each(function(e,d,h){var v=$(n.select(h[d]),[e]),b=f(e),z=l(e),T=D(b),_=D(z),O=T?"<d3fc-svg class='x-axis' style='height: 2em; "+M(z)+"'></d3fc-svg>\n <div class='x-axis-label' style='height: 1em; line-height: 1em; text-align: center; "+M(z)+"'></div>":"",I=_?"<d3fc-svg class='y-axis' style='width: 3em'></d3fc-svg>\n <div style='width: 1em; display: flex; align-items: center; justify-content: center'>\n <div class='y-axis-label' style='transform: rotate(-90deg)'></div>\n </div>":"";v.enter().attr("style","display: flex; height: 100%; width: 100%; flex-direction: column; overflow: hidden").attr("auto-resize","").html("<div class='chart-label'\n style='height: "+(s?2:0)+"em; line-height: 2em; text-align: center; "+M(z)+"'>\n </div>\n <div style='flex: 1; display: flex; "+G(b)+"; "+R(z)+"'>\n <div style='flex: 1; display: flex; "+U(z)+"'>\n <"+t+" class='plot-area' style='flex: 1; overflow: hidden'></"+t+">\n "+I+"\n </div>\n "+O+"\n </div>"),v.select(".y-axis-label").text(c(e)),v.select(".x-axis-label").text(a(e)),v.select(".chart-label").text(s(e)),v.select(".y-axis").on("measure",function(t,e,r){if("left"===z){var i=n.event.detail,o=i.width,c=i.height;n.select(r[e]).select("svg").attr("viewBox",-o+" 0 "+o+" "+c)}}).on("draw",function(t,e,r){_.tickFormat(F).decorate(Y),q&&_.ticks.apply(_,w(q)),N&&_.tickArguments(N),P&&_.tickSize(P),C&&_.tickSizeInner(C),E&&_.tickSizeOuter(E),L&&_.tickValues(L),X&&_.tickPadding(X),u(n.select(r[e])).select("svg").call(_.scale(o))}),v.select(".x-axis").on("measure",function(t,e,r){if("top"===b){var i=n.event.detail,o=i.width,c=i.height;n.select(r[e]).select("svg").attr("viewBox","0 "+-c+" "+o+" "+c)}}).on("draw",function(t,e,r){T.tickFormat(y).decorate(j),m&&T.ticks.apply(T,w(m)),p&&T.tickArguments(p),x&&T.tickSize(x),k&&T.tickSizeInner(k),S&&T.tickSizeOuter(S),A&&T.tickValues(A),V&&T.tickPadding(V),u(n.select(r[e])).select("svg").call(T.scale(i))}),v.select(".plot-area").on("measure",function(){var t=n.event.detail,e=t.width,r=t.height;i.range([0,e]),o.range([r,0])}).on("draw",function(t,n,e){g.xScale(i).yScale(o),r(t,e[n],g,u)}),v.each(function(t,n,e){return e[n].requestRedraw()}),B(v,e,d)})},K=h(/range\w*/,/tickFormat/);return d(J,i,K,v("x")),d(J,o,K,v("y")),J.xTickFormat=function(){return arguments.length?(y=arguments.length<=0?void 0:arguments[0],J):y},J.xTicks=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return n.length?(m=n,J):m},J.xTickArguments=function(){return arguments.length?(p=arguments.length<=0?void 0:arguments[0],J):p},J.xTickSize=function(){return arguments.length?(x=arguments.length<=0?void 0:arguments[0],J):x},J.xTickSizeInner=function(){return arguments.length?(k=arguments.length<=0?void 0:arguments[0],J):k},J.xTickSizeOuter=function(){return arguments.length?(S=arguments.length<=0?void 0:arguments[0],J):S},J.xTickValues=function(){return arguments.length?(A=arguments.length<=0?void 0:arguments[0],J):A},J.xTickPadding=function(){return arguments.length?(V=arguments.length<=0?void 0:arguments[0],J):V},J.xDecorate=function(){return arguments.length?(j=arguments.length<=0?void 0:arguments[0],J):j},J.yTickFormat=function(){return arguments.length?(F=arguments.length<=0?void 0:arguments[0],J):F},J.yTicks=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return n.length?(q=n,J):q},J.yTickArguments=function(){return arguments.length?(N=arguments.length<=0?void 0:arguments[0],J):N},J.yTickSize=function(){return arguments.length?(P=arguments.length<=0?void 0:arguments[0],J):P},J.yTickSizeInner=function(){return arguments.length?(C=arguments.length<=0?void 0:arguments[0],J):C},J.yTickSizeOuter=function(){return arguments.length?(E=arguments.length<=0?void 0:arguments[0],J):E},J.yTickValues=function(){return arguments.length?(L=arguments.length<=0?void 0:arguments[0],J):L},J.yTickPadding=function(){return arguments.length?(X=arguments.length<=0?void 0:arguments[0],J):X},J.yDecorate=function(){return arguments.length?(Y=arguments.length<=0?void 0:arguments[0],J):Y},J.yOrient=function(){return arguments.length?(l=I(arguments.length<=0?void 0:arguments[0]),J):l},J.xOrient=function(){return arguments.length?(f=I(arguments.length<=0?void 0:arguments[0]),J):f},J.chartLabel=function(){return arguments.length?(s=I(arguments.length<=0?void 0:arguments[0]),J):s},J.plotArea=function(){return arguments.length?(g=arguments.length<=0?void 0:arguments[0],J):g},J.xLabel=function(){return arguments.length?(a=I(arguments.length<=0?void 0:arguments[0]),J):a},J.yLabel=function(){return arguments.length?(c=I(arguments.length<=0?void 0:arguments[0]),J):c},J.decorate=function(){return arguments.length?(B=arguments.length<=0?void 0:arguments[0],J):B},J}},j=V("d3fc-svg",function(t,e,r,i){i(n.select(e)).select("svg").call(r)}),F=function(){return j.apply(void 0,arguments)},q=V("d3fc-canvas",function(t,n,e){var r=n.childNodes[0];e.context(r.getContext("2d")),e(t)}),N=function(){return q.apply(void 0,arguments)};t.chartSvgCartesian=F,t.chartCanvasCartesian=N,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -6,2 +6,10 @@ # Change Log | ||
<a name="2.0.10"></a> | ||
## [2.0.10](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-chart@2.0.9...@d3fc/d3fc-chart@2.0.10) (2018-08-23) | ||
**Note:** Version bump only for package @d3fc/d3fc-chart | ||
<a name="2.0.9"></a> | ||
@@ -11,6 +19,9 @@ ## [2.0.9](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-chart@2.0.8...@d3fc/d3fc-chart@2.0.9) (2018-08-22) | ||
### Bug Fixes | ||
* add overflow hidden to plot-area ([92e6629](https://github.com/d3fc/d3fc/commit/92e6629)), closes [#1144](https://github.com/d3fc/d3fc/issues/1144) | ||
**Note:** Version bump only for package @d3fc/d3fc-chart | ||
<a name="2.0.8"></a> | ||
@@ -17,0 +28,0 @@ ## [2.0.8](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-chart@2.0.7...@d3fc/d3fc-chart@2.0.8) (2018-08-21) |
{ | ||
"name": "@d3fc/d3fc-chart", | ||
"version": "2.0.9", | ||
"version": "2.0.10", | ||
"description": "A simple Cartesian chart component that renders to canvas or SVG.", | ||
@@ -33,3 +33,3 @@ "license": "MIT", | ||
"@d3fc/d3fc-data-join": "^5.0.5", | ||
"@d3fc/d3fc-element": "^5.0.8", | ||
"@d3fc/d3fc-element": "^5.0.9", | ||
"@d3fc/d3fc-rebind": "^5.0.5", | ||
@@ -36,0 +36,0 @@ "@d3fc/d3fc-series": "^4.0.8", |
@@ -133,3 +133,3 @@ import { select, event } from 'd3-selection'; | ||
<div style='flex: 1; display: flex; ${rowFlexDirection(yOrientValue)}'> | ||
<${d3fcElementType} class='plot-area' style='flex: 1'></${d3fcElementType}> | ||
<${d3fcElementType} class='plot-area' style='flex: 1; overflow: hidden'></${d3fcElementType}> | ||
${yAxisMarkup} | ||
@@ -136,0 +136,0 @@ </div> |
164930
Updated@d3fc/d3fc-element@^5.0.9