Skip to content

Introduction to Data Providers

A data provider is the interface between ChartFactor and the source of your data (ie: Spark, Elasticsearch or any other analytics engine). It will translate the ChartFactor AQL options into the specific language of the engine and then it will query it. Afterwards, it will receive and translate the incoming response back to the proper ChartFactor data structures needed to populate visualizations. A data provider is programmed based on the data engine it supports. If you plan to query data from different analytics engines, you need one provider for each.

ChartFactor implements an extensible modular architecture for data providers. Out of the box, ChartFactor includes several data providers as Javascript modules that must be included with a script tag in your html page.

The first step when creating your data application is to include the provider you’re going to use in the html file of the application.

1
 <script src="./Data-provider.min.js"></script>

This script tag can be included after or before the “CFToolkit” library. This is because they are not strictly dependant. The provider’s library will create a standalone global object that will be used by ChartFactor only when we define it.

The next step is to define your data providers in your Javascript code. A data provider is described by a simple JSON object that includes the following properties:

name: The name you want to use for your data provider within your data application

provider: The data provider type, which also happen to be the name of the global object. Examples are: sparksql, google-bigquery, elasticsearch, etc .

Additional properties exist, depending on the specific data provider.

Finally, use the global cf object to inform ChartFactor of your providers. Example:

1
2
3
4
5
6
7
    var providers = [{
        name:'ElasticSearch',
        provider:'elasticsearch', 
        url:'https://chartfactor.com:9200'
    }]

    cf.setProviders(providers);

Out of the box data providers are described individually in the following sections.