From 69b0855e471e92ede45c4557fd6b4c409b546c8f Mon Sep 17 00:00:00 2001 From: Chris Babiak Date: Wed, 2 May 2018 11:42:17 -0700 Subject: [PATCH] add fillInvert style option for SparklinesLine fill --- src/SparklinesLine.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/SparklinesLine.js b/src/SparklinesLine.js index 42f6d7a..4c8566d 100644 --- a/src/SparklinesLine.js +++ b/src/SparklinesLine.js @@ -15,13 +15,15 @@ export default class SparklinesLine extends React.Component { render() { const { data, points, width, height, margin, color, style, onMouseMove } = this.props; + const fillInvert = style.fillInvert ? style.fillInvert : false + const linePoints = points.map(p => [p.x, p.y]).reduce((a, b) => a.concat(b)); const closePolyPoints = [ points[points.length - 1].x, - height - margin, + fillInvert ? margin : height - margin, margin, - height - margin, + fillInvert ? margin : height - margin, margin, points[0].y, ];