AnyChart
API Reference
Still have questions?
Contact support
Top
You are looking at an outdated 7.7.0 version of this document. Switch to the 8.4.0 version to see the up to date information.

class anychart.core.VisualBase Improve this Doc

Extends: anychart.core.Base

Base class for all elements.

Methods Overview

Export
print()Prints all element.
saveAsJpg()Saves into JPEG file.
saveAsPdf()Saves into PDF file.
saveAsPng()Saves into PNG file.
saveAsSvg()Saves into SVG file.
toSvg()Returns SVG string.
Interactivity
enabled()Element state (enabled or disabled).
Size and Position
zIndex()Z-index of the element.

Methods Description

enabled

Getter for the current element state (enabled or disabled).

Returns:

boolean - The current element state.
Setter for the element enabled state.

Params:

NameTypeDefaultDescription
valueboolean
true
Value to set.

Returns:

anychart.core.VisualBase - Self instance for method chaining.
Example.
if (!element.enabled())
   element.enabled(true);

print

Prints all element on related stage.

Params:

NameTypeDefaultDescription
paperSizeanychart.graphics.vector.PaperSize
Paper size.
landscapeboolean
false
Flag of landscape.

saveAsJpg

Saves the current visual state into JPEG file.

Params:

NameTypeDescription
widthnumberImage width.
heightnumberImage height.
qualitynumberImage quality in ratio 0-1.
forceTransparentWhitebooleanDefine, should we force transparent to white background.

saveAsPdf

Saves the current visual state into PDF file.

Params:

NameTypeDescription
paperSizestringAny paper format like 'a0', 'tabloid', 'b4', etc.
landscapebooleanDefine, is landscape.
xnumberOffset X.
ynumberOffset Y.

saveAsPng

Saves the current visual state into PNG file.

Params:

NameTypeDescription
widthnumberImage width.
heightnumberImage height.
qualitynumberImage quality in ratio 0-1.

saveAsSvg

Saves the current visual state into SVG file with a paper size and landscape settings.

Params:

NameTypeDescription
paperSizestringPaper Size.
landscapebooleanLandscape.
Saves the current visual state into SVG file image width and height.

Params:

NameTypeDescription
widthnumberImage width.
heightnumberImage height.

toSvg

Returns SVG string if type of content SVG with parameters otherwise returns empty string.

Params:

NameTypeDescription
paperSizestringPaper Size.
landscapebooleanLandscape.

Returns:

string - SVG string or empty string.
Returns SVG string if type of content SVG with determined the width and height otherwise returns empty string.

Params:

NameTypeDescription
widthnumberPaper Size or width.
heightnumberLandscape or height.

Returns:

string - SVG string or empty string.

zIndex

Getter for the current Z-index of the element.

Returns:

number - The current zIndex.
Setter for the Z-index of the element.

Params:

NameTypeDefaultDescription
valuenumber
0
Value to set.

Returns:

anychart.core.VisualBase - Self instance for method chaining.