Skip to content

ChartBrush

chartBrush · Charts · interactive

Charts: a scale, its ticks, and a line or area drawn from data.

Import

cpp
#include "gbui/widgets/chart.hpp"

Example

Nothing is downloaded until you press it.

cpp
bool chartBrush(Ui& ui, const Interaction& input, std::string_view id, const std::vector<Series>& series, ChartView& view, const BrushOptions& options = {});

A strip of the whole series with the current view as a window over it. The part an ApexCharts-style brush actually earns its keep with is not the zooming — a drag inside the plot does that, and so does the wheel — but the context: once zoomed in, a reader has no way to tell where they are or how much they cannot see. The strip answers both without them having to zoom back out, which is also why it is optional. Returns true on any frame the view moved.

API

BrushOptions

OptionTypeDefaultWhat it does
heightfloat46.0f
axisWidthfloat0.0fRoom down the left, so the strip lines up with the chart above it.
handleWidthfloat8.0fHandle width, and the smallest grabbable window.
dragSelectsbooltrueDragging the strip's empty part draws a new window instead of moving the existing one — which is how a reader selects a range they can see but are not in.

Released under the LGPL-3.0-or-later licence.