Browse Source

Fix bar stack - #192

pull/200/merge
Masayuki Tanaka 11 years ago
parent
commit
fe21f1e7c4
  1. 14
      c3.js
  2. 4
      c3.min.js

14
c3.js

@ -193,7 +193,7 @@
__axis_y_label = getConfig(['axis', 'y', 'label'], {}),
__axis_y_inner = getConfig(['axis', 'y', 'inner'], false),
__axis_y_tick_format = getConfig(['axis', 'y', 'tick', 'format']),
__axis_y_padding = getConfig(['axis', 'y', 'padding'], {}),
__axis_y_padding = getConfig(['axis', 'y', 'padding']),
__axis_y_ticks = getConfig(['axis', 'y', 'ticks'], 10),
__axis_y2_show = getConfig(['axis', 'y2', 'show'], false),
__axis_y2_max = getConfig(['axis', 'y2', 'max']),
@ -202,7 +202,7 @@
__axis_y2_label = getConfig(['axis', 'y2', 'label'], {}),
__axis_y2_inner = getConfig(['axis', 'y2', 'inner'], false),
__axis_y2_tick_format = getConfig(['axis', 'y2', 'tick', 'format']),
__axis_y2_padding = getConfig(['axis', 'y2', 'padding'], {}),
__axis_y2_padding = getConfig(['axis', 'y2', 'padding']),
__axis_y2_ticks = getConfig(['axis', 'y2', 'ticks'], 10);
// grid
@ -1781,7 +1781,7 @@
}
function getDataLabelWidth(min, max) {
var widths = [], paddingCoef = 1.3;
d3.select('svg').selectAll('.dummy')
selectChart.select('svg').selectAll('.dummy')
.data([min, max])
.enter().append('text')
.text(function (d) { return d; })
@ -2408,17 +2408,17 @@
function generateGetBarPoints(barIndices, isSub) {
var barTargetsNum = barIndices.__max__ + 1,
barW = getBarW(xAxis, barTargetsNum),
x = getBarX(barW, barTargetsNum, barIndices, !!isSub),
y = getBarY(!!isSub),
barX = getBarX(barW, barTargetsNum, barIndices, !!isSub),
barY = getBarY(!!isSub),
barOffset = getBarOffset(barIndices, !!isSub),
yScale = isSub ? getSubYScale : getYScale;
return function (d, i) {
var y0 = yScale(d.id)(0),
offset = barOffset(d, i) || y0, // offset is for stacked bar chart
posX = x(d), posY = y(d);
posX = barX(d), posY = barY(d);
// fix posY not to overflow opposite quadrant
if (__axis_rotated) {
if ((d.value > 0 && posY < offset) || (d.value < 0 && posY > offset)) { posY = offset; }
if ((0 < d.value && posY < y0) || (d.value < 0 && y0 < posY)) { posY = y0; }
}
// 4 points that make a bar
return [

4
c3.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save