rekalogika / analytics-ux-panel
User interface for modifying the parameters of a pivot table.
Package info
github.com/rekalogika/analytics-ux-panel
Type:symfony-bundle
pkg:composer/rekalogika/analytics-ux-panel
Fund package maintenance!
Requires
- php: ^8.2
- doctrine/collections: ^2.2 || ^3.0
- doctrine/persistence: ^3.1 || ^4.0
- psr/container: ^2.0
- rekalogika/analytics-bundle: ^0.40
- rekalogika/analytics-core: ^0.40
- symfony/dependency-injection: ^6.4 || ^7.0 || ^8.0
- symfony/http-kernel: ^6.4 || ^7.0 || ^8.0
- symfony/stimulus-bundle: ^2.9 || ^3.0
- symfony/translation-contracts: ^3
- twig/twig: ^3.15 || ^4.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-04 12:01:56 UTC
README
A Symfony UX user interface for Rekalogika Analytics. Lets users modify the parameters of a pivot table interactively: choosing the dimensions for the rows and columns, the measures to show, and the filters to apply.
Warning
This package is still in development and not yet ready for production use. The API is subject to change.
What's Inside
PivotAwareQueryFactory. Creates aPivotAwareQueryfrom a query and the parameters submitted by the panel. APivotAwareQueryknows which dimensions go to the rows and columns, and which measures are selected.- The
analytics_render_control()Twig function. Renders the panel. - Filters. Choice, date range, and number ranges filters. The filter for
each dimension is determined by
FilterResolverservices. Enum dimensions get a choice filter out of the box, and you can implement your ownFilterResolverfor other types. - Stimulus controllers. Drag and drop for arranging dimensions and measures, and controllers for the filters, built on SortableJS, Tom Select, flatpickr, and Tippy.js.
Requirements
rekalogika/analytics-bundle- Symfony StimulusBundle, with AssetMapper or Webpack Encore
- Turbo, as the panel uses Turbo Frames and Turbo Streams to update the output
Installation
composer require rekalogika/analytics-ux-panel
If you don't use Symfony Flex, register the bundle manually:
// config/bundles.php return [ // ... Rekalogika\Analytics\UX\PanelBundle\RekalogikaPanelBundle::class => ['all' => true], ];
With AssetMapper, install the JavaScript dependencies:
php bin/console importmap:install
Usage
In the controller, create a PivotAwareQuery from the parameters sent by the
panel, then execute it and render the result, for example using
rekalogika/analytics-frontend:
use Rekalogika\Analytics\Contracts\SummaryManager; use Rekalogika\Analytics\Frontend\Html\TableRenderer; use Rekalogika\Analytics\UX\PanelBundle\PivotAwareQueryFactory; use Symfony\Component\HttpKernel\Attribute\MapQueryParameter; #[Route('/orders')] public function orders( #[MapQueryParameter()] ?string $parameters, SummaryManager $summaryManager, PivotAwareQueryFactory $pivotAwareQueryFactory, TableRenderer $tableRenderer, ): Response { $parameters = json_decode($parameters ?? '[]', true); $query = $summaryManager->createQuery()->from(OrderSummary::class); $query = $pivotAwareQueryFactory->createFromParameters($query, $parameters); $pivotTable = $tableRenderer->renderPivotTable( cube: $query->getResult(), measures: $query->getValues(), rows: $query->getRows(), columns: $query->getColumns(), ); return $this->render('orders.html.twig', [ 'query' => $query, 'pivotTable' => $pivotTable, ]); }
In the template, render the panel and a target element for the output:
{{ analytics_render_control(
query: query,
output: pivotTable,
target: 'pivottable',
urlParameter: 'parameters',
) }}
<turbo-frame id="pivottable"></turbo-frame>
When the user changes the panel, the parameters are stored in the
parameters URL query parameter, and the output is updated in the pivottable
element.
Documentation
License
MIT
Contributing
This framework consists of multiple repositories split from a monorepo. Be
sure to submit issues and pull requests to the
rekalogika/analytics monorepo.