Instance

Type module

Sources

Items from Instance can be imported/included and used via following ways.

/**
 * --------------------------------------------------------
 * Import via: Instance.ts
 * Access items like: $instance.myVariable
 *                    $instance.myFunction()
 * --------------------------------------------------------
 */
import * as $instance from "@amcharts/amcharts4/Instance";

Variables

Instance does not have any variables.

Functions

viewPortHandler(

sprite: Sprite

)

#

Returns void

useTheme(

value: ITheme

)

#

Returns void

Applies a theme to System, and subsequently all chart instances created from that point forward.

amCharts supports multiple themes. Calling useTheme multiple times will make the System apply multiple themes, rather than overwrite previously set one.

This enables combining features from multiple themes on the same chart.

E.g.:

am4core.useTheme(am4themes.material);
am4core.useTheme(am4themes.animated);
am4core.useTheme(am4themes.material);
am4core.useTheme(am4themes.animated);

The above will apply both the Material color and animation options to all charts created.

unuseTheme(

value: ITheme

)

#

Returns void

Removes a theme from "active themes" list, so it won't get applied to any charts created subsequently.

unuseAllThemes()

#

Returns void

Removes all "active" themes. Any charts created subsequently will not have any theme applied to them.

removeFromQueue(

sprite: Sprite

)

#

Returns void

queueHandler(

sprite: Sprite

)

#

Returns void

disposeAllCharts()

#

Returns void

Disposes all of the currently active charts.

createFromConfig(

config: object,
htmlElement?: string | HTMLElement,
classType?: object | string

)

#

Returns Sprite

A shortcut to creating a chart from a config object.

Example:

let chart am4core.createFromConfig({ ... }, "chartdiv", am4charts.XYChart );
var chart am4core.createFromConfig({ ... }, "chartdiv", "XYChart" );

If chartType parameter is not supplied it must be set in a config object, via reference to chart type, e.g.:

{
  "type": am4charts.XYChart,
  // ...
}
{
  "type": am4charts.XYChart,
  // ...
}

Or via string: (if you are using JavaScript)

{
  "type": "XYChart",
  // ...
}
{
  "type": "XYChart",
  // ...
}

A container can either be a reference to an HTML container to put chart in, or it's unique id.

If container is not specified, it must be included in the config object:

{
  "type": "XYChart",
  "container": "chartdiv",
  // ...
}
{
  "type": "XYChart",
  "container": "chartdiv",
  // ...
}

@todo Throw exception if type is not correct

create(

htmlElement: $type.Optional < HTMLElement | string > ,
classType: object

)

#

Returns T

A shortcut to creating a chart instance.

The first argument is either a reference to or an id of a DOM element to be used as a container for the chart.

The second argument is the type reference of the chart type. (for plain JavaScript users this can also be a string indicating chart type)

let chart = am4core.create("chartdiv", am4charts.PieChart);
// Can pass in chart type reference like this:
var chart = am4core.create("chartdiv", am4charts.PieChart);

// ... or chart class type as a string:
var chart = am4core.create("chartdiv", "PieChart");

addToQueue(

sprite: Sprite

)

#

Returns void

addLicense(

license: string

)

#

Returns void

Adds a license, e.g.:

am4core.addLicense("xxxxxxxx");
am4core.addLicense("xxxxxxxx");

Multiple licenses can be added to cover for multiple products.

@since 4.5.16