|
|
@ -1938,18 +1938,16 @@ |
|
|
|
|
|
|
|
|
|
|
|
// bars
|
|
|
|
// bars
|
|
|
|
|
|
|
|
|
|
|
|
var barOnMain = function (isSub) { |
|
|
|
var drawBar = function (isSub) { |
|
|
|
var barW = getBarW(xAxis, barTargetsNum, !!isSub), |
|
|
|
var barW = getBarW(xAxis, barTargetsNum, !!isSub), |
|
|
|
barX = getBarX(barW, barTargetsNum, barIndices), |
|
|
|
x = getBarX(barW, barTargetsNum, barIndices, !!isSub), |
|
|
|
barY = getBarY(!!isSub), |
|
|
|
y = getBarY(!!isSub), |
|
|
|
barOffset = getBarOffset(barIndices); |
|
|
|
barOffset = getBarOffset(barIndices, !!isSub), |
|
|
|
|
|
|
|
yScale = isSub ? getSubYScale : getYScale; |
|
|
|
|
|
|
|
|
|
|
|
return function (d, i) { |
|
|
|
return function (d, i) { |
|
|
|
var y = barY; |
|
|
|
var y0 = yScale(d.id)(0), |
|
|
|
var x = barX; |
|
|
|
offset = barOffset(d, i) || y0; // offset is for stacked bar chart
|
|
|
|
|
|
|
|
|
|
|
|
var y0 = getYScale(d.id)(0), |
|
|
|
|
|
|
|
offset = barOffset(d, i) || y0; // offset is for stacked bar chart, by default
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 4 points that make a bar
|
|
|
|
// 4 points that make a bar
|
|
|
|
var points = [ |
|
|
|
var points = [ |
|
|
@ -1977,16 +1975,14 @@ |
|
|
|
.data(barData); |
|
|
|
.data(barData); |
|
|
|
|
|
|
|
|
|
|
|
mainBar.enter().append('path') |
|
|
|
mainBar.enter().append('path') |
|
|
|
.attr('d', barOnMain(false)) |
|
|
|
.attr('d', drawBar(false)) |
|
|
|
.style("stroke", 'none') |
|
|
|
.style("stroke", 'none') |
|
|
|
.style("fill", function (d) { return color(d.id); }) |
|
|
|
.style("fill", function (d) { return color(d.id); }) |
|
|
|
.attr("class", classBar); |
|
|
|
.attr("class", classBar); |
|
|
|
|
|
|
|
|
|
|
|
mainBar |
|
|
|
mainBar |
|
|
|
.style("opacity", 0) |
|
|
|
|
|
|
|
.transition().duration(duration) |
|
|
|
.transition().duration(duration) |
|
|
|
.attr('d', barOnMain(false)) |
|
|
|
.attr('d', drawBar(false)); |
|
|
|
.style('opacity', 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mainBar.exit().transition().duration(duration) |
|
|
|
mainBar.exit().transition().duration(duration) |
|
|
|
.style('opacity', 0) |
|
|
|
.style('opacity', 0) |
|
|
@ -2058,21 +2054,19 @@ |
|
|
|
brush.extent(x.orgDomain()).update(); |
|
|
|
brush.extent(x.orgDomain()).update(); |
|
|
|
} |
|
|
|
} |
|
|
|
// bars
|
|
|
|
// bars
|
|
|
|
barW = getBarW(subXAxis, barTargetsNum, true); |
|
|
|
|
|
|
|
barH = getBarH(height2, true); |
|
|
|
|
|
|
|
barX = getBarX(barW, barTargetsNum, barIndices, true); |
|
|
|
|
|
|
|
barY = getBarY(barH, barIndices, false, true); |
|
|
|
|
|
|
|
contextBar = context.selectAll('.-bars').selectAll('.-bar') |
|
|
|
contextBar = context.selectAll('.-bars').selectAll('.-bar') |
|
|
|
.data(barData); |
|
|
|
.data(barData); |
|
|
|
contextBar.transition().duration(duration) |
|
|
|
contextBar.enter().append('path') |
|
|
|
.attr("x", barX).attr("y", barY).attr("width", barW).attr("height", barH); |
|
|
|
.attr('d', drawBar(true)) |
|
|
|
contextBar.enter().append('rect') |
|
|
|
.style("stroke", 'none') |
|
|
|
.attr("class", classBar) |
|
|
|
.style("fill", function (d) { return color(d.id); }) |
|
|
|
.attr("x", barX).attr("y", barY).attr("width", barW).attr("height", barH) |
|
|
|
.attr("class", classBar); |
|
|
|
|
|
|
|
contextBar |
|
|
|
.style("opacity", 0) |
|
|
|
.style("opacity", 0) |
|
|
|
.transition() |
|
|
|
.transition().duration(duration) |
|
|
|
|
|
|
|
.attr('d', drawBar(true)) |
|
|
|
.style('opacity', 1); |
|
|
|
.style('opacity', 1); |
|
|
|
contextBar.exit().transition() |
|
|
|
contextBar.exit().transition().duration(duration) |
|
|
|
.style('opacity', 0) |
|
|
|
.style('opacity', 0) |
|
|
|
.remove(); |
|
|
|
.remove(); |
|
|
|
// lines
|
|
|
|
// lines
|
|
|
|