Use amCharts 4 in Ember in a declarative way.
- Dynamic (lazy) imports
- Declarative interface using contextual components
- Close to original amCharts API
- Ember.js v3.13 or above
- Ember CLI v2.13 or above
- Node.js v10 or above
ember install ember-amcharts
Creates the amChart.
Properties:
chartType
: Name of chart type class (e.g.PieChart
,XYChart
, …)initialConfig
: Object containing JSON-based config. This is only used during construction or when the chart type changes, but otherwise updates will have no effect.themes
: Optional. List of themes
Yields hash(once the chart loaded):
instance
: amChart chart instanceam4core
: am4core moduleam4charts
: am4charts moduleproperty
:AmChartProperty
as contextual component (settingobj
)on
:AmChartOn
as contextual component (settingobj
)call
:AmChartCall
as contextual component (settingobj
)push
:AmChartPush
as contextual component (settingobj
)adapter
:AmChartAdapter
as contextual component (settingobj
)
Manages property value, e.g.
translates to the following amChart code:
chart.responsive.enabled = true;
When the component is removed from the template it will restore the original state by disposing the given value or setting the original value again.
Properties:
obj
: Container objproperty
: Path to property to setvalue
: Value to set
Limitations:
- While changes to
obj
,property
andvalue
will be correctly applied, only the value at the original combinationobj
/property
is restored upon component destruction.
Registers action to an event dispatcher.
translates to the following amChart code:
series.columns.template.events.on("hit", function(ev) { … })
Properties:
obj
: Container objproperty
: Path to property with event dispatcherevent
: Event nameaction
: Event handleronce
: Optional. Boolean indicating whether to subscribe toon
(default) or toonce
.
Calls function. Parameter updates will cause the function to be called again.
translates to
chart.exporting.export("png");
Parameters:
obj
: Container objfunc
: Path to functionparams
: List of positional parameters
Yields:
- return value of function call
Pushes value into list. Tries to dispose its work upon recomputation with changed obj
/property
params or upon destruction.
Parameters:
obj
: container objproperty
: Path to arrayvalue
: Value to push into array
Yields hash:
value
: Return value ofpush
(amChart'spush
returns the value pushed)property
:AmChartProperty
as contextual component (settingobj
)on
:AmChartOn
as contextual component (settingobj
)call
:AmChartCall
as contextual component (settingobj
)push
:AmChartPush
as contextual component (settingobj
)adapter
:AmChartAdapter
as contextual component (settingobj
)
Adds (and removes) adapter functions.
translates to
axis.renderer.labels.template.adapter.add("text", function(label, target, key) { … })
Parameters:
obj
: container objproperty
: Path to propertyadapter
: adapter name/identifieraction
: Function to modify the valuepriority
: Priority of the adapterscope
: Scope the function will be called in
Imports (dynamic import) amChart theme for usage in AmChart
component. Takes name of theme as single positional parameter.
Creates new instance of specified class. Takes positional parameters container
, name
. Additional positional parameters are applied to constructor.
To avoid having to bundling every locale a blueprint is provided to aid with dynamic importing of amChart locales:
ember generate am-chart-locale-importer fr_FR de_DE en_US
will generate a helper named am-chart-locale
to be used like this:
For a list of all all locales bundled with amCharts check here.
See the Contributing guide for details.
This project is licensed under the MIT License.