EditorLauncher
Type class
Main class to control amCharts 4 Editor in a bigger solution.
There are 4 essential steps needed to use the Editor in your app (make sure you read the setup guide too):
Create and instance of
EditorLauncher;Add event listeners for
saveandcloseevents;Set editor configuration;
Launch the editor.
Here's how this would look in code:
// import Editor Launcher
import * as am4editor from '@amcharts/editor4';
// instantiate launcher
let launcher = new am4editor.EditorLauncher();
// add event listeners
launcher.addEventListener('save', renderChart);
launcher.addEventListener('close', () => {
if (this.launcher) {
this.launcher.close();
}
});
// set config
launcher.editorConfig = editorConfig;
// launch
launcher.launch();
More info: amCharts Editor 4 Architecture, Installation, and Usage
More info: IConfig - editor configuration
More info: ILauncherConfig - launcher configuration
More info: LauncherEventHandler - launcher event handler type
Sources
EditorLauncher can be used (imported) via one of the following packages.
/** * Import from: "editor.ts" * Use like: am4editor.EditorLauncher */import * as am4editor from "@amcharts/editor4";/** * Include via: <script src="editor.js"></script> * Access items like: am4editor.EditorLauncher */Inheritance
EditorLauncher does not extend any other symbol.
EditorLauncher is not extended by any other symbol.
Properties
editorConfigType
IConfigEditor configuration settings.
Configure various aspects of the Editor look, feel, and behavior via these settings.
More info:
IConfigeditorUrlType
stringURI for the editor application.
By default Editor application is expected to be under
/am4editor/.Set this property to a new location, in case you've changed the default folder structure.
targetType
ILauncherTargetSet this to control how to open the editor window.
When you call the
launch()method, it opens the Editor based on this setting.The Editor can open in an
inlinepopup or a new browser window/tab.Additionally, you can make it open inside a particular element (usually a DIV) on your page.
More info:
ILauncherTarget
Methods
addEventListener(eventType:LauncherEventType,
listener:LauncherEventHandler)Returns
voidAdd an event listener for Launcher events ('save' or 'close')
// add event listeners launcher.addEventListener('save', renderChart); launcher.addEventListener('close', () => { if (this.launcher) { this.launcher.close(); } });addLicense(editorLicense:string)Returns
voidSets editor license number
close()Returns
voidCloses the Editor window.
constructor(launcherConfig?:ILauncherConfig)Returns
EditorLauncherCreates an instance of EditorLauncher.
launch(chartConfig?:object)Returns
voidLaunches amCharts 4 Editor.
You can pass a chart configuration object for editing.
Creates a new chart otherwise.
removeEventListener(eventType:LauncherEventType,
listener:LauncherEventHandler)Returns
voidRemove an event listener for Launcher events.
Events
EditorLauncher does not have any events.