Popup
Type class
Shows an HTML popup which covers window or a chart area.
More info: Popups and Modals For examples and docs on Popups and Modals.
Sources
Popup can be used (imported) via one of the following packages.
/** * Import from: "core.ts" * Use like: am4core.Popup */import * as am4core from "@amcharts/amcharts4/core";/** * Include via: <script src="core.js"></script> * Access items like: am4core.Popup */Inheritance
Popup extends BaseObjectEvents.
Popup is extended by Modal.
Properties
adapterType
Adapter<Popup,IPopupAdapters>Defaultnew Adapter<Popup, IPopupAdapters>(this)Adapter.
alignType
AlignDefault"center"Horizontal positioning of the content window.
Available options: "left", "center" (default), "right", and "none".
bottomType
number|Percent"bottom" coordinate of a non-aligned (
verticalAlign = "none") popup.Can be either absolute pixel value, or relative (
Percent).Setting this property will automatically set
verticalAlignto "none".NOTE: The position is relative to the chart container.
classPrefixType
stringA prefix that is applied to class names of various popup elements.
closableType
booleanIs popup closable?
If it is, it can be closed in a number of ways, e.g. by hitting ESC key, clicking curtain, or clicking the close button.
If it is not closable, the only way to close it is via
close()call.containerType
$type.Optional<HTMLElement|Document>A reference to an HTML element to be used for container. If not set, popup will cover the whole window.
contentType
stringPopup content.
Popup content can be any valid HTML, including CSS.
defaultStylesType
booleanDefaulttrueShould popup use default CSS?
If default CSS is disabled, an external CSS should handle the look of the popup, since it will look quite out of place otherwise.
draggableType
booleanDefaultfalseCan the popup be dragged with a pointer?
dynamicResizeType
booleanDefaulttrueSince 4.9.17Resize popup as images are being loaded.
elementsType { close:
HTMLElement, content:HTMLElement, curtain:HTMLElement, title:HTMLElement, wrapper:HTMLElement}Returns an object with references to various elements of the Popup.
wrappertitlecontentclosecurtain
leftType
number|Percent"left" coordinate of a non-aligned (
align = "none") popup.Can be either absolute pixel value, or relative (
Percent).Setting this property will automatically set
alignto "none".NOTE: The position is relative to the chart container.
readerTitleType
stringA title for screen readers. It is very highly recommended to set that title so that people using screen reader tools can get an immediate summary of the information in the popup.
rightType
number|Percent"right" coordinate of a non-aligned (
align = "none") popup.Can be either absolute pixel value, or relative (
Percent).Setting this property will automatically set
alignto "none".NOTE: The position is relative to the chart container.
showCurtainType
booleanDefaultfalseShould popup use dim out all content behind it?
spriteType
$type.Optional<Sprite>A parent element this Popup belongs to.
titleType
stringPopup title.
Popup title can be any valid HTML, including CSS.
topType
number|Percent"top" coordinate of a non-aligned (
verticalAlign = "none") popup.Can be either absolute pixel value, or relative (
Percent).Setting this property will automatically set
verticalAlignto "none".NOTE: The position is relative to the chart container.
verticalAlignType
VerticalAlignDefault"middle"Vertical positioning of the content window.
Available options: "top", "middle" (default), "bottom", and "none".
5 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.
eventsType
EventDispatcher<AMEvent<this,IBaseObjectEvents>>Inherited fromBaseObjectEventsAn
EventDispatcherinstanceidType
$type.Optional<string>Inherited fromBaseObjectSets the user-defined id of the element.
uidType
stringInherited fromBaseObjectReturns object's internal unique ID.
Methods
close()Returns
voidHides popup window.
constructor()Returns
PopupConstructor
copyFrom(source:this)Returns
voidCopies all properties and related data from different element.
dispose()Returns
voidDestroy (dispose) popup.
open()Returns
voidShows popup window.
5 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.
dispatch(eventType:Key,
data?:any)Returns
voidInherited fromBaseObjectEventsDispatches an event using own event dispatcher. Will automatically populate event data object with event type and target (this element).
It also checks if there are any handlers registered for this sepecific event.
dispatchImmediately(eventType:Key,
data?:any)Returns
voidInherited fromBaseObjectEventsWorks like
dispatch, except event is triggered immediately, without waiting for the next frame cycle.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
closedParam { type:
"closed", target:Popup}Invoked when Popup is closed.
openedParam { type:
"opened", target:Popup}Invoked when Popup is opened.
Adapters
alignParam
Optional<Align>Applied to horizontal alignment of the popup.
bottomParam
number|PercentApplied to
bottomposition value.classNamesParam { closeClass:
string, contentClass:string, curtainClass:string, headerClass:string, insideClass:string, titleClass:string, wrapperClass:string}Applied to class names list that are added as class for various popup elements.
classPrefixParam
stringApplied to the class prefixes.
closableParam
booleanApplied to
closableproperty before it is retrieved.contentParam
stringApplied to popup content before it is shown.
defaultStylesParam
booleanApplied to default
defaultStylesproperty before it is retrieved.draggableParam
booleanApplied to default
draggableproperty before it is retrieved.dynamicResizeParam
booleanApplied to
dynamicResizeproperty before it is retrieved.leftParam
number|PercentApplied to
leftposition value.readerTitleParam
stringApplied to the screen reader title.
rightParam
number|PercentApplied to
rightposition value.showCurtainParam
booleanApplied to default
showCurtainproperty before it is retrieved.titleParam
stringApplied to popup title before it is shown.
topParam
number|PercentApplied to
topposition value.verticalAlignParam
Optional<VerticalAlign>Applied to vertical alignment of the popup.