diff --git a/htrace-core/src/web/app/views/swimlane/swimlane.js b/htrace-core/src/web/app/views/swimlane/swimlane.js index 878e2d0..2e42967 100644 --- a/htrace-core/src/web/app/views/swimlane/swimlane.js +++ b/htrace-core/src/web/app/views/swimlane/swimlane.js @@ -19,8 +19,7 @@ app.SwimlaneView = Backbone.Marionette.LayoutView.extend({ "template": "#swimlane-layout-template", "regions": { - "swimlane": "div[role='complementary']", - "content": "div[role='main']" + "swimlane": "div[role='main']", } }); @@ -34,10 +33,14 @@ app.SwimlaneGraphView = Backbone.Marionette.View.extend({ this.getJsonSync); }, - render: function() { + onShow: function() { this.appendSVG(this.spans); }, + onBeforeDestroy: function() { + d3.select("#svg-swimlane").remove(); + }, + getSpans: function getSpans(depth, spans, span, lim, getJSON) { span.depth = depth; spans.push(span); @@ -77,6 +80,7 @@ app.SwimlaneGraphView = Backbone.Marionette.View.extend({ .domain([new Date(tmin), new Date(tmax)]).range([0, width_span]); var svg = d3.select("div[role='main']").append("svg") + .attr("id", "svg-swimlane") .attr("width", width_span + margin.process + margin.left + margin.right) .attr("height", height_screen + margin.top + margin.bottom) .append("g") @@ -87,6 +91,15 @@ app.SwimlaneGraphView = Backbone.Marionette.View.extend({ .attr("width", width_span) .attr("height", height_screen) .attr("transform", "translate(" + (10 * dmax + margin.process) + ", 0)"); + + var axis = d3.svg.axis() + .scale(xscale) + .orient("top") + .tickValues(xscale.domain()) + .tickFormat(d3.time.format("%x %X.%L")) + .tickSize(6, 3); + + bars.append("g").attr("class", "axis").call(axis); var span_g = bars.selectAll("g.span") .data(spans) @@ -165,14 +178,5 @@ app.SwimlaneGraphView = Backbone.Marionette.View.extend({ .on("mouseout", function(d) { popup.transition().duration(300).style("opacity", 0); }); - - var axis = d3.svg.axis() - .scale(xscale) - .orient("top") - .tickValues(xscale.domain()) - .tickFormat(d3.time.format("%x %X.%L")) - .tickSize(6, 3); - - bars.append("g").attr("class", "axis").call(axis); } }); diff --git a/htrace-core/src/web/index.html b/htrace-core/src/web/index.html index bcfea19..d403860 100644 --- a/htrace-core/src/web/index.html +++ b/htrace-core/src/web/index.html @@ -169,10 +169,6 @@