Cube JavaScript Client
The client provides methods to solve common tasks: Abstract from the transport and query data. You can fetch data from Cube Backend or subscribe to real-time updates regardless of the protocol, be it HTTP or WebSockets. Transform data for visualization. You can pivot the result set to display as a chart or as a table, split into series or table columns. Simplify work with complex query types. You can build drill down queries and decompose the results of compare date range queries or data blending queries. Learn more in the documentation for the@cubejs-client/core package.
Cube Angular Package
The package provides convenient tools to work with Cube in Angular: Modules. InjectCubeClientModule and CubeClient into your
components and services to get access to @cubejs-client/core API.
Subjects. Use RxJS Subject and
query to watch changes.
Example Usage
Here are the typical steps to query and visualize analytical data in Angular:- Import
@cubejs-client/coreand@cubejs-client/ngxpackages. These packages provide all the necessary methods and convenient Angular tools. - Create an instance of Cube JavaScript Client. The client is initialized
with Cube API URL. In development mode, the default URL is
http://localhost:4000/cubejs-api/v1.
The client is also initialized with an API token, but it
takes effect only in production: with
NODE_ENVunset the API accepts requests with no token, and development mode bypasses authentication outright, so both are intended for local development machines only. - Query data from Cube Backend and Transform data for visualization. Use
CubeClientto load data. The client accepts a query, which is a plain JavaScript object. See Query Format for details. - Visualize the data. Use tools of your choice to draw charts and create visualizations.