WebCola
Options
All
  • Public
  • Public/Protected
  • All
Menu

A D3 brush behavior

The generic refers to the type of the datum for the group element on which brush behavior is defined.

Type parameters

  • Datum

Hierarchy

  • BrushBehavior

Callable

  • __call(group: Selection<SVGGElement, Datum, any, any>, ...args: any[]): void
  • Applies the brush to the specified group, which must be a selection of SVG G elements. This function is typically not invoked directly, and is instead invoked via selection.call.

    For details see: https://github.com/d3/d3-brush#_brush

    Parameters

    • group: Selection<SVGGElement, Datum, any, any>

      A D3 selection of SVG G elements.

    • Rest ...args: any[]

      Optional arguments to be passed in.

    Returns void

Index

Methods

extent

  • extent(): ValueFn
  • extent(extent: [[number, number], [number, number]])
  • extent(extent: ValueFn)
  • Returns the current extent accessor.

    Returns ValueFn

  • Set the brushable extent to the specified array of points and returns this brush.

    The brush extent determines the size of the invisible overlay and also constrains the brush selection; the brush selection cannot go outside the brush extent.

    Parameters

    • extent: [[number, number], [number, number]]

      array of points [[x0, y0], [x1, y1]], where [x0, y0] is the top-left corner and [x1, y1] is the bottom-right corner.

  • Set the brushable extent to the specified array of points returned by the accessor function evaluated for each element in the selection/transition and returns this brush.

    The brush extent determines the size of the invisible overlay and also constrains the brush selection; the brush selection cannot go outside the brush extent.

    Parameters

    • extent: ValueFn

      An extent accessor function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element. The function returns an array of points [[x0, y0], [x1, y1]], where [x0, y0] is the top-left corner and [x1, y1] is the bottom-right corner.

filter

  • Returns the current filter function.

    Returns ValueFn

  • Sets the filter to the specified filter function and returns the brush.

    If the filter returns falsey, the initiating event is ignored and no brush gesture is started. Thus, the filter determines which input events are ignored. The default filter ignores mousedown events on secondary buttons, since those buttons are typically intended for other purposes, such as the context menu.

    Parameters

    • filterFn: ValueFn

      A filter function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element. The function returns a boolean value.

handleSize

  • handleSize(): number
  • handleSize(size: number)
  • Returns the current handle size, which defaults to six.

    Returns number

  • Sets the size of the brush handles to the specified number and returns the brush.

    This method must be called before applying the brush to a selection; changing the handle size does not affect brushes that were previously rendered. The default size is 6.

    Parameters

    • size: number

      Size of the handle.

