public interface SVGElement extends Any
text
or label
elements are created with the useHTML
parameter.
The SVGElement instances are created through factory functions on the
Highcharts.SVGRenderer object, like rect, path, text, label, g and more.Modifier and Type | Interface and Description |
---|---|
static interface |
SVGElement.AnimateComplete |
static interface |
SVGElement.AttrComplete |
static interface |
SVGElement.OnHandler |
Modifier and Type | Method and Description |
---|---|
SVGElement |
add()
Add the element to the DOM.
|
SVGElement |
add(SVGElement parent)
Add the element to the DOM.
|
SVGElement |
add(SVGElement parent)
Add the element to the DOM.
|
SVGElement |
addClass(String className)
Add a class name to an element.
|
SVGElement |
addClass(String className,
boolean replace)
Add a class name to an element.
|
SVGElement |
align()
Align the element relative to the chart or another box.
|
SVGElement |
align(AlignObject alignOptions)
Align the element relative to the chart or another box.
|
SVGElement |
align(AlignObject alignOptions,
boolean alignByTranslate)
Align the element relative to the chart or another box.
|
SVGElement |
align(AlignObject alignOptions,
boolean alignByTranslate,
BBoxObject box)
Align the element relative to the chart or another box.
|
SVGElement |
align(AlignObject alignOptions,
boolean alignByTranslate,
String box)
Align the element relative to the chart or another box.
|
SVGElement |
animate(SVGAttributes params)
Animate to given attributes or CSS properties.
|
SVGElement |
animate(SVGAttributes params,
AnimationOptionsObject options)
Animate to given attributes or CSS properties.
|
SVGElement |
animate(SVGAttributes params,
AnimationOptionsObject options,
SVGElement.AnimateComplete complete)
Animate to given attributes or CSS properties.
|
Unknown |
attr()
Apply native and custom attributes to the SVG elements.
|
Unknown |
attr(String hash)
Apply native and custom attributes to the SVG elements.
|
Unknown |
attr(String hash,
String val)
Apply native and custom attributes to the SVG elements.
|
Unknown |
attr(String hash,
String val,
SVGElement.AttrComplete complete)
Apply native and custom attributes to the SVG elements.
|
Unknown |
attr(String hash,
String val,
SVGElement.AttrComplete complete,
boolean continueAnimation)
Apply native and custom attributes to the SVG elements.
|
Unknown |
attr(SVGAttributes hash,
String val,
SVGElement.AttrComplete complete,
boolean continueAnimation)
Apply native and custom attributes to the SVG elements.
|
SVGElement |
clip()
Apply a clipping rectangle to this element.
|
SVGElement |
clip(SVGElement clipRect)
Apply a clipping rectangle to this element.
|
RectangleObject |
crisp(RectangleObject rect)
Calculate the coordinates needed for drawing a rectangle crisply and
return the calculated attributes.
|
RectangleObject |
crisp(RectangleObject rect,
double strokeWidth)
Calculate the coordinates needed for drawing a rectangle crisply and
return the calculated attributes.
|
SVGElement |
css(CSSObject styles)
Set styles for the element.
|
void |
destroy()
Destroy the element and element wrapper and clear up the DOM and event
hooks.
|
void |
fadeOut()
Fade out an element by animating its opacity down to 0, and hide it on
complete.
|
void |
fadeOut(double duration)
Fade out an element by animating its opacity down to 0, and hide it on
complete.
|
BBoxObject |
getBBox()
Get the bounding box (width, height, x and y) for the element.
|
BBoxObject |
getBBox(boolean reload)
Get the bounding box (width, height, x and y) for the element.
|
BBoxObject |
getBBox(boolean reload,
double rot)
Get the bounding box (width, height, x and y) for the element.
|
Unknown |
getElement()
The primary DOM node.
|
SVGRenderer |
getRenderer()
The renderer that the SVGElement belongs to.
|
boolean |
hasClass(String className)
Check if an element has the given class name.
|
SVGElement |
hide()
Hide the element, equivalent to setting the
visibility attribute to
hidden . |
void |
init(SVGRenderer renderer,
String nodeName)
Initialize the SVG element.
|
SVGElement |
invert(boolean inverted)
Invert a group, rotate and flip.
|
SVGElement |
on(String eventType,
SVGElement.OnHandler handler)
Add an event listener.
|
SVGElement |
removeClass(RegExp className)
Remove a class name from the element.
|
SVGElement |
removeClass(String className)
Remove a class name from the element.
|
void |
setElement(HTMLElement value)
The primary DOM node.
|
void |
setElement(SVGElement value)
The primary DOM node.
|
SVGElement |
setRadialReference(double[] coordinates)
Set the coordinates needed to draw a consistent radial gradient across a
shape regardless of positioning inside the chart.
|
void |
setRenderer(SVGRenderer value)
The renderer that the SVGElement belongs to.
|
SVGElement |
shadow(boolean shadowOptions,
SVGElement group,
boolean cutOff)
Add a shadow to the element.
|
SVGElement |
shadow(ShadowOptionsObject shadowOptions)
Add a shadow to the element.
|
SVGElement |
shadow(ShadowOptionsObject shadowOptions,
SVGElement group)
Add a shadow to the element.
|
SVGElement |
shadow(ShadowOptionsObject shadowOptions,
SVGElement group,
boolean cutOff)
Add a shadow to the element.
|
SVGElement |
show()
Show the element after it has been hidden.
|
SVGElement |
show(boolean inherit)
Show the element after it has been hidden.
|
SVGElement |
toFront()
Bring the element to the front.
|
void |
translate(double x,
double y)
Move an object and its children by x and y values.
|
Unknown getElement()
SVGElement
instance wraps a main DOM node,
but may also represent more nodes.void setElement(SVGElement value)
SVGElement
instance wraps a main DOM node,
but may also represent more nodes.void setElement(HTMLElement value)
SVGElement
instance wraps a main DOM node,
but may also represent more nodes.SVGRenderer getRenderer()
void setRenderer(SVGRenderer value)
SVGElement add()
parent
- The parent item to add it to. If undefined, the element is added
to the Highcharts.SVGRenderer.box.SVGElement add(SVGElement parent)
parent
- The parent item to add it to. If undefined, the element is added
to the Highcharts.SVGRenderer.box.SVGElement add(SVGElement parent)
parent
- The parent item to add it to. If undefined, the element is added
to the Highcharts.SVGRenderer.box.SVGElement addClass(String className)
className
- The new class name to add.replace
- When true, the existing class name(s) will be overwritten with the
new one. When false, the new one is added.SVGElement addClass(String className, boolean replace)
className
- The new class name to add.replace
- When true, the existing class name(s) will be overwritten with the
new one. When false, the new one is added.SVGElement align()
alignOptions
- The alignment options. The function can be called without this
parameter in order to re-align an element after the box has been
updated.alignByTranslate
- Align element by translation.box
- The box to align to, needs a width and height. When the box is a
string, it refers to an object in the Renderer. For example, when
box is spacingBox
, it refers to Renderer.spacingBox
which
holds width
, height
, x
and y
properties.SVGElement align(AlignObject alignOptions, boolean alignByTranslate, String box)
alignOptions
- The alignment options. The function can be called without this
parameter in order to re-align an element after the box has been
updated.alignByTranslate
- Align element by translation.box
- The box to align to, needs a width and height. When the box is a
string, it refers to an object in the Renderer. For example, when
box is spacingBox
, it refers to Renderer.spacingBox
which
holds width
, height
, x
and y
properties.SVGElement align(AlignObject alignOptions, boolean alignByTranslate)
alignOptions
- The alignment options. The function can be called without this
parameter in order to re-align an element after the box has been
updated.alignByTranslate
- Align element by translation.box
- The box to align to, needs a width and height. When the box is a
string, it refers to an object in the Renderer. For example, when
box is spacingBox
, it refers to Renderer.spacingBox
which
holds width
, height
, x
and y
properties.SVGElement align(AlignObject alignOptions, boolean alignByTranslate, BBoxObject box)
alignOptions
- The alignment options. The function can be called without this
parameter in order to re-align an element after the box has been
updated.alignByTranslate
- Align element by translation.box
- The box to align to, needs a width and height. When the box is a
string, it refers to an object in the Renderer. For example, when
box is spacingBox
, it refers to Renderer.spacingBox
which
holds width
, height
, x
and y
properties.SVGElement align(AlignObject alignOptions)
alignOptions
- The alignment options. The function can be called without this
parameter in order to re-align an element after the box has been
updated.alignByTranslate
- Align element by translation.box
- The box to align to, needs a width and height. When the box is a
string, it refers to an object in the Renderer. For example, when
box is spacingBox
, it refers to Renderer.spacingBox
which
holds width
, height
, x
and y
properties.SVGElement animate(SVGAttributes params, AnimationOptionsObject options, SVGElement.AnimateComplete complete)
params
- SVG attributes or CSS to animate.options
- Animation options.complete
- Function to perform at the end of animation.SVGElement animate(SVGAttributes params, AnimationOptionsObject options)
params
- SVG attributes or CSS to animate.options
- Animation options.complete
- Function to perform at the end of animation.SVGElement animate(SVGAttributes params)
params
- SVG attributes or CSS to animate.options
- Animation options.complete
- Function to perform at the end of animation.Unknown attr()
translateX
and translateY
attributes to position the element
instead.
Attributes frequently used in Highcharts are fill
, stroke
,
stroke-width
.hash
- The native and custom SVG attributes.val
- If the type of the first argument is string
, the second can be a
value, which will serve as a single attribute setter. If the first
argument is a string and the second is undefined, the function
serves as a getter and the current value of the property is
returned.complete
- A callback function to execute after setting the attributes. This
makes the function compliant and interchangeable with the
SVGElement#animate function.continueAnimation
- Used internally when .attr
is called as part of an animation
step. Otherwise, calling .attr
for an attribute will stop
animation for that attribute.Unknown attr(String hash, String val, SVGElement.AttrComplete complete, boolean continueAnimation)
translateX
and translateY
attributes to position the element
instead.
Attributes frequently used in Highcharts are fill
, stroke
,
stroke-width
.hash
- The native and custom SVG attributes.val
- If the type of the first argument is string
, the second can be a
value, which will serve as a single attribute setter. If the first
argument is a string and the second is undefined, the function
serves as a getter and the current value of the property is
returned.complete
- A callback function to execute after setting the attributes. This
makes the function compliant and interchangeable with the
SVGElement#animate function.continueAnimation
- Used internally when .attr
is called as part of an animation
step. Otherwise, calling .attr
for an attribute will stop
animation for that attribute.Unknown attr(String hash, String val, SVGElement.AttrComplete complete)
translateX
and translateY
attributes to position the element
instead.
Attributes frequently used in Highcharts are fill
, stroke
,
stroke-width
.hash
- The native and custom SVG attributes.val
- If the type of the first argument is string
, the second can be a
value, which will serve as a single attribute setter. If the first
argument is a string and the second is undefined, the function
serves as a getter and the current value of the property is
returned.complete
- A callback function to execute after setting the attributes. This
makes the function compliant and interchangeable with the
SVGElement#animate function.continueAnimation
- Used internally when .attr
is called as part of an animation
step. Otherwise, calling .attr
for an attribute will stop
animation for that attribute.Unknown attr(String hash, String val)
translateX
and translateY
attributes to position the element
instead.
Attributes frequently used in Highcharts are fill
, stroke
,
stroke-width
.hash
- The native and custom SVG attributes.val
- If the type of the first argument is string
, the second can be a
value, which will serve as a single attribute setter. If the first
argument is a string and the second is undefined, the function
serves as a getter and the current value of the property is
returned.complete
- A callback function to execute after setting the attributes. This
makes the function compliant and interchangeable with the
SVGElement#animate function.continueAnimation
- Used internally when .attr
is called as part of an animation
step. Otherwise, calling .attr
for an attribute will stop
animation for that attribute.Unknown attr(SVGAttributes hash, String val, SVGElement.AttrComplete complete, boolean continueAnimation)
translateX
and translateY
attributes to position the element
instead.
Attributes frequently used in Highcharts are fill
, stroke
,
stroke-width
.hash
- The native and custom SVG attributes.val
- If the type of the first argument is string
, the second can be a
value, which will serve as a single attribute setter. If the first
argument is a string and the second is undefined, the function
serves as a getter and the current value of the property is
returned.complete
- A callback function to execute after setting the attributes. This
makes the function compliant and interchangeable with the
SVGElement#animate function.continueAnimation
- Used internally when .attr
is called as part of an animation
step. Otherwise, calling .attr
for an attribute will stop
animation for that attribute.Unknown attr(String hash)
translateX
and translateY
attributes to position the element
instead.
Attributes frequently used in Highcharts are fill
, stroke
,
stroke-width
.hash
- The native and custom SVG attributes.val
- If the type of the first argument is string
, the second can be a
value, which will serve as a single attribute setter. If the first
argument is a string and the second is undefined, the function
serves as a getter and the current value of the property is
returned.complete
- A callback function to execute after setting the attributes. This
makes the function compliant and interchangeable with the
SVGElement#animate function.continueAnimation
- Used internally when .attr
is called as part of an animation
step. Otherwise, calling .attr
for an attribute will stop
animation for that attribute.SVGElement clip()
clipRect
- The clipping rectangle. If skipped, the current clip is removed.SVGElement clip(SVGElement clipRect)
clipRect
- The clipping rectangle. If skipped, the current clip is removed.RectangleObject crisp(RectangleObject rect, double strokeWidth)
rect
- Rectangle to crisp.strokeWidth
- The stroke width to consider when computing crisp positioning. It
can also be set directly on the rect parameter.RectangleObject crisp(RectangleObject rect)
rect
- Rectangle to crisp.strokeWidth
- The stroke width to consider when computing crisp positioning. It
can also be set directly on the rect parameter.SVGElement css(CSSObject styles)
width
, ellipsis
and textOverflow
for SVG text elements.styles
- The new CSS styles.void destroy()
void fadeOut()
duration
- The fade duration in milliseconds.void fadeOut(double duration)
duration
- The fade duration in milliseconds.BBoxObject getBBox(boolean reload, double rot)
reload
- Skip the cache and get the updated DOM bouding box.rot
- Override the element's rotation. This is internally used on axis
labels with a value of 0 to find out what the bounding box would
be have been if it were not rotated.x
, y
, width
and height
properties.BBoxObject getBBox()
reload
- Skip the cache and get the updated DOM bouding box.rot
- Override the element's rotation. This is internally used on axis
labels with a value of 0 to find out what the bounding box would
be have been if it were not rotated.x
, y
, width
and height
properties.BBoxObject getBBox(boolean reload)
reload
- Skip the cache and get the updated DOM bouding box.rot
- Override the element's rotation. This is internally used on axis
labels with a value of 0 to find out what the bounding box would
be have been if it were not rotated.x
, y
, width
and height
properties.boolean hasClass(String className)
className
- The class name to check for.SVGElement hide()
visibility
attribute to
hidden
.void init(SVGRenderer renderer, String nodeName)
renderer
- The SVGRenderer instance to initialize to.nodeName
- The SVG node name.SVGElement invert(boolean inverted)
inverted
- Whether to invert or not. An inverted shape can be un-inverted by
setting it to false.SVGElement on(String eventType, SVGElement.OnHandler handler)
eventType
- The event type. If the type is click
, Highcharts will internally
translate it to a touchstart
event on touch devices, to prevent
the browser from waiting for a click event from firing.handler
- The handler callback.SVGElement removeClass(RegExp className)
className
- The class name to remove.SVGElement removeClass(String className)
className
- The class name to remove.SVGElement setRadialReference(double[] coordinates)
coordinates
- The center reference. The format is [centerX, centerY, diameter]
in pixels.SVGElement shadow(ShadowOptionsObject shadowOptions, SVGElement group)
defs
and
filters.shadowOptions
- The shadow options. If true
, the default options are applied. If
false
, the current shadow will be removed.group
- The SVG group element where the shadows will be applied. The
default is to add it to the same parent as the current element.
Internally, this is ised for pie slices, where all the shadows are
added to an element behind all the slices.cutOff
- Used internally for column shadows.SVGElement shadow(ShadowOptionsObject shadowOptions, SVGElement group, boolean cutOff)
defs
and
filters.shadowOptions
- The shadow options. If true
, the default options are applied. If
false
, the current shadow will be removed.group
- The SVG group element where the shadows will be applied. The
default is to add it to the same parent as the current element.
Internally, this is ised for pie slices, where all the shadows are
added to an element behind all the slices.cutOff
- Used internally for column shadows.SVGElement shadow(boolean shadowOptions, SVGElement group, boolean cutOff)
defs
and
filters.shadowOptions
- The shadow options. If true
, the default options are applied. If
false
, the current shadow will be removed.group
- The SVG group element where the shadows will be applied. The
default is to add it to the same parent as the current element.
Internally, this is ised for pie slices, where all the shadows are
added to an element behind all the slices.cutOff
- Used internally for column shadows.SVGElement shadow(ShadowOptionsObject shadowOptions)
defs
and
filters.shadowOptions
- The shadow options. If true
, the default options are applied. If
false
, the current shadow will be removed.group
- The SVG group element where the shadows will be applied. The
default is to add it to the same parent as the current element.
Internally, this is ised for pie slices, where all the shadows are
added to an element behind all the slices.cutOff
- Used internally for column shadows.SVGElement show()
inherit
- Set the visibility attribute to inherit
rather than visible
.
The difference is that an element with visibility="visible"
will
be visible even if the parent is hidden.SVGElement show(boolean inherit)
inherit
- Set the visibility attribute to inherit
rather than visible
.
The difference is that an element with visibility="visible"
will
be visible even if the parent is hidden.SVGElement toFront()
void translate(double x, double y)
x
- The x value.y
- The y value.Copyright © 2020. All rights reserved.