1. Go to this page and download the library: Download aldeebhasan/fast-bi library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
aldeebhasan / fast-bi example snippets
use Aldeebhasan\FastBi\Manager\Dimensions;
Dimensions::string('dimension-1',[1,2,4])->build();
Dimensions::number('dimension-2',[1,2,4])->build();
Dimensions::dateTime('dimension-3',['2023-5-5', '2024-6-6'])->build();
// to retrieve the dimension data you can use the `getData()` function.
$dimension = Dimensions::string('dimension-1',[1,2,4])->build();
print($dimension->getData())
//result = ["1","2","4"]//
use Aldeebhasan\FastBi\Manager\Metrics;
Metrics::sum('metric-1',[1,2,3])->build();
Metrics::max('metric-2',[1,2,3])->build();
Metrics::min('metric-3',[1,2,3])->build();
Metrics::median('metric-4',[1,2,3])->build();
Metrics::avg('metric-5',[1,2,3])->build();
// to retrieve the metric data you can use the `getData()` function.
$metric = Metrics::sum('metric-1',[1,2,3])->build();
print($metric->getData())
//result = 6//
use Aldeebhasan\FastBi\Manager\{Metrics,Dimensions,Widgets};
Widgets::barChart('profits')
->labels(['2016', '2017', '2018'])
->dimensions([
Dimensions::number('pos-invoices',[100,200,300]),
'store-invoices'=>[150,110,250],
Dimensions::number('extra',[10,20,30]),
])->metrics([
Metrics::sum('total',[100,200,300]),
'max-income'=>Metrics::max('avg',[100,200,300]),
'min-income'=>Metrics::min('avg',[100,200,300])
])->render()
//To make the bar chart horizontal, you can just add the following settings to the widget:
Widgets::barChart('profits')
->labels(['2016', '2017', '2018'])
->settings(['direction'=>'y']) //// make the y axis as the base
->dimensions([
Dimensions::number('pos-invoices',[100,200,300]),
'store-invoices'=>[150,110,250],
Dimensions::number('extra',[10,20,30]),
])->metrics([
Metrics::sum('total',[100,200,300]),
'max-income'=>Metrics::max('avg',[100,200,300]),
'min-income'=>Metrics::min('avg',[100,200,300])
])->render()
use Aldeebhasan\FastBi\Manager\{Metrics,Dimensions,Widgets};
Widgets::pieChart('profits')
->labels(['2016', '2017', '2018'])
->dimensions([
Dimensions::number('pos-invoices',[100,200,300]),
'store-invoices'=>[150,110,250],
Dimensions::number('extra',[10,20,30]),
])->render()
Widgets::pieChart('profits of pos')
->labels(['2016', '2017', '2018'])
->dimensions([
Dimensions::number('pos-invoices',[100,200,300]),
])->render()
use Aldeebhasan\FastBi\Manager\{Metrics,Dimensions,Widgets};
Widgets::doughnutChart('profits')
->labels(['2016', '2017', '2018'])
->dimensions([
Dimensions::number('pos-invoices',[100,200,300]),
'store-invoices'=>[150,110,250],
Dimensions::number('extra',[10,20,30]),
])->render()
Widgets::doughnutChart('profits of pos')
->labels(['2016', '2017', '2018'])
->dimensions([
Dimensions::number('pos-invoices',[100,200,300]),
])->render()
use Aldeebhasan\FastBi\Manager\{Metrics,Dimensions,Widgets};
Widgets::scatterChart('profits')
->labels(['POS To Store','POS to Extra'])
->dimensions([
Dimensions::number('pos-invoices',[100,110,120,130,140,160,200,250]),
Dimensions::number('store-invoices',[100,200,300,210,300,400,450,600]),
Dimensions::number('extra',[10,20,30,80,90,150,200,250]),
])->render()
Widgets::bubbleChart('bubbles profits')
->labels(['POS To Store','POS to Extra'])
->dimensions([
Dimensions::number('pos-invoices',[100,110,120,130,140,160,200,250]),
Dimensions::number('store-invoices',[100,200,300,210,300,400,450,600]),
Dimensions::number('extra',[10,20,30,80,90,150,200,250]),
])->render()