|
|
@ -47,9 +47,10 @@ c3_chart_internal_fn.updateLine = function (durationForExit) { |
|
|
|
var $$ = this; |
|
|
|
var $$ = this; |
|
|
|
$$.mainLine = $$.main.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line) |
|
|
|
$$.mainLine = $$.main.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line) |
|
|
|
.data($$.lineData.bind($$)); |
|
|
|
.data($$.lineData.bind($$)); |
|
|
|
$$.mainLine.enter().append('path') |
|
|
|
$$.mainLine = $$.mainLine.enter().append('path') |
|
|
|
.attr('class', $$.classLine.bind($$)) |
|
|
|
.attr('class', $$.classLine.bind($$)) |
|
|
|
.style("stroke", $$.color); |
|
|
|
.style("stroke", $$.color) |
|
|
|
|
|
|
|
.merge($$.mainLine); |
|
|
|
$$.mainLine |
|
|
|
$$.mainLine |
|
|
|
.style("opacity", $$.initialOpacity.bind($$)) |
|
|
|
.style("opacity", $$.initialOpacity.bind($$)) |
|
|
|
.style('shape-rendering', function (d) { return $$.isStepType(d) ? 'crispEdges' : ''; }) |
|
|
|
.style('shape-rendering', function (d) { return $$.isStepType(d) ? 'crispEdges' : ''; }) |
|
|
@ -68,7 +69,7 @@ c3_chart_internal_fn.redrawLine = function (drawLine, withTransition) { |
|
|
|
}; |
|
|
|
}; |
|
|
|
c3_chart_internal_fn.generateDrawLine = function (lineIndices, isSub) { |
|
|
|
c3_chart_internal_fn.generateDrawLine = function (lineIndices, isSub) { |
|
|
|
var $$ = this, config = $$.config, |
|
|
|
var $$ = this, config = $$.config, |
|
|
|
line = $$.d3.svg.line(), |
|
|
|
line = $$.d3.line(), |
|
|
|
getPoints = $$.generateGetLinePoints(lineIndices, isSub), |
|
|
|
getPoints = $$.generateGetLinePoints(lineIndices, isSub), |
|
|
|
yScaleGetter = isSub ? $$.getSubYScale : $$.getYScale, |
|
|
|
yScaleGetter = isSub ? $$.getSubYScale : $$.getYScale, |
|
|
|
xValue = function (d) { return (isSub ? $$.subxx : $$.xx).call($$, d); }, |
|
|
|
xValue = function (d) { return (isSub ? $$.subxx : $$.xx).call($$, d); }, |
|
|
@ -86,7 +87,7 @@ c3_chart_internal_fn.generateDrawLine = function (lineIndices, isSub) { |
|
|
|
path = $$.lineWithRegions(values, x, y, config.data_regions[d.id]); |
|
|
|
path = $$.lineWithRegions(values, x, y, config.data_regions[d.id]); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if ($$.isStepType(d)) { values = $$.convertValuesToStep(values); } |
|
|
|
if ($$.isStepType(d)) { values = $$.convertValuesToStep(values); } |
|
|
|
path = line.interpolate($$.getInterpolate(d))(values); |
|
|
|
path = line.curve($$.getInterpolate(d))(values); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (values[0]) { |
|
|
|
if (values[0]) { |
|
|
@ -224,10 +225,10 @@ c3_chart_internal_fn.updateArea = function (durationForExit) { |
|
|
|
var $$ = this, d3 = $$.d3; |
|
|
|
var $$ = this, d3 = $$.d3; |
|
|
|
$$.mainArea = $$.main.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area) |
|
|
|
$$.mainArea = $$.main.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area) |
|
|
|
.data($$.lineData.bind($$)); |
|
|
|
.data($$.lineData.bind($$)); |
|
|
|
$$.mainArea.enter().append('path') |
|
|
|
$$.mainArea = $$.mainArea.enter().append('path') |
|
|
|
.attr("class", $$.classArea.bind($$)) |
|
|
|
.attr("class", $$.classArea.bind($$)) |
|
|
|
.style("fill", $$.color) |
|
|
|
.style("fill", $$.color) |
|
|
|
.style("opacity", function () { $$.orgAreaOpacity = +d3.select(this).style('opacity'); return 0; }); |
|
|
|
.style("opacity", function () { $$.orgAreaOpacity = +d3.select(this).style('opacity'); return 0; }).merge($$.mainArea); |
|
|
|
$$.mainArea |
|
|
|
$$.mainArea |
|
|
|
.style("opacity", $$.orgAreaOpacity); |
|
|
|
.style("opacity", $$.orgAreaOpacity); |
|
|
|
$$.mainArea.exit().transition().duration(durationForExit) |
|
|
|
$$.mainArea.exit().transition().duration(durationForExit) |
|
|
@ -243,7 +244,7 @@ c3_chart_internal_fn.redrawArea = function (drawArea, withTransition) { |
|
|
|
]; |
|
|
|
]; |
|
|
|
}; |
|
|
|
}; |
|
|
|
c3_chart_internal_fn.generateDrawArea = function (areaIndices, isSub) { |
|
|
|
c3_chart_internal_fn.generateDrawArea = function (areaIndices, isSub) { |
|
|
|
var $$ = this, config = $$.config, area = $$.d3.svg.area(), |
|
|
|
var $$ = this, config = $$.config, area = $$.d3.area(), |
|
|
|
getPoints = $$.generateGetAreaPoints(areaIndices, isSub), |
|
|
|
getPoints = $$.generateGetAreaPoints(areaIndices, isSub), |
|
|
|
yScaleGetter = isSub ? $$.getSubYScale : $$.getYScale, |
|
|
|
yScaleGetter = isSub ? $$.getSubYScale : $$.getYScale, |
|
|
|
xValue = function (d) { return (isSub ? $$.subxx : $$.xx).call($$, d); }, |
|
|
|
xValue = function (d) { return (isSub ? $$.subxx : $$.xx).call($$, d); }, |
|
|
@ -264,7 +265,7 @@ c3_chart_internal_fn.generateDrawArea = function (areaIndices, isSub) { |
|
|
|
x0 = 0, y0 = 0, path; |
|
|
|
x0 = 0, y0 = 0, path; |
|
|
|
if ($$.isAreaType(d)) { |
|
|
|
if ($$.isAreaType(d)) { |
|
|
|
if ($$.isStepType(d)) { values = $$.convertValuesToStep(values); } |
|
|
|
if ($$.isStepType(d)) { values = $$.convertValuesToStep(values); } |
|
|
|
path = area.interpolate($$.getInterpolate(d))(values); |
|
|
|
path = area.curve($$.getInterpolate(d))(values); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (values[0]) { |
|
|
|
if (values[0]) { |
|
|
|
x0 = $$.x(values[0].x); |
|
|
|
x0 = $$.x(values[0].x); |
|
|
@ -308,10 +309,10 @@ c3_chart_internal_fn.updateCircle = function () { |
|
|
|
var $$ = this; |
|
|
|
var $$ = this; |
|
|
|
$$.mainCircle = $$.main.selectAll('.' + CLASS.circles).selectAll('.' + CLASS.circle) |
|
|
|
$$.mainCircle = $$.main.selectAll('.' + CLASS.circles).selectAll('.' + CLASS.circle) |
|
|
|
.data($$.lineOrScatterData.bind($$)); |
|
|
|
.data($$.lineOrScatterData.bind($$)); |
|
|
|
$$.mainCircle.enter().append("circle") |
|
|
|
$$.mainCircle = $$.mainCircle.enter().append("circle") |
|
|
|
.attr("class", $$.classCircle.bind($$)) |
|
|
|
.attr("class", $$.classCircle.bind($$)) |
|
|
|
.attr("r", $$.pointR.bind($$)) |
|
|
|
.attr("r", $$.pointR.bind($$)) |
|
|
|
.style("fill", $$.color); |
|
|
|
.style("fill", $$.color).merge($$.mainCircle); |
|
|
|
$$.mainCircle |
|
|
|
$$.mainCircle |
|
|
|
.style("opacity", $$.initialOpacityForCircle.bind($$)); |
|
|
|
.style("opacity", $$.initialOpacityForCircle.bind($$)); |
|
|
|
$$.mainCircle.exit().remove(); |
|
|
|
$$.mainCircle.exit().remove(); |
|
|
|