class anychart.core.utils.Margin Improve this Doc
Extends: anychart.core.Base
Stores margins values. Can accept numbers and strings. Use anychart.core.utils.Margin#set method to set values.
Methods Overview
Specific settings | |
set() | Sets all offsets. |
Size and Position | |
bottom() | Getter for the bottom space. |
left() | Getter for the left space. |
right() | Getter for the right space. |
top() | Getter for the top space. |
Methods Description
bottom
Getter for the bottom space.
Returns previously set margin, not the derived pixel value.
Returns previously set margin, not the derived pixel value.
Returns:
number | string - The bottom space.Try it:
Setter for the bottom space.
Params:
Name | Type | Description |
---|---|---|
bottom | number | string | null | Bottom space to set. |
Returns:
anychart.core.utils.Margin - Self instance for method chaining.Try it:
left
Getter for the left space.
Returns previously set margin, not the derived pixel value.
Returns previously set margin, not the derived pixel value.
Returns:
number | string - The left space.Try it:
Setter for the left space.
Params:
Name | Type | Description |
---|---|---|
left | number | string | null | Left space to set. |
Returns:
anychart.core.utils.Margin - Self instance for method chaining.Try it:
right
Getter for the right space.
Returns previously set margin, not the derived pixel value.
Returns previously set margin, not the derived pixel value.
Returns:
number | string - The right space.Try it:
Setter for the right space.
Params:
Name | Type | Description |
---|---|---|
right | number | string | null | Right space to set. |
Returns:
anychart.core.utils.Margin - Self instance for method chaining.Try it:
set
Sets all offsets.
Detailed description
Can accept other Margin object or from 0 to 4 values (numbers or percent strings).
Margin values are set in a way they are set in CSS:
1) set(25, 50, 75, 100):
top space is 25
right space is 50
bottom space is 75
left space is 100
2) set(25, 50, 75):
top space is 25
right and left spaces are 50
bottom space is 75
3) set(25, 50):
top and bottom spaces are 25
right and left spaces are 50
4) set(25):
all four spaces are 25
Also can accept arrays and objects with 'left', 'top', 'right' and 'bottom' fields.
Note: set() - all four spaces are 0.
Margin values are set in a way they are set in CSS:
1) set(25, 50, 75, 100):
top space is 25
right space is 50
bottom space is 75
left space is 100
2) set(25, 50, 75):
top space is 25
right and left spaces are 50
bottom space is 75
3) set(25, 50):
top and bottom spaces are 25
right and left spaces are 50
4) set(25):
all four spaces are 25
Also can accept arrays and objects with 'left', 'top', 'right' and 'bottom' fields.
Note: set() - all four spaces are 0.
Params:
Name | Type | Description |
---|---|---|
value1 | string | number | Array.<(number|string)> | Object | Margin object or top or top and bottom space. |
value2 | string | number | Right or right and left space. |
value3 | string | number | Bottom space. |
value4 | string | number | Left space. |
Returns:
anychart.core.utils.Margin - Self instance for method chaining.Try it:
top
Getter for the top space.
Returns previously set margin, not the derived pixel value.
Returns previously set margin, not the derived pixel value.
Returns:
number | string - The top space.Try it:
Setter for the top space.
Params:
Name | Type | Description |
---|---|---|
top | number | string | null | Top space to set. |
Returns:
anychart.core.utils.Margin - Self instance for method chaining.Try it: