Type class
Responsive is responsible for overriding certain properties when conditions are met.
This class is used to dynamically apply and change certain chart properties based on the current values of properties.
Mainly, this is used with Sprite
's dimensional properties, like pixelWidth
and pixelHeight
. However, it can be used to dynamically change any property, based on any other property's value.
A default responsive rules are disabled.
To enable, set enabled = false
. E.g.:
chart.responsive.enabled = true;
chart.responsive.enabled = true;
IResponsiveEvents
for a list of available events
IResponsiveAdapters
for a list of available Adapters
@todo Add default rules
@todo Watch for rule modification
Sources
Responsive can be used (imported) via one of the following packages.
/** * -------------------------------------------------------- * Import from: "core.ts" * Use like: am4core.Responsive * -------------------------------------------------------- */ import * as am4core from "@amcharts/amcharts4/core";
/** * -------------------------------------------------------- * Include via: <script src="core.js"></script> * Access items like: am4.Responsive * -------------------------------------------------------- */
Inheritance
Responsive extends BaseObjectEvents
.
Responsive is not extended by any other symbol.
Properties
adapter # |
Type Default Adapter. |
---|---|
allRules # |
Type Returns all rules: default rules (if not disabled) combined with user-defined ones. @readonly |
clonedFrom # |
Type Inherited from 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. |
component # |
Type A target object that responsive rules will need to be applied to. |
config # |
Type Inherited from 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. |
defaultRules # |
Type Default responsive rules. @readonly |
enabled # |
Type Default Should responsive rules be checked against and applied? |
events # |
Type Inherited from An |
id # |
Type Inherited from Sets the user-defined id of the element. |
rules # |
Type User-defined responsive rules. User-defined rules will take precedence over default rules whenever they produce conflicting settings. Use |
uid # |
Type Inherited from Returns object's internal unique ID. |
useDefault # |
Type Default Should default responsive rules be applied in addition to user-defined ones. User-defined rules will take precedence over default rules whenever they produce conflicting settings. |
There are 5 inherited items currently hidden from this list. |
Methods
clone( cloneId?: ) |
Returns Inherited from 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 Constructor |
copyFrom( source: ) |
Returns Inherited from Copies all parameters from another |
dispatch( eventType: ) |
Returns Inherited from 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: ) |
Returns Inherited from Works like |
dispose() |
Returns Disposes the object. |
getCurrentThemes() |
Returns Inherited from 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 Inherited from Returns if this object has been already been disposed. |
There are 6 inherited items currently hidden from this list. |
Events
#ruleapplied |
Param { rule: Invoked after each rule is applied to the actual element. |
---|---|
#ruleschanged |
Param { type: Invoked when a list of applicable rules for the current resolution changes. |
Adapters
#allRules |
Param A list of all rules - user-defined and default combined. |
---|---|
#defaultRules |
Param A list of default rules. |
#enabled |
Param Are responsive features enabled? |
#rules |
Param A list of user-defined rules. |
#useDefault |
Param Use default rules? If this is set |