API Reference
Namespaces
Classes
Events
Global
Externals

Class: BaseTwoPoint

CIQ.Drawing. BaseTwoPoint


new BaseTwoPoint()

Base class for drawings that require two mouse clicks. Override as required.

Methods


accidentalClick(tick, value)

Any two-point drawing that results in a drawing that is less than 10 pixels can safely be assumed to be an accidental click. Such drawings are so small that they are difficult to highlight and delete, so we won't allow them.

Note: it is very important to use CIQ.Drawing#pixelFromValue. This will ensure that saved drawings always render correctly when a chart is adjusted or transformed for display.

Parameters:
Name Type Description
tick number

Tick in the dataSet.

value number

Value at position.


adjust()

Default adjust function for BaseTwoPoint drawings


boxIntersection(tick, value, box)

Determine whether the tick/value lies within the theoretical box outlined by this drawing's two points.

Parameters:
Name Type Description
tick number

Tick in the dataSet.

value number

Value at position.

box object

x0, y0, x1, y1, r representing an area around the cursor, including the radius.

Returns:

True if box intersects the drawing.

Type
boolean

click(context, tick, value)

Value will be the actual underlying, unadjusted value for the drawing. Any adjustments or transformations are reversed out by the kernel. Internally, drawings should store their raw data (date and value) so that they can be rendered on charts with different layouts, axis, etc

Parameters:
Name Type Description
context CanvasRenderingContext2D

Canvas context on which to render.

tick number

Tick in the dataSet.

value number

Value at position.


lineIntersection(tick, value, box, type [, p0] [, p1] [, isPixels])

Intersection is based on a hypothetical box that follows a user's mouse or finger. An intersection occurs when the box crosses over the drawing. The type should be "segment", "ray" or "line" depending on whether the drawing extends infinitely in any or both directions. Radius determines the size of the box in pixels and is determined by the kernel depending on the user interface (mouse, touch, etc.).

Parameters:
Name Type Argument Description
tick number

Tick in the dataSet.

value number

Value at the cursor position.

box object

x0, y0, x1, y1, r representing an area around the cursor, including the radius.

type string

Determines how the line should be treated (as segment, ray, or line) when finding an intersection.

p0 Array.<number> <optional>

The x/y coordinates of the first endpoint of the line that is tested for intersection with box.

p1 Array.<number> <optional>

The x/y coordinates of the second endpoint of the line that is tested for intersection with box.

isPixels boolean <optional>

Indicates that box values are in pixel values.

Returns:

True if the line intersects the box; otherwise, false.

Type
boolean

measure()

Default measure function for BaseTwoPoint drawings


move(context, tick, value)

Default move function for BaseTwoPoint drawings

Parameters:
Name Type Description
context CanvasRenderingContext2D

Canvas context on which to render.

tick number

Tick in the dataSet.

value number

Value at position.