babbage.ui
A set of view components to visualise data returned by a Babbage API.
Quick start
Install from npm, and use in your app. See the docs, and below, for more information.
The library provides a DSL, query frontend and visualisation functions running against the Babbage Analytical Engine API. The intent is to make a re-usable set of angular-based front-end components for business intelligence.
Usage
angular
application
Preparing your There are two ways to use angular
bindings in your application:
require
components from/src/bindings/*
(ES2016 code) or from/lib/bindings/*
(compiled sources) directory;- add
/dist/babbage-*.js
or/dist/babbage-*.min.js
file to html page. Important note: ensure thatc3
,d3
andjQuery
objects are available in global scope. They are marked as external to allow extending them. Also see notes for some visualizations.
Then you should initialize library components, in example:
// This two lines should be used only with CommonJS code;// when using webpack bundles - angular and Babbage will be available// in global scopevar angular = ;var Babbage = ; var pieDirective = ;var chartDirective = ;var treeMapDirective = ;var bubbleTreeDirective = ;var tableDirective = ;var geoViewDirective = ;var pivotTableDirective = ;var factsDirective = ;var sankeyDirective = ; var module = angular; pieDirective;chartDirective;treeMapDirective;tableDirective;bubbleTreeDirective;geoViewDirective;pivotTableDirective;factsDirective;sankeyDirective;
angular
bindings
Using Common parameters for each visualization:
aggregates
- string; single key of measure.filter
- array of strings; each string should contain key of dimension and filter value, separated by pipe|
.order
- array of objects; each object should havekey
(key of measure or dimension) anddirection
fields. Possible values fordirection
areasc
anddesc
.
Other visualizations may require other additional parameters.
Treemap, BubbleTree, Facts, Table, Map components and charts
Additional required fields:
group
- array of strings - keys of dimensions to group by.
Important notes:
- BubbleTree requires bubbletree library (take care about its dependencies too).
- TreeMap and Map visualizations require d3 library.
- All charts require c3 library.
Pivot Table
Additional required fields:
rows
- array of strings - keys of dimensions to use as rows.cols
- array of strings - keys of dimensions to use as columns.
Sankey
Additional required fields:
source
- string - key of dimension to use as source (left nodes on graph).target
- string - key of dimension to use as target (right nodes on graph).
Important note: this visualization requires sankey plugin for d3.
Example
Clone the repository and open index.html
to see babbage
in action, no pre-config required.
Dev installation
- Dev tool installation with npm:
npm install
(seepackage.json
). - Compile library sources using
npm run build:lib
. - Use
npm run build:dist
ornpm run build:dist:min
to createwebpack
bundles for each binding. Also usenpm run build
to completely rebuild the library. - Run tests with
npm test
. - Check code style with
npm run review
. Runnpm run fix
to check code style and automatically fix errors.