X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-canvas.js;h=cba4f44939db504aac3903017f42807a54765ad3;hb=32c4d92b20add8400502e8d7b1337f2170fc987c;hp=ef6cf1f85afb0b5133425003426c82cfcb1be739;hpb=3fb516b5e8b861f15754428c6071688ab121bb6c;p=dygraphs.git diff --git a/dygraph-canvas.js b/dygraph-canvas.js index ef6cf1f..cba4f44 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -702,7 +702,14 @@ DygraphCanvasRenderer._fillPlotter = function(e) { var stackedGraph = g.getOption("stackedGraph"); var colors = g.getColors(); - var baseline = {}; // for stacked graphs: baseline for filling + // For stacked graphs, track the baseline for filling. + // + // The filled areas below graph lines are trapezoids with two + // vertical edges. The top edge is the line segment being drawn, and + // the baseline is the bottom edge. Each baseline corresponds to the + // top line segment from the previous stacked line. In the case of + // step plots, the trapezoids are rectangles. + var baseline = {}; var currBaseline; var prevStepPlot; // for different line drawing modes (line/step) per series @@ -739,6 +746,9 @@ DygraphCanvasRenderer._fillPlotter = function(e) { var point = iter.next(); if (!Dygraph.isOK(point.y)) { prevX = NaN; + if (point.y_stacked !== null && !isNaN(point.y_stacked)) { + baseline[point.canvasx] = area.h * point.y_stacked + area.y; + } continue; } if (stackedGraph) {