X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-canvas.js;h=cba4f44939db504aac3903017f42807a54765ad3;hb=30a5cfc6c8dfe0ff412e63498eac09d31e9004a7;hp=ef6cf1f85afb0b5133425003426c82cfcb1be739;hpb=34655aba0589dc5f9bdc1f03319d4e7bd9dcfff6;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) {