Skip to content

Commit

Permalink
Merge branch 'consistent-fill' into recent-mrs
Browse files Browse the repository at this point in the history
  • Loading branch information
WofWca committed Oct 17, 2021
2 parents ccc831d + fd47202 commit 1e4a9bd
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions smoothie.js
Expand Up @@ -100,6 +100,7 @@
* Fix: make all lines sharp, by @WofWca (#134)
* Improve performance, by @WofWca (#135)
* Fix `this.delay` not being respected with `nonRealtimeData: true`, by @WofWca (#137)
* Fix series fill & stroke being inconsistent for last data time < render time, by @WofWca (#138)
*/

;(function(exports) {
Expand Down Expand Up @@ -1009,26 +1010,20 @@
lastX = x; lastY = y;
}

if (seriesOptions.fillStyle) {
// Close up the fill region.
if (chartOptions.scrollBackwards) {
context.lineTo(lastX, dimensions.height + lineWidthMaybeZero);
context.lineTo(firstX, dimensions.height + lineWidthMaybeZero);
context.lineTo(firstX, firstY);
} else {
context.lineTo(dimensions.width + lineWidthMaybeZero + 1, lastY);
context.lineTo(dimensions.width + lineWidthMaybeZero + 1, dimensions.height + lineWidthMaybeZero + 1);
context.lineTo(firstX, dimensions.height + lineWidthMaybeZero);
}
context.fillStyle = seriesOptions.fillStyle;
context.fill();
}

if (drawStroke) {
context.lineWidth = seriesOptions.lineWidth;
context.strokeStyle = seriesOptions.strokeStyle;
context.stroke();
}

if (seriesOptions.fillStyle) {
// Close up the fill region.
context.lineTo(lastX, dimensions.height + lineWidthMaybeZero + 1);
context.lineTo(firstX, dimensions.height + lineWidthMaybeZero + 1);

context.fillStyle = seriesOptions.fillStyle;
context.fill();
}
}

if (chartOptions.tooltip && this.mouseX >= 0) {
Expand Down

0 comments on commit 1e4a9bd

Please sign in to comment.