Brush:update
methodBrush:update(options: chart.BrushOptions)Reconfigure the brush in place; passing on_brush replaces the callback. Changing axis clears any committed selection (without firing on_brush). Raises after remove.
-- A new axis clears the selection; on_brush replaces the callback.
brush:update({
axis = "both",
color = color("#dbbc7f"),
on_brush = function(selection)
print(brush.selection == nil, selection == nil)
end,
})options chart.BrushOptions options 4 keys Omitted keys keep their current value.
| Key | Type | Description |
|---|---|---|
| axis | "x" | "y" | "both" | Which axes the brush selects on. Single-axis brushes span the full plot on the other axis. |
| button | "left" | "right" | "middle" | "back" | "forward" | Mouse button that drags the brush. |
| color | Color | Selection region fill. |
| on_brush | fun(selection: chart.BrushSelection?) | Fires when a selection commits (bounds table) or a click clears it (nil). |