Page MenuHomePhabricator

Roughly support stacked area charts

Authored by epriestley on May 3 2019, 10:44 PM.
Referenced Files
Unknown Object (File)
Thu, Nov 30, 2:18 AM
Unknown Object (File)
Sat, Nov 25, 9:52 PM
Unknown Object (File)
Wed, Nov 15, 11:39 PM
Unknown Object (File)
Nov 4 2023, 12:36 AM
Unknown Object (File)
Nov 4 2023, 12:18 AM
Unknown Object (File)
Oct 30 2023, 5:13 AM
Unknown Object (File)
Oct 30 2023, 4:22 AM
Unknown Object (File)
Oct 24 2023, 1:22 PM



Ref T13279. This adds support for:

  • Datasets can have types, like "stacked area".
  • Datasets can have multiple functions.
  • Charts can store dataset types and datasets with multiple functions.
  • Adds a "stacked area" dataset.
  • Makes D3 actually draw a stacked area chart.

Lots of rough edges here still, but the result looks slightly more like it's supposed to look.

D3 can do some of this logic itself, like adding up the area stacks on top of one another with d3.stack(). I'm doing it in PHP instead because I think it's a bit easier to debug, and it gives us more options for things like caching or "export to CSV" or "export to API" or rendering a data table under the chart or whatever.

Test Plan

Screen Shot 2019-05-03 at 3.37.36 PM.png (1×1 px, 283 KB)

Diff Detail

rP Phabricator
Lint Not Applicable
Tests Not Applicable

Event Timeline

amckinley added inline comments.

foreach ($missing as $x => $_)?


This looks like a typo for "before which 'x' is defined". Maybe:

Move the cursor forward to find the point immediately to the left of 'x'.


I feel like we're going to be tracking down edge cases in a lot of this code for a long time. Did you use the D3 implementation as a reference, or was this just on the fly? Nothing looks like it's obviously going to break, but I wonder if we're doing a lot of work upfront without knowing the limits of the way D3 does things.

(Clearly the right answer is to use PHP to invoke Node.js server-side to evaluate D3's implementation).


I would change this ordering to match the evaluation order below: "if to the left", "if between", "if to the right".


I'm just kinda assuming all these API changes are consistent with the New Hotness™.

This revision is now accepted and ready to land.May 15 2019, 2:03 PM