Skip to content

ChartRangeBrush

Stable

A strip under a long chart with two handles. The part between them is what the chart above shows.

Also known as range selector, brush, zoom range

Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.

Wired to a LineChart

Date range31 July to 29 August, 30 days

The parent keeps the range and slices the series for the chart above. Drag the window or a handle and the chart shows only that stretch.

When to use it

Lets someone zoom into part of a long series, such as the week a model changed, without leaving the chart.

Made of: Label · Range text · Reset button · Overview line · Dimmed area outside the window · Window · Start handle · End handle

Use it for

  • Cost, usage or latency charts that cover 30 to 365 days.
  • Any long line chart where people need to look closely at a short stretch.
  • Picking a stretch of a series to compare or export.

Not for

  • Picking one value on a scale: use Slider.
  • Picking calendar dates when there is no chart: use DatePicker.
  • A short series that already fits on screen: use LineChart.

Do and avoid

Date rangeDay 31 to Day 45, 15 points

Do. Zooms into two weeks of a long series, with the range in words.

Date rangeDay 3 to Day 6, 4 points

Avoid. Eight points already fit on screen, so zooming only adds work.

Do

  • Put it straight under the chart it controls, the same width.
  • Pass the full series as values, and only the sliced part to the chart.
  • Start on a useful window, such as the last 30 days.
  • Say the unit in formatCount, such as days or hours.

Avoid

  • Don't use it for a series of a dozen points. Show the whole chart.
  • Don't animate the chart above when the range changes. It should follow the hand at once.
  • Don't hide the range text. It is the only exact reading of the window.

On a phone

  • The strip fills the width, and the label and Reset button wrap above it.
  • Each handle's hit area is 44px wide on touch screens and the strip is 48px tall, even though the handles look thin.
  • A touch that starts on the strip does not scroll or zoom the page, so dragging a handle stays put. Touches anywhere else scroll as usual.
  • The Reset button grows to 44px tall on touch screens.

Build your next AI screen with Tattva.

Free and open, with the code. Start in one line.

Get started