Class: BaseTwoPoint

STX.Drawing. BaseTwoPoint


new BaseTwoPoint()

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

Methods


<static> STX.Drawing#highlight(highlighted)

Returns the highlighted state. Set this.highlighted to the highlight state. For simple drawings the highlighted state is just true or false. For complex drawings with pivot points for instance, the highlighted state may have more than two states. Whenever the highlighted state changes a draw() event will be triggered.

Parameters:
Name Type Description
highlighted Boolean

True to highlight the drawing, false to unhighlight


<static> STX.Drawing#setPoint(point, x, y [, chart])

Sets the internal properties of the drawing points where x is a tick or a date and y is a value.

Parameters:
Name Type Argument Description
point number

index to point to be converted (0,1)

x number | string

index of bar in dataSet (tick) or date of tick (string form)

y number

price

chart STX.Chart <optional>

Optional chart object

Since:
  • 04-2015

accidentalClick()

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 pixelFromValueAdjusted() rather than pixelFromPrice(). This will ensure that saved drawings always render correctly when a chart is adjusted or transformed for display


adjust()

Default adjust function for BaseTwoPoint drawings


boxIntersection()

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


click()

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


copyConfig()

Override this function to copy all of the config necessary to render your drawing


lineIntersection()

Intersection is based on a hypothetical box that follows a user's mouse or finger around An intersection occurs when either 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)


measure()

Default measure function for BaseTwoPoint drawings


move()

Default move function for BaseTwoPoint drawings