0.0.1 • Published 6 years ago

jscube v0.0.1

Weekly downloads
4
License
-
Repository
-
Last release
6 years ago

cubejs

OLAP Cube data manipulation

Project page

usage

npm install cubejs
import CubeJS from 'cubejs';

let definition = {
    rows: {
        'dm_dimension1': {type:'dimension'}
    },
    cols: {
        'dm_dimension2': {type:'dimension'},
        'measure1':  {type:'measure'}
    }
}

// instance
let cube = new CubeJS({
    definition: definition,
    dataAdapter: ElasticAdapter
});

// add operations
cube.addOperation('op1', 'totalRow', {label:'Total'});
cube.addOperation('op2', 'totalCol', {label:'Total'});
// cube.addOperation('op3', 'calculatedCol', {
//     label:'Custom',
//     reference: '1º bpm',
//     position: 'after',
//     expression(x, y, Functions, cubeJS){
//         let v = (Functions.CELL.apply(cubeJS, [x, '1º bpm$qtd_armas']));
//         return v * 2;
//     }

// });

// set data
cube.setData(dadosResult);

// render 
cube.plugin('html.table')
    .renderTo(document.getElementById('table'));

cube.plugin(`plotly.${type}`)
    .renderTo(document.getElementById('chart'));

clone

git clone https://github.com/fabionogueira/cubejs cubejs
npm start
0.0.1

6 years ago