Pattern
Type class
Base class to define patterns.
Sources
Pattern can be used (imported) via one of the following packages.
/** * Import from: "core.ts" * Use like: am4core.Pattern */import * as am4core from "@amcharts/amcharts4/core";/** * Include via: <script src="core.js"></script> * Access items like: am4core.Pattern */Inheritance
Pattern extends BaseObject.
Pattern is extended by LinePattern, RectPattern, CirclePattern.
Properties
backgroundFillType
ColorPattern background fill color.
backgroundOpacityType
numberPattern backgorund opacity. (0-1)
elementType
GroupAn SVG
<group>element to put sub-elements into.elementsReturns the list of SVG elements comprising the pattern.
fillType
ColorFill color of the pattern.
fillOpacityType
numberPattern fill opacity. (0-1)
heightType
numberPattern height in pixels.
patternUnitsType
"userSpaceOnUse"|"objectBoundingBox"Pattern measuring units.
Available options: "userSpaceOnUse" | "objectBoundingBox".
rotationType
numberPattern rotation in degrees.
shapeRenderingType
ShapeRenderingShape rendering
strokeType
ColorPattern stroke (border) color.
strokeDasharrayType
stringA
stroke-dasharrayfor the stroke (outline)."Dasharray" allows setting rules to make lines dashed, dotted, etc.
More info: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray on
stroke-dasharraystrokeOpacityType
numberPattern stroke opacity. (0-1)
strokeWidthType
numberPattern stroke thickness in pixels.
widthType
numberPattern width in pixels.
xType
numberX position. (pixels)
yType
numberY position (px).
4 inherited items
clonedFromType
$type.Optional<this>Inherited fromBaseObjectReference to the original object this object was cloned from. We need to keep this so we can disassociate it from source object when this object is disposed.
configType
objectInherited fromBaseObjectUse this property to set JSON-based config. When set, triggers processing routine, which will go through all properties, and try to apply values, create instances, etc.
Use this with caution, as it is a time-consuming process. It's used for initialchart setup only, not routine operations.
idType
$type.Optional<string>Inherited fromBaseObjectSets the user-defined id of the element.
uidType
stringInherited fromBaseObjectReturns object's internal unique ID.
Methods
addElement(element:AMElement)Returns
voidAdds an element to the pattern.
animate(animationOptions:IAnimationOptions[]|IAnimationOptions,
duration:number,
easing?: (value:number) =>number)Returns
AnimationAnimate pattern properties.
More info:
Animationconstructor()Returns
PatternConstructor
copyFrom(source:this)Returns
voidCopies properties from another Pattern instance.
removeElement(element:AMElement)Returns
voidRemove an element from the pattern.
4 inherited items
clone(cloneId?:string)Returns
thisInherited fromBaseObjectMakes a copy of this object and returns the clone. Try to avoid cloning complex objects like chart, create new instances if you need them.
dispose()Returns
voidInherited fromBaseObjectDestroys this object and all related data.
getCurrentThemes()Returns
ITheme[]Inherited fromBaseObjectReturns a list of themes that should be applied to this element. It could either be a list of themes set explicitly on this element, or system-wide.
isDisposed()Returns
booleanInherited fromBaseObjectReturns if this object has been already been disposed.
Events
Pattern does not have any events.