Datafable/epu-index

Add brushing to sub line chart

Closed this issue · 4 comments

The user should be able to select a specific range on the sub line chart to be displayed on the main chart.

  • Date range: fixed at one year (so the width of the window is fixed)
  • Brushing steps: one month
  • Brushing triggers an update in the main chart:
    • Update happens immediately (drawing data left and right) OR
    • Update happens on click release (drawing can happen in place)
  • Selection is indicated on the sub line chart

Finished in 8f490b1. Please review

Remarks

  1. The detailed chart loads all x-axis ticks beforehand. Some of the labels might appear cut off on the left. Not much I can do if we want those labels ("YYYY-MM" on the first of the month, evenly spaced).

    screen shot 2015-07-09 at 01 39 18

  2. The selected year is indicated with two lines, not a region (as region API is buggy):

    screen shot 2015-07-09 at 01 42 42

  3. On page load, the last year is shown in the detailed chart, but this range is not indicated in the overview chart. Should it (bit tricky with async)?

  4. The detailed chart will always show one year + 1 one day, e.g. from 2001-01-01 to 2002-01-01. OK?

I tested it, and I think it looks and works great!

I don't see labels of the x axis cut off. I do get cut off labels on the y axis when the labels contain decimal values:

screen shot 2015-07-10 at 09 21 51

This can be easily fixed by setting a slightly larger margin.

I do would try to show the vertical bars for the region displayed on page load. The range (one year + 1 day) is fine. I wondered why you added 1 day, but it's not confusing in the chart so that's fine.

Margin issue fixed in 1360ea5

One day is added to the year by the moment.js library. I do: take a date (e.g. 2013-03-21) and it subtracts and adds 6 months: 2012-09-21 to 2013-09-21.

I'll document the on page load bars in another issue.