Page MenuHomePhabricator

Roughly support stacked area charts
ClosedPublic

Authored by epriestley on May 3 2019, 10:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 14, 2:07 PM
Unknown Object (File)
Tue, Mar 5, 8:04 AM
Unknown Object (File)
Feb 22 2024, 12:21 PM
Unknown Object (File)
Feb 20 2024, 10:40 PM
Unknown Object (File)
Feb 13 2024, 5:33 PM
Unknown Object (File)
Feb 12 2024, 11:24 PM
Unknown Object (File)
Feb 3 2024, 10:25 PM
Unknown Object (File)
Dec 22 2023, 2:14 AM
Subscribers

Details

Summary

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

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

amckinley added inline comments.
src/applications/fact/chart/PhabricatorChartStackedAreaDataset.php
57

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

58–59

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'.

58–62

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).

64–68

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

webroot/rsrc/js/application/fact/Chart.js
55–63

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