move

  • move(group: Selection<SVGGElement, Datum, any, any>, selection: null): void
  • move(group: Selection<SVGGElement, Datum, any, any>, selection: BrushSelection): void
  • move(group: Selection<SVGGElement, Datum, any, any>, selection: ValueFn): void
  • move(group: Selection<SVGGElement, Datum, any, any>, selection: null): void
  • move(group: TransitionLike<SVGGElement, Datum>, selection: BrushSelection): void
  • move(group: TransitionLike<SVGGElement, Datum>, selection: ValueFn): void
  • Clear the active selection of the brush on the specified SVG G element(s) selection.

    Parameters

    • group: Selection<SVGGElement, Datum, any, any>

      A D3 selection of SVG G elements.

    • selection: null

      Use null to clear the active brush selection.

    Returns void

  • Sets the active selection of the brush on the specified SVG G element(s) selection to the provided array.

    Parameters

    • group: Selection<SVGGElement, Datum, any, any>

      A D3 selection of SVG G elements.

    • selection: BrushSelection

      An array specifying the new active brush selection. For a two-dimensional brush, it must be defined as [[x0, y0], [x1, y1]], where x0 is the minimum x-value, y0 is the minimum y-value, x1 is the maximum x-value, and y1 is the maximum y-value. For an x-brush, it must be defined as [x0, x1]; for a y-brush, it must be defined as [y0, y1].

    Returns void

  • Sets the active selection of the brush on the specified SVG G element(s) selection based on the array returned by a value function invoked for each selection element.

    Parameters

    • group: Selection<SVGGElement, Datum, any, any>

      A D3 selection of SVG G elements.

    • selection: ValueFn

      A selection value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element. The function returns an array specifying the new active brush selection. For a two-dimensional brush, it must be defined as [[x0, y0], [x1, y1]], where x0 is the minimum x-value, y0 is the minimum y-value, x1 is the maximum x-value, and y1 is the maximum y-value. For an x-brush, it must be defined as [x0, x1]; for a y-brush, it must be defined as [y0, y1].

    Returns void

  • Clear the active selection of the brush on the specified SVG G element(s) transition.

    Parameters

    • group: Selection<SVGGElement, Datum, any, any>

      A D3 transition on SVG G elements.

    • selection: null

      Use null to clear the active brush selection.

    Returns void

  • Sets the active selection of the brush on the specified SVG G element(s) transition to the provided array.

    Parameters

    • group: TransitionLike<SVGGElement, Datum>

      A D3 transition on SVG G elements.

    • selection: BrushSelection

      An array specifying the new active brush selection. For a two-dimensional brush, it must be defined as [[x0, y0], [x1, y1]], where x0 is the minimum x-value, y0 is the minimum y-value, x1 is the maximum x-value, and y1 is the maximum y-value. For an x-brush, it must be defined as [x0, x1]; for a y-brush, it must be defined as [y0, y1].

    Returns void

  • Sets the active selection of the brush on the specified SVG G element(s) transition based on the array returned by a value function invoked for each transitioning element.

    Parameters

    • group: TransitionLike<SVGGElement, Datum>

      A D3 transition on SVG G elements.

    • selection: ValueFn

      A selection value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element. The function returns an array specifying the new active brush selection. For a two-dimensional brush, it must be defined as [[x0, y0], [x1, y1]], where x0 is the minimum x-value, y0 is the minimum y-value, x1 is the maximum x-value, and y1 is the maximum y-value. For an x-brush, it must be defined as [x0, x1]; for a y-brush, it must be defined as [y0, y1].

    Returns void

on

  • on(typenames: string): ValueFn | undefined
  • on(typenames: string, listener: null)
  • on(typenames: string, listener: ValueFn)
  • Returns the first currently-assigned listener matching the specified typenames, if any.

    Parameters

    • typenames: string

      The typenames is a string containing one or more typename separated by whitespace. Each typename is a type, optionally followed by a period (.) and a name, such as "brush.foo"" and "brush.bar"; the name allows multiple listeners to be registered for the same type. The type must be one of the following: start (at the start of a brush gesture, such as on mousedown), brush (when the brush moves, such as on mousemove), or end (at the end of a brush gesture, such as on mouseup.)

    Returns ValueFn | undefined

  • Removes the current event listeners for the specified typenames, if any.

    Parameters

    • typenames: string

      The typenames is a string containing one or more typename separated by whitespace. Each typename is a type, optionally followed by a period (.) and a name, such as "brush.foo"" and "brush.bar"; the name allows multiple listeners to be registered for the same type. The type must be one of the following: start (at the start of a brush gesture, such as on mousedown), brush (when the brush moves, such as on mousemove), or end (at the end of a brush gesture, such as on mouseup.)

    • listener: null

      Use null to remove the listener.

  • Sets the event listener for the specified typenames and returns the brush. If an event listener was already registered for the same type and name, the existing listener is removed before the new listener is added. When a specified event is dispatched, each listener will be invoked with the same context and arguments as selection.on listeners.

    Parameters

    • typenames: string

      The typenames is a string containing one or more typename separated by whitespace. Each typename is a type, optionally followed by a period (.) and a name, such as "brush.foo"" and "brush.bar"; the name allows multiple listeners to be registered for the same type. The type must be one of the following: start (at the start of a brush gesture, such as on mousedown), brush (when the brush moves, such as on mousemove), or end (at the end of a brush gesture, such as on mouseup.)

    • listener: ValueFn

      An event listener function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc