Skip to content

Zoomdata

The Zoomdata data provider allows ChartFactor to interact with Zoomdata through its WebSocket and HTTP APIs. Internally, it takes advantage of the Zoomdata Query API to perform all aggregation requests.

The Zoomdata data provider supports Zoomdata version 2.6.

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

The Provider JSON object requires the url and OAuthOptions parameters in addition to name and provider. Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
var providers = [{
    name:'Zoomdata',
    provider:'zoomdata',
    url:'https://prototype.zoomdata.com',
    OAuthOptions: {
        auth_uri:'https://prototype.zoomdata.com/zoomdata/oauth/authorize',
        redirect_uri:'https://chartfactor.com:3000/',
        client_id:'QWt0aXVuIERlbW8xNTAzNjY4NjkwNzI0MzRmODViOGYtZGFjNS00MDFiLWJhNDItZDkyNmI4NGFkZGRm',
        scope:['read']
    }
}]

The OAuthOptions fields

  • auth_uri: The Zoomdata endpoint for OAuth authorization
  • redirect_uri: The resource that should load after successful OAuth authentication
  • client_id: The ID obtained from Zoomdata when registering your OAuth client
  • scope: Use “read” for this parameter

Please refer to the Zoomdata documentation for details on how it implements its OAuth workflow and how to register OAuth clients to obtain a client ID.

Supported Aggregations Out-Of-The-Box

SUM

1
    var metric = cf.Metric("amount","sum");

AVG

1
    var metric = cf.Metric("amount","avg");

MIN

1
    var metric = cf.Metric("amount","min");

MAX

1
    var metric = cf.Metric("amount","max");

COUNT DISTINCT

It supports this aggregation by using calc fields.

CALC

It allows invoking a Zoomdata-defined calculation. Example:

1
    var metric = cf.Metric("calc_my_special_calc","calc");

The first parameter of the cf.Metric() function is the name of your Zoomdata calculation, prefixed with “calc_”. The second parameter, “calc”, is a constant to indicate this is invoking a calculation.

Refer to the Zoomdata documentation for details on how to create calculations in Zoomdata.

Dependencies

  • zoomdata-client.js