GreenInfo-Network / nyc-crash-mapper-chart-view

Chart view for NYC Crash Mapper that allows for viewing Trends, Comparing, and Ranking of various NYC geographies
http://vis.crashmapper.org
MIT License
2 stars 1 forks source link

Trend: change X axis resolution #101

Closed gregallensworth closed 6 years ago

gregallensworth commented 6 years ago

In trend window, change the X axis to not necessarily aggregate by every month. Provide a UI for switching between “bucketing resolutions” of 12, 6, 3, and 1 months.

Both Trend charts should use the same X axis resolution.

This would literally start counting back from whatever month user has selected as the end date; not a fixed Jan-Mar quartering sort of deal.

gregallensworth commented 6 years ago

See the new gda-issue101-trendx branch, which may do just what they need.

image

image

image

image

There are some potential usability items, that we won't be able to work around.

image

Next steps:

gregallensworth commented 6 years ago

Tooltip X position fix:

image

danrademacher commented 6 years ago

I see based on chunks starting at the beginning of time going forward vs starting present and going back is why most current 2 months are always separate from the larger agg summarization: image

If we have to start at the beginning, I wonder if we hard-code in a Jan 2012 start date, so at least fixed periods align with familiar calendar years, semiannual, quaters.

gregallensworth commented 6 years ago

I don't see any way around that fact, that if you want data divided into buckets of X then the number of data points should be divisible by X. When the number of months (currently 85) is not divisible by X, then at either the beginning or end there will be a "undersized remainder" block.

But if it is preferable that this remainder be back in 2011 on grounds that it is "probably relevant less often", then it should be a small change to reverse the list and chunk it, then reverse it again. That should give us X-month blocks starting present and leaving the "undersized remainder" back in 2011.

The good news though, is that the blocks are labeled so it's clear when your block is not the right size: the most recent block is Aug-Sep 2018 which is clearly not 3 months. I could even add to the a tooltip a "X months" notation, so it's doubly clear for those blocks that they aren't full blocks.

gregallensworth commented 6 years ago

Tooltip behavior: If block size is < X then the tooltip explicitly states the length.

image

gregallensworth commented 6 years ago

Chunking behavior: Starts at the present, works backward.

image

Commit dc57ab7 brings the first round of chunking behavior. But commit e77b006 changes the plotting position of a block on the chart/timeline, as being the block's ending date This gives the more pleasant visual effect, that the Jul/Aug/Sep block now extends past July but not quite to Oct -- just what one would expect visually.

At the beginning of time, it looks like the screenshot below. The visibly drawn line starts at September, as that it the plotting point of the three-month aggregate.

image

gregallensworth commented 6 years ago

One last UI item:

image

When the text of the tooltip is not sufficiently lengthy (e.g. with no comparison areas selected), and also one adds to the months readout "X months" wording, then the tooltip may not be wide enough to contain the text and it overflows.

gregallensworth commented 6 years ago

As of commit 3083c34 the tooltip width & height are calculated to look good, regardless of how many lines of text are displaying (minimum 2, maximum 4). Prior version was optimized for having both primary + secondary case.