Skip to content

ExportMenu

Type class

Creates a menu for Export operations.

To add an export menu to a chart, set this to a new instance of ExportMenu.

chart.exporting.menu = new am4core.ExportMenu();
chart.exporting.menu = new am4core.ExportMenu();
{
  // ...
  "exporting": {
    "menu": {}
  }
}

Sources

ExportMenu can be used (imported) via one of the following packages.

/**
* Import from: "core.ts"
* Use like: am4core.ExportMenu
*/
import * as am4core from "@amcharts/amcharts4/core";

Inheritance

ExportMenu extends Validatable.

ExportMenu is not extended by any other symbol.

Properties

adapter

Type Adapter <ExportMenu, IExportMenuAdapters>Default new Adapter<ExportMenu, IExportMenuAdapters>(this)

An Adapter.

align

Type Align

A horizontal alignment for the menu placement.

classPrefix

Type stringDefault "amexport"

Class name prefix.

closeDelay

Type numberDefault 1000

How many milliseconds to hold menu/sub-menu open after it loses focus or hover, before auto-closing it.

closeOnClick

Type booleanDefault trueSince 4.2.2

Close the menu automatically when some export operation is triggered.

container

Type $type.Optional <HTMLElement>

An HTML container to place the Menu in.

A container must be an HTML element, because menu itself is HTML, and cannot be placed into SVG.

defaultStyles

Type booleanDefault true

Indicates whether ExportMenu should load external CSS to style itself.

If set to false, the menu will not be styled, and will rely on some external CSS.

element

Type $type.Optional <HTMLElement>Since 4.10.6

The main element o fthe menu - usually <ul>.

items

Type Array <IExportMenuItem>

A list of menu items. Can be nested.

language

Type Language

A Language instance.

tabindex

Type number

A tab index for the menu.

Tab index will influence the order in which elements on the chart and the whole page are selected when pressing TAB key.

tag

Type "ul" | "div"Default "ul"

Sets main menu tag to place menu in.

This also sets up how menu items are built.

If you set this to "ul", menu items will be wrapped into <li> tags.

If set to "div", menu items will be wrapped in <div> tags.

verticalAlign

Type VerticalAlign

A vertical alignment for the menu placement.

5 inherited items
clonedFrom

Type $type.Optional <this>Inherited from BaseObject

Reference 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.

config

Type objectInherited from BaseObject

Use 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.

events

Type EventDispatcher <AMEvent <this, IBaseObjectEvents>>Inherited from BaseObjectEvents

An EventDispatcher instance

id

Type $type.Optional <string>Inherited from BaseObject

Sets the user-defined id of the element.

uid

Type stringInherited from BaseObject

Returns object's internal unique ID.

Methods

constructor()

Returns ExportMenu

Constructor

dispose()

Returns void

Destroys the menu and all its elements.

draw()

Returns void

Draws the menu based on current items.

Normally, there's no need to call this explicitly. The chart, if it has export menu enabled, will automatically draw the menu.

hideBranch(branch: IExportMenuItem)

Returns void

Hides the whole branch of menu.

showBranch(branch: IExportMenuItem)

Returns void

Show the branch of menu.

6 inherited items
clone(cloneId?: string)

Returns thisInherited from BaseObject

Makes a copy of this object and returns the clone. Try to avoid cloning complex objects like chart, create new instances if you need them.

copyFrom(source: this)

Returns voidInherited from BaseObjectEvents

Copies all parameters from another Sprite.

dispatch(eventType: Key,
data?: any
)

Returns voidInherited from BaseObjectEvents

Dispatches 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 from BaseObjectEvents

Works like dispatch, except event is triggered immediately, without waiting for the next frame cycle.

getCurrentThemes()

Returns ITheme[]Inherited from BaseObject

Returns 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 from BaseObject

Returns if this object has been already been disposed.

Events

branchselected

Param { type: "branchselected", target: ExportMenu, branch: IExportMenuItem }

Invoked when menu branch is selected. (either by hover or keyboard)

branchunselected

Param { type: "branchunselected", target: ExportMenu, branch: IExportMenuItem }

Invoked when menu branch is unselected.

closed

Param { type: "closed", target: ExportMenu }

Invoked when menu is closed.

enter

Param { type: "enter", target: ExportMenu, branch: IExportMenuItem, event: KeyboardEvent }

Invoked when ENTER key is pressed when certain menu item is in focus.

hit

Param { type: "hit", target: ExportMenu, branch: IExportMenuItem, event: MouseEvent | TouchEvent }

Invoked when menu item is clicked/tapped.

out

Param { type: "out", target: ExportMenu, branch: IExportMenuItem, event: MouseEvent | TouchEvent }

Invoked when menu item is no longer hovered.

over

Param { type: "over", target: ExportMenu, branch: IExportMenuItem, event: MouseEvent | TouchEvent }

Invoked when menu item is hovered.

Adapters

align

Param { align: Align }

branch

Param { branch: IExportMenuItem, level: number }

classPrefix

Param { classPrefix: string }

closeOnClick

Param boolean

defaultStyles

Param { defaultStyles: boolean }

iconTag

Param { tag: string }

itemClass

Param { className: string, level: number, type: ... }

items

Param { items: Array <IExportMenuItem> }

itemTag

Param { tag: string }

labelClass

Param { className: string, level: number, type: ... }

labelTag

Param { tag: string }

Param { className: string, level: number }

Param { menuElement: HTMLElement }

Param { tag: string }

rederLabel

Param { branch: IExportMenuItem, label: string }

tabindex

Param { tabindex: number }

verticalAlign

Param { verticalAlign: VerticalAlign }