Page MenuHomePhabricator

Automatically select the range for charts in a general way
ClosedPublic

Authored by epriestley on May 8 2019, 3:55 PM.
Tags
None
Referenced Files
F14049326: D20503.diff
Thu, Nov 14, 12:37 PM
F14035371: D20503.diff
Sun, Nov 10, 5:39 AM
F14018823: D20503.diff
Tue, Nov 5, 7:56 PM
F14002754: D20503.id48896.diff
Fri, Oct 25, 10:01 PM
F14000853: D20503.id.diff
Fri, Oct 25, 1:48 AM
F13987657: D20503.diff
Mon, Oct 21, 10:35 AM
F13981434: D20503.diff
Sat, Oct 19, 4:31 PM
F13963482: D20503.diff
Tue, Oct 15, 4:10 PM
Subscribers

Details

Summary

Ref T13279. Replace the hard-coded default range with a range computed by examining the chart data.

Instead of having a "Dataset" return a blob of wire data, "Dataset" now returns a structure with raw wire data plus a range. I expect to add more structured data here in future changes (tooltip/hover event data, maybe function labels).

Test Plan

Screen Shot 2019-05-08 at 8.53.20 AM.png (949×1 px, 194 KB)

Diff Detail

Repository
rP Phabricator
Branch
chart26
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 22769
Build 31225: Run Core Tests
Build 31224: arc lint + arc unit

Event Timeline

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

Not sure where in the stack this should live, but we should probably scale y-max by 110% or something so we don't give the appearance of truncating the data (and the y-min by -110% if any data points go below 0).

This revision is now accepted and ready to land.May 21 2019, 10:30 PM

Yeah, I ideally want to try to round up, up to X%, to the nearest "nice" number, like if the range is 0-93 we show 0-100, since "100" is the nearest "nice round number" above 93. There was some simple code for this before (visual-max = actual-max * 1.2 or something) which makes the shape of the graph look good but doesn't produce the most satisfying ticks on the Y-axis or the ideally satisfying Y-max.

The algorithm for producing a "nice round number larger than X" isn't immediately intuitively obvious to me, though. And if the range is 0-100 inclusive, is it better to draw a chart with a satisfyingly round y-max, or to intentionally waste space at the top and select a dissatisfying visual y-max?

(We also don't need to tick the y-max -- we could tick at 100 and draw to 110.)