diff --git a/src/main/java/io/morethan/jenkins/jmhreport/Archive.java b/src/main/java/io/morethan/jenkins/jmhreport/Archive.java new file mode 100644 index 0000000..8265bd5 --- /dev/null +++ b/src/main/java/io/morethan/jenkins/jmhreport/Archive.java @@ -0,0 +1,16 @@ +package io.morethan.jenkins.jmhreport; + +public final class Archive { + + static String resultFileName(String archiveName) { + return String.format("%s-%s", archiveName, Constants.ARCHIVED_RESULT_FILE); + } + + static String runUrl(String reportName) { + return String.format("%s-%s", RunJmhView.URL_NAME, reportName); + } + + static String runDisplayName(String reportName) { + return String.format("%s - %s", "JMH Run Report", reportName); + } +} diff --git a/src/main/java/io/morethan/jenkins/jmhreport/JmhPublisherDslExtension.java b/src/main/java/io/morethan/jenkins/jmhreport/JmhPublisherDslExtension.java index e5f1ff5..3267624 100644 --- a/src/main/java/io/morethan/jenkins/jmhreport/JmhPublisherDslExtension.java +++ b/src/main/java/io/morethan/jenkins/jmhreport/JmhPublisherDslExtension.java @@ -11,6 +11,8 @@ public class JmhPublisherDslExtension extends ContextExtensionPoint @DslExtensionMethod(context=PublisherContext.class) public Object jmhPublisher(String resultPath) { - return new RunPublisher(resultPath); + RunPublisher runPublisher = new RunPublisher(); + runPublisher.setResultPath(resultPath); + return runPublisher; } } diff --git a/src/main/java/io/morethan/jenkins/jmhreport/ProjectJmhView.java b/src/main/java/io/morethan/jenkins/jmhreport/ProjectJmhView.java deleted file mode 100644 index de4a7b9..0000000 --- a/src/main/java/io/morethan/jenkins/jmhreport/ProjectJmhView.java +++ /dev/null @@ -1,89 +0,0 @@ -package io.morethan.jenkins.jmhreport; - -import java.io.File; -import java.io.IOException; -import java.io.Serializable; - -import javax.servlet.ServletException; - -import org.kohsuke.stapler.Stapler; -import org.kohsuke.stapler.StaplerRequest; -import org.kohsuke.stapler.StaplerResponse; - -import hudson.model.Action; -import hudson.model.Job; -import hudson.model.Result; -import hudson.model.Run; - -/** - * The {@link Action} responsible for displaying the JMH report page on project level. - * - *
- * See corresponding Jelly files under src/main/resources. - *
- */ -public class ProjectJmhView implements Action, Serializable { - - private static final String URL_NAME = "jmh-report"; - - private static final long serialVersionUID = 1L; - - private final Job, ?> _project; - - public ProjectJmhView(Job, ?> project) { - _project = project; - } - - @Override - public String getIconFileName() { - return Constants.ICON_NAME; - } - - @Override - public String getDisplayName() { - return "JMH Report"; - } - - @Override - public String getUrlName() { - return URL_NAME; - } - - public Job, ?> getProject() { - return _project; - } - - public String getContextPath() { - return Stapler.getCurrentRequest().getContextPath(); - } - - public String getProvidedJsUrl() { - String contextPath = Stapler.getCurrentRequest().getContextPath(); - Run, ?> lastSuccessfulBuild = getProject().getLastSuccessfulBuild(); - String providedId = lastSuccessfulBuild == null ? "none" : Integer.toString(lastSuccessfulBuild.getNumber()); - return new StringBuilder(contextPath).append("/").append(getProject().getUrl()).append(URL_NAME) - .append("/provided-").append(providedId).append(".js").toString(); - } - - public void doDynamic(final StaplerRequest request, final StaplerResponse response) - throws IOException, ServletException { - ProvidedJsBuilder jsBuilder = new ProvidedJsBuilder(); - int addedReports = 0; - for (Run, ?> run : _project.getBuilds()) { - if (run.getResult() == Result.SUCCESS || run.getResult() == Result.UNSTABLE) { - File reportFile = new File(run.getRootDir(), Constants.ARCHIVED_RESULT_FILE); - if (reportFile.exists()) { - jsBuilder.addRun(Integer.toString(run.getNumber()), reportFile); - addedReports++; - if (addedReports == 50) { - // TODO make this configurable - break; - } - } - } - } - response.setContentType("text/javascript;charset=UTF-8"); - response.getWriter().println(jsBuilder.buildReverse()); - } - -} diff --git a/src/main/java/io/morethan/jenkins/jmhreport/RunJmhView.java b/src/main/java/io/morethan/jenkins/jmhreport/RunJmhView.java index d31683a..1c5bf9e 100644 --- a/src/main/java/io/morethan/jenkins/jmhreport/RunJmhView.java +++ b/src/main/java/io/morethan/jenkins/jmhreport/RunJmhView.java @@ -3,8 +3,7 @@ import java.io.File; import java.io.IOException; import java.io.Serializable; -import java.util.Arrays; -import java.util.Collection; +import java.util.*; import javax.servlet.ServletException; @@ -25,14 +24,16 @@ */ public class RunJmhView implements Action, LastBuildAction, Serializable { - private static final String URL_NAME = "jmh-run-report"; + static final String URL_NAME = "jmh-run-report"; private static final long serialVersionUID = 1L; private final Run, ?> _run; + private final String _reportName; - public RunJmhView(Run, ?> run) { + public RunJmhView(Run, ?> run, String reportName) { _run = run; + _reportName = reportName; } /** @@ -46,12 +47,12 @@ public String getIconFileName() { @Override public String getDisplayName() { - return "JMH Run Report"; + return Archive.runDisplayName(_reportName); } @Override public String getUrlName() { - return URL_NAME; + return Archive.runUrl(_reportName); } public Run, ?> getRun() { @@ -72,7 +73,7 @@ public String getContextPath() { public String getProvidedJsUrl() { String contextPath = Stapler.getCurrentRequest().getContextPath(); - return new StringBuilder(contextPath).append("/").append(getRun().getUrl()).append(URL_NAME) + return new StringBuilder(contextPath).append("/").append(getRun().getUrl()).append(getUrlName()) .append("/provided-").append(getBuildNumber()).append(".js").toString(); } @@ -84,30 +85,27 @@ public String getBundleJsUrl() { public void doDynamic(final StaplerRequest request, final StaplerResponse response) throws IOException, ServletException { ProvidedJsBuilder jsBuilder = new ProvidedJsBuilder(); - File resultFile = new File(_run.getRootDir(), Constants.ARCHIVED_RESULT_FILE); + File resultFile = new File(_run.getRootDir(), Archive.resultFileName(_reportName)); jsBuilder.addRun(getBuildNumber(), resultFile); - addPossiblePreviousBuild(jsBuilder, _run); + addPossiblePreviousBuild(jsBuilder, _run, _reportName); response.setContentType("text/javascript;charset=UTF-8"); response.getWriter().println(jsBuilder.buildReverse()); } - private static void addPossiblePreviousBuild(ProvidedJsBuilder jsBuilder, Run, ?> run) { - while ((run = run.getPreviousNotFailedBuild()) != null) { - File previousResultFile = new File(run.getRootDir(), Constants.ARCHIVED_RESULT_FILE); + private static void addPossiblePreviousBuild(ProvidedJsBuilder jsBuilder, Run, ?> run, String reportName) { + int runCount = 0; + while ((run = run.getPreviousNotFailedBuild()) != null && runCount++ < 10) { + File previousResultFile = new File(run.getRootDir(), Archive.resultFileName(reportName)); if (previousResultFile.exists()) { jsBuilder.addRun(run.getNumber(), previousResultFile); - - // For the run view we only display the latest 2 runs (currently) - return; } } } @Override public Collection extends Action> getProjectActions() { - return Arrays.asList(new ProjectJmhView(_run.getParent())); + return new ArrayList<>(); } - } diff --git a/src/main/java/io/morethan/jenkins/jmhreport/RunPublisher.java b/src/main/java/io/morethan/jenkins/jmhreport/RunPublisher.java index 60215ad..2573711 100644 --- a/src/main/java/io/morethan/jenkins/jmhreport/RunPublisher.java +++ b/src/main/java/io/morethan/jenkins/jmhreport/RunPublisher.java @@ -1,11 +1,5 @@ package io.morethan.jenkins.jmhreport; -import java.io.File; -import java.io.IOException; - -import org.jenkinsci.Symbol; -import org.kohsuke.stapler.DataBoundConstructor; - import hudson.AbortException; import hudson.Extension; import hudson.FilePath; @@ -19,24 +13,43 @@ import hudson.tasks.Publisher; import hudson.tasks.Recorder; import jenkins.tasks.SimpleBuildStep; +import org.jenkinsci.Symbol; +import org.kohsuke.stapler.DataBoundConstructor; +import org.kohsuke.stapler.DataBoundSetter; + +import java.io.File; +import java.io.IOException; /** * A {@link Recorder} executed after each build. It copies the JMH result file - * into the corresponding build dir and registers the {@link ProjectJmhView} - * which renders the build run report and itself registers the - * {@link ProjectJmhView} through {@link LastBuildAction}. + * into the corresponding build dir. */ public class RunPublisher extends Recorder implements SimpleBuildStep { - private final String _resultPath; + private String _resultPath; + + private String _reportName; + + public String getResultPath() { + return _resultPath; + } @DataBoundConstructor - public RunPublisher(String resultPath) { + public RunPublisher() { + } + + @DataBoundSetter + public void setResultPath(String resultPath) { _resultPath = resultPath; } - public String getResultPath() { - return _resultPath; + public String getReportName() { + return _reportName; + } + + @DataBoundSetter + public void setReportName(String reportName) { + _reportName = reportName; } @Override @@ -62,11 +75,11 @@ public void perform(Run, ?> run, FilePath workspace, Launcher launcher, TaskLi listener.getLogger().println("Found JMH result: " + _resultPath); // Copy the result file into the build dir of the Jenkins project - File archivedResult = new File(run.getRootDir(), Constants.ARCHIVED_RESULT_FILE); + File archivedResult = new File(run.getRootDir(), Archive.resultFileName(_reportName)); resultFile.copyTo(new FilePath(archivedResult)); listener.getLogger().println("Archived JMH result to: " + archivedResult); - run.addAction(new RunJmhView(run)); + run.addAction(new RunJmhView(run, getReportName())); // TODO set on major decreases ? // build.setResult(Result.UNSTABLE); } diff --git a/src/main/resources/io/morethan/jenkins/jmhreport/ProjectJmhView/index.jelly b/src/main/resources/io/morethan/jenkins/jmhreport/ProjectJmhView/index.jelly deleted file mode 100644 index da0569c..0000000 --- a/src/main/resources/io/morethan/jenkins/jmhreport/ProjectJmhView/index.jelly +++ /dev/null @@ -1,12 +0,0 @@ - -c)break;m.push(f)}}else for(;d
=1;--u)if(!((f=l*u) c)break;m.push(f)}}else for(;d =1;--u)if(!((f=l*u)c)break;m.push(f)}}else m=hc(d,p,Math.min(p-d,h)).map(a);return o?m.reverse():m},e.tickFormat=function(t,o){if(null==o&&(o=10===n?".0e":","),"function"!=typeof o&&(o=vu(o)),t===1/0)return o;null==t&&(t=10);var i=Math.max(1,n*t/e.ticks().length);return function(e){var t=e/a(Math.round(r(e)));return t*n=c)return-1;if(37===(a=t.charCodeAt(i++))){if(a=t.charAt(i++),!(o=x[a in Hf?t.charAt(i++):a])||(r=o(e,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}return v.x=k(n,v),v.X=k(r,v),v.c=k(t,v),w.x=k(n,w),w.X=k(r,w),w.c=k(t,w),{format:function(e){var t=k(e+="",v);return t.toString=function(){return e},t},parse:function(e){var t=_(e+="",zf);return t.toString=function(){return e},t},utcFormat:function(e){var t=k(e+="",w);return t.toString=function(){return e},t},utcParse:function(e){var t=_(e,Rf);return t.toString=function(){return e},t}}}(e),Ff=Lf.format,Lf.parse,qf=Lf.utcFormat,Wf=Lf.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});Date.prototype.toISOString||qf("%Y-%m-%dT%H:%M:%S.%LZ");+new Date("2000-01-01T00:00:00.000Z")||Wf("%Y-%m-%dT%H:%M:%S.%LZ");var ep=1e3,tp=60*ep,np=60*tp,rp=24*np,ap=7*rp,op=30*rp,ip=365*rp;function sp(e){return new Date(e)}function cp(e){return e instanceof Date?+e:+new Date(+e)}function lp(e,t,n,r,a,o,i,s,c){var l=fu(su,Fl),u=l.invert,f=l.domain,d=c(".%L"),p=c(":%S"),h=c("%I:%M"),m=c("%I %p"),b=c("%a %d"),g=c("%b %d"),y=c("%B"),v=c("%Y"),w=[[i,1,ep],[i,5,5*ep],[i,15,15*ep],[i,30,30*ep],[o,1,tp],[o,5,5*tp],[o,15,15*tp],[o,30,30*tp],[a,1,np],[a,3,3*np],[a,6,6*np],[a,12,12*np],[r,1,rp],[r,2,2*rp],[n,1,ap],[t,1,op],[t,3,3*op],[e,1,ip]];function x(s){return(i(s)1&&void 0!==arguments[1]?arguments[1]:{}).bandAware;if(void 0!==e){if(t){var n=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+n}return this.scale(e)}}},{key:"isInRange",value:function(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}},{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}}]),e}();jp.EPS=1e-4;var Ap,Bp,Ip,Np=function(){function e(t){Ep(this,e),this.scales=Gn.a.mapValues(t,jp.create),Object.assign(this,this.scales)}return Op(e,null,[{key:"create",value:function(e){return new this(e)}}]),Op(e,[{key:"apply",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).bandAware,n=this.scales;return Gn.a.mapValues(e,function(e,r){return n[r].apply(e,{bandAware:t})})}},{key:"isInRange",value:function(e){var t=this.scales;return Gn.a.every(e,function(e,n){return t[n].isInRange(e)})}}]),e}();function Dp(e){return(Dp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function zp(){return(zp=Object.assign||function(e){for(var t=1;tc)return!1;if(0===o)return!0;var l,u=function(e){var t=e.startAngle,n=e.endAngle,r=Math.floor(t/360),a=Math.floor(n/360),o=Math.min(r,a);return{startAngle:t-360*o,endAngle:n-360*o}}(t),f=u.startAngle,d=u.endAngle,p=i;if(f<=d){for(;p>d;)p-=360;for(;p=0});if(m&&m.length){var b=m[0].props.barSize,g=m[0].props[h];a[g]||(a[g]=[]),a[g].push({item:m[0],stackList:m.slice(1),barSize:Gn.a.isNil(b)?t:b})}}return a}({barSize:f,stackGroups:o}),x=[];return r.forEach(function(r,f){var b,k=n.constructor.getDisplayedData(e,{dataStartIndex:l,dataEndIndex:u},r),_=r.props,E=_.dataKey,S=_.maxBarSize,O=r.props["".concat(g,"Id")],T=r.props["".concat(y,"Id")],M=s.reduce(function(e,n){var a,o=t["".concat(n.axisType,"Map")],i=r.props["".concat(n.axisType,"Id")],s=o&&o[i];return Sw({},e,(Ow(a={},n.axisType,s),Ow(a,"".concat(n.axisType,"Ticks"),Xh(s)),a))},{}),C=M[y],P=M["".concat(y,"Ticks")],j=o&&o[O]&&o[O].hasStack&&function(e,t){var n=e.props.stackId;if(Qn(n)){var r=t[n];if(r&&r.items.length){for(var a=-1,o=0,i=r.items.length;o=0?r.stackedData[a]:null}}return null}(r,o[O].stackGroups),A=pm(C,P),B=Gn.a.isNil(S)?m:S,I=v&&function(e){var t=e.barGap,n=e.barCategoryGap,r=e.bandSize,a=e.sizeList,o=void 0===a?[]:a,i=e.maxBarSize,s=o.length;if(s<1)return null;var c,l=tr(t,r,0,!0);if(o[0].barSize===+o[0].barSize){var u=!1,f=r/s,d=o.reduce(function(e,t){return e+t.barSize||0},0);(d+=(s-1)*l)>=r&&(d-=(s-1)*l,l=0),d>=r&&f>0&&(u=!0,d=s*(f*=.9));var p={offset:((r-d)/2>>0)-l,size:0};c=o.reduce(function(e,t){var n=Rh(e).concat([{item:t.item,position:{offset:p.offset+p.size+l,size:u?f:t.barSize}}]);return p=n[n.length-1].position,t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){n.push({item:e,position:p})}),n},[])}else{var h=tr(n,r,0,!0);r-2*h-(s-1)*l<=0&&(l=0);var m=(r-2*h-(s-1)*l)/s;m>1&&(m>>=0);var b=i===+i?Math.min(m,i):m;c=o.reduce(function(e,t,n){var r=Rh(e).concat([{item:t.item,position:{offset:h+(m+l)*n+(m-b)/2,size:b}}]);return t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:r[r.length-1].position})}),r},[])}return c}({barGap:p,barCategoryGap:h,bandSize:A,sizeList:w[T],maxBarSize:B}),N=r&&r.type&&r.type.getComposedData;N&&x.push({props:Sw({},N(Sw({},M,{displayedData:k,props:e,dataKey:E,item:r,bandSize:A,barPosition:I,offset:i,stackedData:j,layout:d,dataStartIndex:l,dataEndIndex:u,onItemMouseLeave:$h(n.handleItemMouseLeave,null,r.props.onMouseLeave),onItemMouseEnter:$h(n.handleItemMouseEnter,null,r.props.onMouseEnter)})),(b={key:r.key||"item-".concat(f)},Ow(b,g,M[g]),Ow(b,y,M[y]),Ow(b,"animationId",c),b)),childIndex:function(e,t){var n=-1;return a.Children.forEach(t,function(t,r){t===e&&(n=r)}),n}(r,e.children),item:r})}),x}},{key:"getCursorRectangle",value:function(){var e=this.props.layout,t=this.state,n=t.activeCoordinate,r=t.offset,a=t.tooltipAxisBandSize,o=a/2;return{stroke:"none",fill:"#ccc",x:"horizontal"===e?n.x-o:r.left+.5,y:"horizontal"===e?r.top+.5:n.y-o,width:"horizontal"===e?a:r.width-1,height:"horizontal"===e?r.height-1:a}}},{key:"getCursorPoints",value:function(){var e,t,n,r,a=this.props.layout,o=this.state,i=o.activeCoordinate,s=o.offset;if("horizontal"===a)n=e=i.x,t=s.top,r=s.top+s.height;else if("vertical"===a)r=t=i.y,e=s.left,n=s.left+s.width;else if(!Gn.a.isNil(i.cx)||!Gn.a.isNil(i.cy)){if("centric"!==a){var c=i.cx,l=i.cy,u=i.radius,f=i.startAngle,d=i.endAngle;return{points:[vm(c,l,u,f),vm(c,l,u,d)],cx:c,cy:l,radius:u,startAngle:f,endAngle:d}}var p=i.cx,h=i.cy,m=i.innerRadius,b=i.outerRadius,g=i.angle,y=vm(p,h,m,g),v=vm(p,h,b,g);e=y.x,t=y.y,n=v.x,r=v.y}return[{x:e,y:t},{x:n,y:r}]}},{key:"calculateTooltipPos",value:function(e){var t=this.props.layout;return"horizontal"===t?e.x:"vertical"===t?e.y:"centric"===t?e.angle:e.radius}},{key:"inRange",value:function(e,t){var n=this.props.layout;if("horizontal"===n||"vertical"===n){var r=this.state.offset;return e>=r.left&&e<=r.left+r.width&&t>=r.top&&t<=r.top+r.height?{x:e,y:t}:null}var a=this.state,o=a.angleAxisMap,i=a.radiusAxisMap;if(o&&i){var s=nr(o);return _m({x:e,y:t},s)}return null}},{key:"parseEventsOfWrapper",value:function(){var e=this.props.children,t=gr(e,_s)&&"axis"===i?{onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd}:{};return Sw({},wr(this.props,this.handleOuterEvent),t)}},{key:"updateStateOfAxisMapsOffsetAndStackGroups",value:function(e){var r=this,a=e.props,o=e.dataStartIndex,i=e.dataEndIndex,c=e.updateId;if(!_r({props:a}))return null;var u=a.children,f=a.layout,d=a.stackOffset,p=a.data,h=a.reverseStackOrder,m=this.constructor.getAxisNameByLayout(f),b=m.numericAxisName,g=m.cateAxisName,y=br(u,n),v=function(e,t,n,r,a,o){if(!e)return null;var i=(o?t.reverse():t).reduce(function(e,t){var a=t.props,o=a.stackId;if(a.hide)return e;var i=t.props[n],s=e[i]||{hasStack:!1,stackGroups:{}};if(Qn(o)){var c=s.stackGroups[o]||{numericAxisId:n,cateAxisId:r,items:[]};c.items.push(t),s.hasStack=!0,s.stackGroups[o]=c}else s.stackGroups[er("_stackId_")]={numericAxisId:n,cateAxisId:r,items:[t]};return Uh({},e,Lh({},i,s))},{});return Object.keys(i).reduce(function(t,o){var s=i[o];return s.hasStack&&(s.stackGroups=Object.keys(s.stackGroups).reduce(function(t,o){var i=s.stackGroups[o];return Uh({},t,Lh({},o,{numericAxisId:n,cateAxisId:r,items:i.items,stackedData:nm(e,i.items,a)}))},{})),Uh({},t,Lh({},o,s))},{})}(p,y,"".concat(b,"Id"),"".concat(g,"Id"),d,h),w=s.reduce(function(e,t){return Sw({},e,Ow({},"".concat(t.axisType,"Map"),r.getAxisMap(a,Sw({},t,{graphicalItems:y,stackGroups:t.axisType===b&&v,dataStartIndex:o,dataEndIndex:i}))))},{}),x=this.calculateOffset(Sw({},w,{props:a,graphicalItems:y}));Object.keys(w).forEach(function(e){w[e]=l(a,w[e],x,e.replace("Map",""),t)});var k=w["".concat(g,"Map")],_=this.tooltipTicksGenerator(k);return Sw({formatedGraphicalItems:this.getFormatItems(a,Sw({},w,{dataStartIndex:o,dataEndIndex:i,updateId:c,graphicalItems:y,stackGroups:v,offset:x})),graphicalItems:y,offset:x,stackGroups:v},_,w)}},{key:"addListener",value:function(){vw.on(ww,this.handleReceiveSyncEvent),vw.setMaxListeners&&vw._maxListeners&&vw.setMaxListeners(vw._maxListeners+1)}},{key:"removeListener",value:function(){vw.removeListener(ww,this.handleReceiveSyncEvent),vw.setMaxListeners&&vw._maxListeners&&vw.setMaxListeners(vw._maxListeners-1)}},{key:"calculateOffset",value:function(e){var t=e.props,n=e.graphicalItems,r=e.xAxisMap,a=void 0===r?{}:r,o=e.yAxisMap,i=void 0===o?{}:o,s=t.width,c=t.height,l=t.children,u=t.margin||{},f=gr(l,_y),d=gr(l,Bo),p=Object.keys(i).reduce(function(e,t){var n=i[t],r=n.orientation;return n.mirror||n.hide?e:Sw({},e,Ow({},r,e[r]+n.width))},{left:u.left||0,right:u.right||0}),h=Sw({},Object.keys(a).reduce(function(e,t){var n=a[t],r=n.orientation;return n.mirror||n.hide?e:Sw({},e,Ow({},r,e[r]+n.height))},{top:u.top||0,bottom:u.bottom||0}),p),m=h.bottom;return f&&(h.bottom+=f.props.height||_y.defaultProps.height),d&&this.legendInstance&&(h=function(e,t,n,r){var a=n.children,o=n.width,i=n.height,s=n.margin,c=o-(s.left||0)-(s.right||0),l=i-(s.top||0)-(s.bottom||0),u=Hh({children:a,items:t,legendWidth:c,legendHeight:l}),f=e;if(u){var d=r||{},p=u.align,h=u.verticalAlign,m=u.layout;("vertical"===m||"horizontal"===m&&"center"===h)&&Jn(e[p])&&(f=Uh({},e,Lh({},p,f[p]+(d.width||0)))),("horizontal"===m||"vertical"===m&&"center"===p)&&Jn(e[h])&&(f=Uh({},e,Lh({},h,f[h]+(d.height||0))))}return f}(h,n,t,this.legendInstance.getBBox())),Sw({brushBottom:m},h,{width:s-h.left-h.right,height:c-h.top-h.bottom})}},{key:"triggerSyncEvent",value:function(e){var t=this.props.syncId;Gn.a.isNil(t)||vw.emit(ww,t,this.uniqueChartId,e)}},{key:"filterFormatItem",value:function(e,t,n){for(var r=this.state.formatedGraphicalItems,a=0,o=r.length;a=1)for(var u=(t-n)/l,f=0,d=o.length;f0?(r=n/c)*r:n;return c===1/0?1/0:c*Math.sqrt(o)}})},function(e,t,n){var r=n(23),a=Math.imul;r(r.S+r.F*n(104)(function(){return-5!=a(4294967295,5)||2!=a.length}),"Math",{imul:function(e,t){var n=+e,r=+t,a=65535&n,o=65535&r;return 0|a*o+((65535&n>>>16)*o+a*(65535&r>>>16)<<16>>>0)}})},function(e,t,n){var r=n(23);r(r.S,"Math",{log10:function(e){return Math.log(e)*Math.LOG10E}})},function(e,t,n){var r=n(23);r(r.S,"Math",{log1p:n(237)})},function(e,t,n){var r=n(23);r(r.S,"Math",{log2:function(e){return Math.log(e)/Math.LN2}})},function(e,t,n){var r=n(23);r(r.S,"Math",{sign:n(155)})},function(e,t,n){var r=n(23),a=n(156),o=Math.exp;r(r.S+r.F*n(104)(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function(e){return Math.abs(e=+e)<1?(a(e)-a(-e))/2:(o(e-1)-o(-e-1))*(Math.E/2)}})},function(e,t,n){var r=n(23),a=n(156),o=Math.exp;r(r.S,"Math",{tanh:function(e){var t=a(e=+e),n=a(-e);return t==1/0?1:n==1/0?-1:(t-n)/(o(e)+o(-e))}})},function(e,t,n){var r=n(23);r(r.S,"Math",{trunc:function(e){return(e>0?Math.floor:Math.ceil)(e)}})},function(e,t,n){var r=n(238),a=n(243),o=n(543),i=n(547),s=n(562),c=n(28),l=n(248),u=n(250),f=1,d="[object Arguments]",p="[object Array]",h="[object Object]",m=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,b,g,y){var v=c(e),w=c(t),x=v?p:s(e),k=w?p:s(t),_=(x=x==d?h:x)==h,E=(k=k==d?h:k)==h,S=x==k;if(S&&l(e)){if(!l(t))return!1;v=!0,_=!1}if(S&&!_)return y||(y=new r),v||u(e)?a(e,t,n,b,g,y):o(e,t,x,n,b,g,y);if(!(n&f)){var O=_&&m.call(e,"__wrapped__"),T=E&&m.call(t,"__wrapped__");if(O||T){var M=O?e.value():e,C=T?t.value():t;return y||(y=new r),g(M,C,n,b,y)}}return!!S&&(y||(y=new r),i(e,t,n,b,g,y))}},function(e,t){e.exports=function(){this.__data__=[],this.size=0}},function(e,t,n){var r=n(106),a=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0||(n==t.length-1?t.pop():a.call(t,n,1),--this.size,0))}},function(e,t,n){var r=n(106);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},function(e,t,n){var r=n(106);e.exports=function(e){return r(this.__data__,e)>-1}},function(e,t,n){var r=n(106);e.exports=function(e,t){var n=this.__data__,a=r(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this}},function(e,t,n){var r=n(105);e.exports=function(){this.__data__=new r,this.size=0}},function(e,t){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},function(e,t){e.exports=function(e){return this.__data__.get(e)}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,n){var r=n(105),a=n(159),o=n(161),i=200;e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var s=n.__data__;if(!a||s.length0?r=mc(s=Math.floor(s/r)*r,c=Math.ceil(c/r)*r,n):r<0&&(r=mc(s=Math.ceil(s*r)/r,c=Math.floor(c*r)/r,n)),r>0?(a[o]=Math.floor(s/r)*r,a[i]=Math.ceil(c/r)*r,t(a)):r<0&&(a[o]=Math.ceil(s*r)/r,a[i]=Math.floor(c*r)/r,t(a)),e},e}function Cu(){var e=fu(su,Fl);return e.copy=function(){return uu(e,Cu())},Mu(e)}function Pu(){var e=[0,1];function t(e){return+e}return t.invert=t,t.domain=t.range=function(n){return arguments.length?(e=Sc.call(n,ou),t):e.slice()},t.copy=function(){return Pu().domain(e)},Mu(t)}var ju=function(e,t){var n,r=0,a=(e=e.slice()).length-1,o=e[r],i=e[a];return ic)break;m.push(f)}}else m=hc(d,p,Math.min(p-d,h)).map(a);return o?m.reverse():m},e.tickFormat=function(t,o){if(null==o&&(o=10===n?".0e":","),"function"!=typeof o&&(o=vu(o)),t===1/0)return o;null==t&&(t=10);var i=Math.max(1,n*t/e.ticks().length);return function(e){var t=e/a(Math.round(r(e)));return t*n=c)return-1;if(37===(a=t.charCodeAt(i++))){if(a=t.charAt(i++),!(o=x[a in Hf?t.charAt(i++):a])||(r=o(e,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}return v.x=k(n,v),v.X=k(r,v),v.c=k(t,v),w.x=k(n,w),w.X=k(r,w),w.c=k(t,w),{format:function(e){var t=k(e+="",v);return t.toString=function(){return e},t},parse:function(e){var t=_(e+="",zf);return t.toString=function(){return e},t},utcFormat:function(e){var t=k(e+="",w);return t.toString=function(){return e},t},utcParse:function(e){var t=_(e,Rf);return t.toString=function(){return e},t}}}(e),Ff=Lf.format,Lf.parse,qf=Lf.utcFormat,Wf=Lf.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});Date.prototype.toISOString||qf("%Y-%m-%dT%H:%M:%S.%LZ");+new Date("2000-01-01T00:00:00.000Z")||Wf("%Y-%m-%dT%H:%M:%S.%LZ");var ep=1e3,tp=60*ep,np=60*tp,rp=24*np,ap=7*rp,op=30*rp,ip=365*rp;function sp(e){return new Date(e)}function cp(e){return e instanceof Date?+e:+new Date(+e)}function lp(e,t,n,r,a,o,i,s,c){var l=fu(su,Fl),u=l.invert,f=l.domain,d=c(".%L"),p=c(":%S"),h=c("%I:%M"),m=c("%I %p"),b=c("%a %d"),g=c("%b %d"),y=c("%B"),v=c("%Y"),w=[[i,1,ep],[i,5,5*ep],[i,15,15*ep],[i,30,30*ep],[o,1,tp],[o,5,5*tp],[o,15,15*tp],[o,30,30*tp],[a,1,np],[a,3,3*np],[a,6,6*np],[a,12,12*np],[r,1,rp],[r,2,2*rp],[n,1,ap],[t,1,op],[t,3,3*op],[e,1,ip]];function x(s){return(i(s)1&&void 0!==arguments[1]?arguments[1]:{}).bandAware;if(void 0!==e){if(t){var n=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+n}return this.scale(e)}}},{key:"isInRange",value:function(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}},{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}}]),e}();jp.EPS=1e-4;var Ap,Bp,Ip,Np=function(){function e(t){Ep(this,e),this.scales=Gn.a.mapValues(t,jp.create),Object.assign(this,this.scales)}return Op(e,null,[{key:"create",value:function(e){return new this(e)}}]),Op(e,[{key:"apply",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).bandAware,n=this.scales;return Gn.a.mapValues(e,function(e,r){return n[r].apply(e,{bandAware:t})})}},{key:"isInRange",value:function(e){var t=this.scales;return Gn.a.every(e,function(e,n){return t[n].isInRange(e)})}}]),e}();function Dp(e){return(Dp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function zp(){return(zp=Object.assign||function(e){for(var t=1;tc)return!1;if(0===o)return!0;var l,u=function(e){var t=e.startAngle,n=e.endAngle,r=Math.floor(t/360),a=Math.floor(n/360),o=Math.min(r,a);return{startAngle:t-360*o,endAngle:n-360*o}}(t),f=u.startAngle,d=u.endAngle,p=i;if(f<=d){for(;p>d;)p-=360;for(;p