Skip to content

The Aktive Instance

The Aktive object represents a query or a visualization. We can have control of them all the time through the getAllVisualizations() method from the cf object as explained here. From this object we can control all the aspects of a visualization or query by setting or modifying options, parameters and more.

As soon as we use cf.create() or cf.provider() a new Aktive instance will be registered.

This object has a lot of methods available and you've probably seen most of them in the Quick Start or in the demos.

Most of these methods can be chained since they return the same Aktive instance. Let's take a look on some of them.


Sets a provider to the Aktive instance. The provider name must exists. Can be chained.


Set a name or id to the query so it can be identified at any time and be re-used. Check the multiple queries section for more information. Can be chained.


Returns an option or configuration matching the string paratemer passed. If no parameter is specified it returns the full current object configuration. Returns an JSON object so it can not be chained.

let conf = chart.get('config');
let aql = chart.get('aql');
let color = chart.get('color');
let fullConf = chart.get();

set(option, config)

Sets a configuration to the aktive object. It's usually used at declaration time, but some other options can be set after the aktive instance is executed. Check here for information about the available options. Can be chained.


Sets a source matching the name passed as parameter. The source must exist in the data provider. Can be chained.


Indicates what type of visualization to use. Check here for a full list of supported visualizations. This method is not required if we only need the data and not a visualization to be rendered. Can be chained.


Specifies the HTML element to be used as the container for the visualization. This method is also used as the main identifier of the Aktive object so it is required. If we only need the query (no visual to be rendered) we must specify any string or identifier. We can later get this instance by using cf.getVisualization(id). Can be chained.


Sets the fields or groups to aggregate by. It may receive several Attribute objects or an array of them. Can be chained.


Used only by the Time Slider and the Time Range Filter. Sets the time field to be used by the visualization. Receives an Attribute object. Can be chained.


Sets the metrics to be used. It may receive several Metric objects or an array of them. Can be chained.


Sets the fields to be used to create a raw query. Usually used with the Raw Data Table. It may receive several Field objects or an array of them. Can also receive several strings representing the names of the fields. If no fields are specified, all fields will be returned. Can be chained.


Sets server filters to the visualization. It replaces existing filters. It may receive several Filter objects or an array of them. Can be chained.


Adds one server filter to the visualization. Receives one Filter object. Can be chained.


Sets persistent server filters to the visualization. These filters are meant to be set only at declaration time and they are unmutable, so they can not be removed or modified. It may receive several Filter objects or an array of them. Can be chained.


Sets client filters to the visualization. It may receive several Filter objects or an array of them. For the visualization to take effect it has to be executed again. Can be chained.


Removes the filters passed as paramenter. It receives several strings representing the field name of the filter to be removed. It removes filters and client filters. It does not remove static filters. Can be chained.


Specifies the limit of a query or visualization. It receives a number as a paramenter. Can be chained.


Injects data to the visualization. This is only used when working with Custom Data. Can be chained.


This is the method that performs the query and renders the visualization (if any). Until this method is not called for an Aktive instance nothing will happen and the object will be inactive. Returns a Javascript promise that, when resolved, will contain the data (if any) queried.

on(event, callback)

Creates a listener for the event name passed as parameter using the callback function. Please refer to the events section for more information about them. Can be chained.

once(event, callback)

Same as .on() but the event will be catched only once and then the listener will be deleted.

off(event, callback)

Removes an event listeners. To be succesfully removed the callback has to be exactly the same function (same variable, which means same memory address) when it was created.


Resizes the visualization (if any). Usually used under a resize event like for example windows.resize

$(window).on('resize', function () {


Deletes the Aktive object. It will be also unregistered from the cf object. Cannot be chained.


Duplicates the Aktive object. The new object has the same configuration but a new element id must be assigned. Returns the copy.

getFields(type, subtype)

Returns the fields from the source used in the visualization or query matching the type: attributes or metrics and the subtype: 'ATTRIBUTE', 'TIME', 'NUMBER', 'MONEY', 'INTEGER', 'PERCENT'. If not type or subtype are specified all fields will be returned.

let timeFields = aktive.getFields('attribute', 'TIME');
let percentFields = aktive.getFields('metrics', 'PERCENT');
let metrics = aktive.getFields('metrics');
let allFields = aktive.getFields();


Returns the provider object used in the visualization. Depends on the data provider used.