From a45fcb1970c5a4bc1119d2b6c0a97e0046312bd6 Mon Sep 17 00:00:00 2001 From: Michiel Date: Tue, 23 Feb 2016 13:47:22 +0200 Subject: [PATCH] gh-1595 Adds config option in area hash to draw the area fill above the line instead of below --- src/config.js | 1 + src/shape.line.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/config.js b/src/config.js index 240e394..6d54b23 100644 --- a/src/config.js +++ b/src/config.js @@ -168,6 +168,7 @@ c3_chart_internal_fn.getDefaultConfig = function () { bar_zerobased: true, // area area_zerobased: true, + area_above: false, // pie pie_label_show: true, pie_label_format: undefined, diff --git a/src/shape.line.js b/src/shape.line.js index fb68cf7..e9dcb8c 100644 --- a/src/shape.line.js +++ b/src/shape.line.js @@ -250,7 +250,7 @@ c3_chart_internal_fn.generateDrawArea = function (areaIndices, isSub) { return config.data_groups.length > 0 ? getPoints(d, i)[1][1] : yScaleGetter.call($$, d.id)(d.value); }; - area = config.axis_rotated ? area.x0(value0).x1(value1).y(xValue) : area.x(xValue).y0(value0).y1(value1); + area = config.axis_rotated ? area.x0(value0).x1(value1).y(xValue) : area.x(xValue).y0(config.area_above ? 0 : value0).y1(value1); if (!config.line_connectNull) { area = area.defined(function (d) { return d.value !== null; }); }