public final class Helpers extends Object
chart.helpers.| Modifier and Type | Method and Description |
|---|---|
void |
clipArea(Canvas canvas,
double width,
double height)
Clips an area on the canvas context, using the
Context2dItem of the canvas.The area is specified by size. Starting points are 0. |
void |
clipArea(Canvas canvas,
double x,
double y,
double width,
double height)
Clips an area on the canvas context, using the
Context2dItem of the canvas.The area is specified by coordinates and size. |
void |
clipArea(Canvas canvas,
IsArea area)
Clips an area on the canvas context, using the
Context2dItem of the canvas. |
void |
clipArea(Context2dItem context,
double width,
double height)
Clips an area on the canvas context.
The area is specified by size. Starting points are 0. |
void |
clipArea(Context2dItem context,
double x,
double y,
double width,
double height)
Clips an area on the canvas context.
The area is specified by coordinates and size. |
void |
clipArea(Context2dItem context,
IsArea area)
Clips an area on the canvas context.
|
void |
clipArea(IsChart chart)
Clips an area on the canvas context using the
ChartAreaNode of the chart. |
void |
clipArea(IsChart chart,
double width,
double height)
Clips an area on the canvas context, using the
Canvas of the chart.The area is specified by size. Starting points are 0. |
void |
clipArea(IsChart chart,
double x,
double y,
double width,
double height)
Clips an area on the canvas context, using the
Canvas of the chart.The area is specified by coordinates and size. |
void |
clipArea(IsChart chart,
IsArea area)
Clips an area on the canvas context, using the
Canvas of the chart. |
NativeObject |
clone(NativeObject source)
Returns a deep copy of source without keeping references on objects and arrays.
|
static Helpers |
get()
Singleton method to get the instance
|
EventPoint |
getRelativePosition(ChartEventContext eventContext)
A common occurrence is taking an event, such as a click, and finding the data coordinates on the chart where the event occurred.
|
EventPoint |
getRelativePosition(IsChart chart,
AbstractEvent event)
A common occurrence is taking an event, such as a click, and finding the data coordinates on the chart where the event occurred.
|
EventPoint |
getRelativePosition(IsChart chart,
BaseNativeEvent event)
A common occurrence is taking an event, such as a click, and finding the data coordinates on the chart where the event occurred.
|
NativeObject |
mergeIf(NativeObject target,
NativeObject source)
Recursively deep copies source properties in the target only if not defined in target.
IMPORTANT: target is not cloned and will be updated with source properties. |
IsImmutableFont |
toFont(FontItem font)
Parses font options and returns a normalized font object.
|
IsImmutableFont |
toFont(IsDefaultFont font)
Parses font options and returns a normalized font object.
|
String |
toFontString(FontItem font)
Builds the font string (shorthand property of CSS font) to use in the canvas object.
See here CSS specification. |
String |
toFontString(IsDefaultFont font)
Builds the font string (shorthand property of CSS font) to use in the canvas object.
See here CSS specification. |
void |
unclipArea(Context2dItem context)
Unclips the area previously set.
|
public static Helpers get()
public NativeObject mergeIf(NativeObject target, NativeObject source)
target - the target object in which all sources are merged into.source - object to merge in the target.public NativeObject clone(NativeObject source)
source - the object to clone.public EventPoint getRelativePosition(ChartEventContext eventContext)
eventContext - event context to be used for getting the point.public EventPoint getRelativePosition(IsChart chart, AbstractEvent event)
chart - chart instanceevent - native event to be used for getting the point.public EventPoint getRelativePosition(IsChart chart, BaseNativeEvent event)
chart - chart instanceevent - native event to be used for getting the point.public IsImmutableFont toFont(IsDefaultFont font)
font - a object that contains font options to be parsed.public IsImmutableFont toFont(FontItem font)
font - a object that contains font options to be parsed.public String toFontString(IsDefaultFont font)
font - a object that contains font options to be parsed.public String toFontString(FontItem font)
font - a object that contains font options to be parsed.public void clipArea(IsChart chart)
ChartAreaNode of the chart.chart - chart instancepublic void clipArea(IsChart chart, IsArea area)
Canvas of the chart.chart - chart instancearea - area to clip on the contextpublic void clipArea(IsChart chart, double width, double height)
Canvas of the chart.chart - chart instancewidth - the rectangle's width. Positive values are to the right, and negative to the leftheight - the rectangle's height. Positive values are down, and negative are uppublic void clipArea(IsChart chart, double x, double y, double width, double height)
Canvas of the chart.chart - chart instancex - the x-axis coordinate of the rectangle's starting pointy - the y-axis coordinate of the rectangle's starting pointwidth - the rectangle's width. Positive values are to the right, and negative to the leftheight - the rectangle's height. Positive values are down, and negative are uppublic void clipArea(Canvas canvas, IsArea area)
Context2dItem of the canvas.canvas - canvas where to apply the clipppingarea - area to clip on the contextpublic void clipArea(Canvas canvas, double width, double height)
Context2dItem of the canvas.canvas - canvas where to apply the clipppingwidth - the rectangle's width. Positive values are to the right, and negative to the leftheight - the rectangle's height. Positive values are down, and negative are uppublic void clipArea(Canvas canvas, double x, double y, double width, double height)
Context2dItem of the canvas.canvas - canvas where to apply the clipppingx - the x-axis coordinate of the rectangle's starting pointy - the y-axis coordinate of the rectangle's starting pointwidth - the rectangle's width. Positive values are to the right, and negative to the leftheight - the rectangle's height. Positive values are down, and negative are uppublic void clipArea(Context2dItem context, IsArea area)
context - context of the canvasarea - area to clip on the contextpublic void clipArea(Context2dItem context, double width, double height)
context - context of the canvaswidth - the rectangle's width. Positive values are to the right, and negative to the leftheight - the rectangle's height. Positive values are down, and negative are uppublic void clipArea(Context2dItem context, double x, double y, double width, double height)
context - context of the canvasx - the x-axis coordinate of the rectangle's starting pointy - the y-axis coordinate of the rectangle's starting pointwidth - the rectangle's width. Positive values are to the right, and negative to the leftheight - the rectangle's height. Positive values are down, and negative are uppublic void unclipArea(Context2dItem context)
context - context of the canvas where an area has been clipped.