ChartHandle

ChartHandle

new ChartHandle(optionsopt)

Source:
Properties:
Name Type Attributes Default Description
options.label String

The name of the handle.

options.range_x function | Object

Callback returning a Range for the x-axis or an object with options for a Range. This is usually the x_range of the parent chart.

options.range_y function | Object

Callback returning a Range for the y-axis or an object with options for a Range. This is usually the y_range of the parent chart.

options.range_z function | Object

Callback returning a Range for the z-axis or an object with options for a Range.

options.mode String <optional>
"circular"

Type of the handle. Can be one of circular, line-vertical, line-horizontal, block-left, block-right, block-top or block-bottom.

options.x Number <optional>

Value of the x-coordinate.

options.y Number <optional>

Value of the y-coordinate.

options.z Number <optional>

Value of the z-coordinate.

options.min_size Number <optional>
24

Minimum size of the handle in px.

options.max_size Number <optional>
100

Maximum size of the handle in px.

options.format_label function | Boolean

Label formatting function. Arguments are label, x, y, z. If set to false, no label is displayed.

options.preferences Array.<String> <optional>
["left", "top", "right", "bottom"]

Possible label positions by order of preference. Depending on the selected mode this can be a subset of top, top-right, right, bottom-right, bottom, bottom-left, left, top-left and center.

options.margin Number <optional>
3

Margin in px between the handle and the label.

options.z_handle Boolean | String <optional>
false

If not false, a small handle is drawn at the given position (top, top-left, top-right, left, center, right, bottom-left, bottom, bottom-right), which can be dragged to change the value of the z-coordinate.

options.z_handle_size Number <optional>
6

Size in px of the z-handle.

options.z_handle_centered Number <optional>
0.1

Size of the z-handle in center positions. If this options is between 0 and 1, it is interpreted as a ratio, otherwise as a px size.

options.z_handle_below Number <optional>
false

Render the z-handle below the normal handle in the DOM. SVG doesn't know CSS attribute z-index, so this workaround is needed from time to time.

options.x_min Number <optional>

Minimum value of the x-coordinate.

options.x_max Number <optional>

Maximum value of the x-coordinate.

options.y_min Number <optional>

Minimum value of the y-coordinate.

options.y_max Number <optional>

Maximum value of the y-coordinate.

options.z_min Number <optional>

Minimum value of the z-coordinate.

options.z_max Number <optional>

Maximum value of the z-coordinate.

options.show_axis Boolean <optional>
false

If set to true, additional lines are drawn at the coordinate values.

ChartHandle is a draggable SVG element, which can be used to represent and change a value inside a FrequencyResponse and is drawn inside of a Chart.

Parameters:
Name Type Attributes Default Description
options Object <optional>
{ }

An object containing initial options.

Extends

Members

_handle :SVGCircular

Source:

The main handle. Has class .aux-handle.

Type:
  • SVGCircular

_label :SVGText

Source:

The label. Has class .aux-label.

Type:
  • SVGText

_line1 :SVGPath

Source:

The first line. Has class .aux-line .aux-line1.

Type:
  • SVGPath

_line2 :SVGPath

Source:

The second line. Has class .aux-line .aux-line2.

Type:
  • SVGPath

_zhandle :SVGCircular

Source:

The handle for manipulating z axis. Has class .aux-zhandle.

Type:
  • SVGCircular

element :SVGGroup

Source:

The main SVG group containing all handle elements. Has class .aux-charthandle.

Type:
  • SVGGroup

range_x :Range

Source:

The Range for the x axis.

Type:

range_y :Range

Source:

The Range for the y axis.

Type:

range_z :Range

Source:

The Range for the z axis.

Type:

Methods

addChild(child)

Source:
Inherited From:
See:

Registers a widget as a child widget. This method is used to build up the widget tree. It does not modify the DOM tree.

Parameters:
Name Type Description
child Widget

The child to add.

Fires:
  • Widget#event:child_added

addChildren(a)

Source:
Inherited From:

Registers an array of widgets as children.

Parameters:
Name Type Description
a Array.<Widget>

An array of Widgets.

allChildren()

Source:
Inherited From:

Returns an array of all children.

appendChild(child)

Source:
Inherited From:

Appends child.element to the widget element and registers child as a child widget.

Parameters:
Name Type Description
child Widget

The child widget to append.

appendChildren(children)

Source:
Inherited From:

Calls Widget#appendChild for an array of widgets.

Parameters:
Name Type Description
children Array.<Widget>

The child widgets to append.

disableTansitions()

Source:
Inherited From:

Disable CSS transitions.

enableDraw()

Source:
Overrides:

Schedules this widget for drawing.

Fires:

enableDrawChildren()

Source:
Inherited From:

Enables rendering for all children of this widget.

enableTransitions()

Source:
Inherited From:

Enable CSS transitions.

forceHide()

Source:
Inherited From:

Hide the widget immediately by applying the class aux-hide. Does not call disableDraw().

forceShow()

Source:
Inherited From:

Show the widget immediately by applying the class aux-show. Does not call enableDraw().

getStyle()

Source:
Inherited From:

Returns the computed style of this widget's DOM element.

hidden()

Source:
Inherited From:

Returns the current hidden status.

hide()

Source:
Inherited From:

Hide the widget. This will result in the class aux-hide being applied to this widget in the next rendering step.

invalidate(key)

Source:
Inherited From:

Invalidates an option and triggers a redraw() call.

Parameters:
Name Type Description
key string

observeResize(cb)

Source:
Inherited From:

Calls a callback whenever the widget resizes. This method will trigger one resize.

Parameters:
Name Type Description
cb function

removeChild(child)

Source:
Inherited From:

Removes a child widget. Note that this method only modifies the widget tree and does not change the DOM.

Parameters:
Name Type Description
child Widget

The child to remove.

Fires:
  • Widget#event:child_removed

removeChildren(a)

Source:
Inherited From:

Removes an array of children.

Parameters:
Name Type Description
a Array.<Widget>

An array of Widgets.

set(key, value)

Source:
Overrides:

Sets an option.

Parameters:
Name Type Description
key string

The option name.

value

The option value.

setStyle()

Source:
Inherited From:

Sets a CSS style property in this widget's DOM element.

show()

Source:
Inherited From:

Make the widget visible. This will apply the class aux-show during the next rendering step.

toFront()

Source:

Moves the handle to the front, i.e. add as last element to the containing SVG group element.

toFront()

Source:

Moves the handle to the back, i.e. add as first element to the containing SVG group element.

toggleHidden()

Source:
Inherited From:

Toggle the hidden status. This is equivalent to calling hide() or show(), depending on the current hidden status of this widget.

transitionsDisabled()

Source:
Inherited From:

Returns true if transitions are currently disabled on this widget.

visibleChildren()

Source:
Inherited From:

Returns an array of all visible children.

Events

destroy

Source:
Inherited From:

Is fired when a widget is destroyed.

doubleclick

Source:
Inherited From:

Is fired after a double click appeared. Set dblclick to 0 to disable click event handling.

Parameters:
Name Type Description
event string

The browsers MouseEvent.

GenericDOMEvents

Source:
Inherited From:

Generic DOM events. Please refer to W3Schools for further details.

handlegrabbed

Source:

Is fired when the main handle is grabbed by the user. The argument is an object with the following members:

  • x: the actual value on the x axis
  • y: the actual value on the y axis
  • pos_x: the position in pixels on the x axis
  • pos_y: the position in pixels on the y axis
Parameters:
Name Type Description
positions Object

An object containing all relevant positions of the pointer.

handlereleased

Source:

Is fired when the user releases the main handle. The argument is an object with the following members:

  • x: the actual value on the x axis
  • y: the actual value on the y axis
  • pos_x: the position in pixels on the x axis
  • pos_y: the position in pixels on the y axis
Parameters:
Name Type Description
positions Object

An object containing all relevant positions of the pointer.

hide

Source:
Inherited From:

The hide event is emitted when a widget is hidden and is not rendered anymore. This happens both with browser visibility changes and also internally when using layout widgets such as Pager.

initialized

Source:
Inherited From:

Is fired when a widget is initialized.

redraw

Source:
Inherited From:

The redraw event is emitted when a widget is redrawn. This can be used to do additional DOM modifications to a Widget.

resize

Source:
Inherited From:

The resize event is emitted whenever a widget is being resized. This event can be used to e.g. measure its new size. Note that some widgets do internal adjustments after the resize event. If that is relevant, the Widget#resized event can be used instead.

resized

Source:
Inherited From:

The resized event is emitted after each rendering frame, which was triggered by a resize event.

set

Source:
Inherited From:

The set event is emitted when an option was set using the Widget#set method. The arguments are the option name and its new value.

Note that this happens both for user interaction and programmatical option changes.

show

Source:
Inherited From:

The show event is emitted when a widget is shown and is being rendered. This is the counterpart to Widget#hide.

useraction

Source:

The useraction event is emitted when a widget gets modified by user interaction. The event is emitted for the options x, y and z.

Parameters:
Name Type Description
name string

The name of the option which was changed due to the users action.

value mixed

The new value of the option.

visibility

Source:
Inherited From:

Is fired when the visibility state changes. The first argument is the visibility state, which is either true or false.

zchangeended

Source:

Is fired when the user releases the z-handle. The argument is the actual z value.

Parameters:
Name Type Description
z number

The z value.

zchangestarted

Source:

Is fired when the user grabs the z-handle. The argument is the actual z value.

Parameters:
Name Type Description
z number

The z value.