Class: ChartPoint

StockChartX. ChartPoint


new ChartPoint(config)

Represents chart point.
Parameters:
Name Type Argument Description
config Object <optional>
The configuration object.
Properties
Name Type Argument Description
x Number <optional>
The X coordinate of point.
y Number <optional>
The Y coordinate of point.
date Date <optional>
The date of point.
record Number <optional>
The record of point.
value Number <optional>
The value of point.
Example
// Create cartesian point.
 var p1 = new StockChartX.ChartPoint({
     x: 10,
     y: 20
 });

 // Create date-value point.
 var p2 = new StockChartX.ChartPoint({
     date: new Date(),
     value: 10.0
 });

 // Create record-value point.
 var p3 = new StockChartX.ChartPoint({
     record: 1,
     value: 10.0
 });

Members


date :Date

Raw point's date value.
Type:
  • Date

record :number

Raw point's record value.
Type:
  • number

value :number

Raw point's price value.
Type:
  • number

x :number

Raw point's X coordinate.
Type:
  • number

y :number

Raw point's Y coordinate
Type:
  • number

Methods


<static> ChartPoint.convert(point, behavior, projection)

Converts XY point into ChartPoint.
Parameters:
Name Type Description
point StockChartX.Point The source point.
behavior StockChartX.PointBehavior The convert behavior.
projection StockChartX.Projection The projection.
Returns:
Type
StockChartX.ChartPoint
Example
var point = {
 x: 10,
 y: 20
};
var behavior = {
 x: StockChartX.XPointBehavior.RECORD,
 y: StockChartX.YPointBehavior.VALUE
};
var chartPoint = StockChartX.ChartPoint.convert(point, behavior, projection);

clear()

Clears point's values.

getX(projection)

Returns point's X coordinate using a given projection.
Parameters:
Name Type Description
projection StockChartX.Projection The projection.
See:
Returns:
The X coordinate.
Type
Number
Example
var x = point.getX(projection);

getY(projection)

Returns point's Y coordinate using a given projection.
Parameters:
Name Type Description
projection StockChartX.Projection The projection.
See:
Returns:
The Y coordinate.
Type
Number
Example
var y = point.getY(projection);

moveTo(x, y, projection)

Moves chart point to a given point.
Parameters:
Name Type Description
x Number The X coordinate.
y Number The Y coordinate.
projection StockChartX.Projection The projection.
See:
Returns:
Returns self.
Type
StockChartX.ChartPoint
Example
point.moveTo(10, 20, projection);

moveToPoint(point, projection)

Moves chart point to a given point.
Parameters:
Name Type Description
point StockChartX.Point The destination point.
projection StockChartX.Projection The projection.
Returns:
Returns self.
Type
StockChartX.ChartPoint
Example
point.moveToPoint({x: 10, y: 20}, projection);

moveToX(x, projection)

Moves chart point to a point with a given X coordinate.
Parameters:
Name Type Description
x Number The X coordinate.
projection StockChartX.Projection The projection.
Returns:
Returns self.
Type
StockChartX.ChartPoint
Example
point.moveToX(10, projection);

moveToY(y, projection)

Moves chart point to a point with a given Y coordinate.
Parameters:
Name Type Description
y Number The Y coordinate.
projection StockChartX.Projection The projection.
Returns:
Returns self.
Type
StockChartX.ChartPoint
Example
point.moveToY(20, projection);

toPoint(projection)

Converts chart point to cartesian point.
Parameters:
Name Type Description
projection StockChartX.Projection The projection.
Returns:
The cartesian point.
Type
StockChartX.Point
Example
var p = point.toPoint(projection);
 console.log("x: " + p.x + ", y: " + p.y);

translate(dx, dy, projection)

Translates chart point onto a given X, Y offsets.
Parameters:
Name Type Description
dx Number The X offset.
dy Number The Y offset.
projection StockChartX.Projection The projection.
See:
Returns:
Returns self.
Type
StockChartX.ChartPoint
Example
point.translate(10, 20, projection);