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";

/**
 * --------------------------------------------------------
 * Include via: <script src="core.js"></script>
 * Access items like: am4.ExportMenu
 * --------------------------------------------------------
 */

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 string

Default "amexport"

Class name prefix.

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.

closeDelay
#

Type number

Default 1000

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

closeOnClick
#

Type boolean

Default true

Close the menu automatically when some export operation is triggered.

@since 4.2.2

config
#

Type object

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

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.

@todo Check if menu is already build. If it is, just move it to a new container

defaultStyles
#

Type boolean

Default 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 >

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

@since 4.10.6

events
#

Type EventDispatcher < AMEvent < this, IExportMenuEvents > >

Inherited from BaseObjectEvents

An EventDispatcher instance

id
#

Type $type.Optional < string >

Inherited from BaseObject

Sets the user-defined id of the element.

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.

uid
#

Type string

Inherited from BaseObject

Returns object's internal unique ID.

verticalAlign
#

Type VerticalAlign

A vertical alignment for the menu placement.

There are 5 inherited items currently hidden from this list.

Methods

clone(

cloneId?: string

)

#

Returns this

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

constructor()

#

Returns ExportMenu

Constructor

copyFrom(

source: this

)

#

Returns void

Inherited from BaseObjectEvents

Copies all parameters from another Sprite.

dispatch(

eventType: Key,
data?: any

)

#

Returns void

Inherited 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 void

Inherited from BaseObjectEvents

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

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.

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.

hideBranch(

branch: IExportMenuItem

)

#

Returns void

Hides the whole branch of menu.

isDisposed()

#

Returns boolean

Inherited from BaseObject

Returns if this object has been already been disposed.

showBranch(

branch: IExportMenuItem

)

#

Returns void

Show the branch of menu.

There are 6 inherited items currently hidden from this list.

Events

#branchselected

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

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

#branchunselected

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

Invoked when menu branch is unselected.

#closed

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

Invoked when menu is closed.

#enter

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

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

#hit

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

Invoked when menu item is clicked/tapped.

#out

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

Invoked when menu item is no longer hovered.

#over

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

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: ... }

#itemTag

Param { tag: string }

#items

Param { items: Array < IExportMenuItem > }

#labelClass

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

#labelTag

Param { tag: string }

#menuClass

Param { className: string,
  level: number }

#menuElement

Param { menuElement: HTMLElement }

#menuTag

Param { tag: string }

#rederLabel

Param { branch: IExportMenuItem,
  label: string }

#tabindex

Param { tabindex: number }

#verticalAlign

Param { verticalAlign: VerticalAlign }