Browse Source

Fix line with region

pull/246/head
Masayuki Tanaka 11 years ago
parent
commit
b36f38f8bb
  1. 12
      c3.js
  2. 6
      c3.min.js

12
c3.js

@ -2236,8 +2236,8 @@
getBars(i).classed(CLASS.EXPANDED, false); getBars(i).classed(CLASS.EXPANDED, false);
} }
var lineOnMain = generateDrawLine(x, xx, getYScale), var lineOnMain = generateDrawLine(false),
lineOnSub = generateDrawLine(subX, subxx, getSubYScale); lineOnSub = generateDrawLine(true);
var areaOnMain = (function () { var areaOnMain = (function () {
var area; var area;
@ -2268,15 +2268,17 @@
}; };
})(); })();
function generateDrawLine(x, xValue, yScaleGetter) { function generateDrawLine(isSub) {
var yValue = function (d) { return yScaleGetter(d.id)(d.value); }, var yScaleGetter = isSub ? getSubYScale : getYScale,
xValue = isSub ? xx : subxx,
yValue = function (d) { return yScaleGetter(d.id)(d.value); },
line = d3.svg.line() line = d3.svg.line()
.x(__axis_rotated ? yValue : xValue) .x(__axis_rotated ? yValue : xValue)
.y(__axis_rotated ? xValue : yValue); .y(__axis_rotated ? xValue : yValue);
if (!__line_connect_null) { line = line.defined(function (d) { return d.value != null; }); } if (!__line_connect_null) { line = line.defined(function (d) { return d.value != null; }); }
return function (d) { return function (d) {
var data = __line_connect_null ? filterRemoveNull(d.values) : d.values, var data = __line_connect_null ? filterRemoveNull(d.values) : d.values,
y = yScaleGetter(d.id), x0 = 0, y0 = 0; x = isSub ? x : subX, y = yScaleGetter(d.id), x0 = 0, y0 = 0;
if (isLineType(d)) { if (isLineType(d)) {
if (__data_regions[d.id]) { if (__data_regions[d.id]) {
return lineWithRegions(data, x, y, __data_regions[d.id]); return lineWithRegions(data, x, y, __data_regions[d.id]);

6
c3.min.js vendored

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