new Rect(rect)
Describes rectangle structure.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
rect |
StockChartX.Rect | StockChartX.IRect |
<optional> |
The source rectangle object to copy values from. |
Examples
Create empty rectangle var rect = new StockChartX.Rect();
Create rectangle at (10, 10) top left point and size (20, 20). var rect = new StockChartX.Rect({ left: 10, top: 10, width: 20, height: 20 );
Members
-
<readonly> bottom :number
-
The bottom Y coordinate.
Type:
- number
-
height :Number
-
The height of rectangle.
Type:
- Number
-
left :Number
-
The X coordinate of top left point.
Type:
- Number
-
<readonly> right :number
-
The right X coordinate.
Type:
- number
-
top :Number
-
The Y coordinate of top left point.
Type:
- Number
-
width :Number
-
The width of rectangle.
Type:
- Number
Methods
-
applyPadding(padding)
-
Applies padding to the rectangle.
Parameters:
Name Type Description padding
StockChartX.Padding The padding. -
clone()
-
Clones rectangle object.
Returns:
- Type
- StockChartX.Rect
-
containsPoint(point)
-
Determines whether rectangle contains a point described by (X, Y) coordinates.
Parameters:
Name Type Description point
StockChartX.Point The (X, Y) point. Returns:
True if rectangles are equal, false otherwise.- Type
- boolean
Example
var rect = new StockChartX.Rect({ left: 10, top: 10, width: 20, height: 20 }); var result = rect.containsPoint({x: 15, y: 15}); // returns true.
-
copyFrom(rect)
-
Copies properties from a given rectangle.
Parameters:
Name Type Description rect
StockChartX.IRect The source rectangle to copy properties from. -
equals(rect)
-
Determines whether rectangle equals to a given rectangle. Both rectangles are equal if their properties are equal.
Parameters:
Name Type Description rect
StockChartX.IRect The rectangle to compare. Returns:
- Type
- boolean
Example
var rect1 = new StockChartX.Rect({ left: 10, top: 10, width: 20, height: 20 ); var rect2 = { left: 10, top: 10, width: 10, height: 10 }; var result = rect1.equals(rect2); // returns true.
-
toString()
-
Returns string representation of the rectangle object.
Returns:
- Type
- string