badpixxel / widgets-d3js-bundle
BadPixxel Widgets D3.js Charts Integration
Package info
gitlab.com/badpixxel-public/widgets-d3-bundle
Type:symfony-bundle
pkg:composer/badpixxel/widgets-d3js-bundle
Requires
- php: ^8.1
- ext-json: *
- badpixxel/widgets-bundle: ^3.0
Requires (Dev)
- ext-curl: *
- badpixxel/php-sdk: ^3.0@dev
- phpunit/phpunit: ^10.5|^11.0
- sonata-project/admin-bundle: ^4.0
- sonata-project/block-bundle: ^4.0|^5.0
- symfony/browser-kit: ^6.4|^7.0|^8.0
- symfony/css-selector: ^6.4|^7.0|^8.0
- symfony/debug-bundle: ^6.4|^7.0|^8.0
- symfony/dotenv: ^6.4|^7.0|^8.0
- symfony/flex: ^1.0|^2.0
- symfony/monolog-bundle: ^2.0|^3.0|^4.0
- symfony/phpunit-bridge: ^6.4|^7.0|^8.0
- symfony/runtime: ^6.4|^7.0|^8.0
- symfony/twig-bridge: ^6.4|^7.0|^8.0
- symfony/web-profiler-bundle: ^6.4|^7.0|^8.0
- symfony/yaml: ^6.4|^7.0|^8.0
- twig/extra-bundle: ^2.12|^3.0
- twig/twig: ^2.12|^3.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-17 11:21:29 UTC
README
D3.js diagrams for BadPixxel Widgets: bubble charts, force diagrams and sync flow diagrams, as widget blocks.
Features
- Bubble Chart - Values as packed bubbles, with images & legend - docs
- Force Diagram - Interactive networks, draggable nodes - docs
- Sync Flow Diagram - Data exchanges between servers & a central hub, animated objects - docs
- Shared Building Blocks - Nodes, Links Animations, Tooltips and legacy Link Presets
- Theme Colors - Diagrams follow the Bootstrap theme & color mode, colors accept theme roles - docs
- Translations - Controllers default labels (sync flow modes, statuses, volumes, bubble values) in English, French,
Spanish, Italian, German & Dutch (
BadPixxelWidgetsD3Jsdomain); labels set on blocks always win - Live Updates - Diagrams are drawn again when their widget is compiled again (e.g. new parameters)
Requirements
- PHP 8.1+
- Symfony 6.4, 7.4 or 8.0
badpixxel/widgets-bundle^3.0- D3.js ^7 (installed with importmap)
Installation
composer require badpixxel/widgets-d3js-bundle
php bin/console importmap:install
The bundle is a Symfony UX package (assets/package.json): Symfony Flex declares its Stimulus controllers
(bubble, force, sync-flow) in your assets/controllers.json, and its JavaScript API in your importmap.php
(@badpixxel/ux-widgets-d3). No import is required to use the diagrams.
Quick Start
use BadPixxel\Widgets\Attribute\AsStaticWidget;
use BadPixxel\Widgets\D3Js\Blocks\D3SyncFlow\D3SyncFlowBlock;
use BadPixxel\Widgets\D3Js\Dictionary\D3SyncModes;
use BadPixxel\Widgets\D3Js\Model\D3SyncNode;
use BadPixxel\Widgets\Dictionary\ChartColors;
use BadPixxel\Widgets\Models\AbstractWidget;
use BadPixxel\Widgets\Widgets\Descriptor\SimpleDescriptor;
#[AsStaticWidget(channels: array("dashboard"))]
class SyncWidget extends AbstractWidget
{
public function getDescriptor(): SimpleDescriptor
{
return new SimpleDescriptor(title: "Sync", description: "Data exchanges", icon: "fa fa-sync", origin: "App");
}
public function build(): void
{
$this->addBlock(
(new D3SyncFlowBlock())
->setHub("Hub", "Processing")
->addNode(
(new D3SyncNode("erp", "ERP"))
->setColor(ChartColors::ACCENT)
->setMode(D3SyncModes::BOTH)
->setVolumes(3600, 2900)
)
);
}
}
Render it as any other widget: <twig:Widget :configurator="configurator" />.
JavaScript API
The Stimulus controllers are registered by StimulusBundle. @badpixxel/ux-widgets-d3 exports building blocks
for custom diagrams, drawn with the same nodes, links, tooltips & theme colors:
import { FlowLink, NodeView, Tooltip, resolveTheme, watchTheme } from '@badpixxel/ux-widgets-d3';
Exports: resolveTheme, watchTheme, FlowLink, LINK_ANIMATIONS, LINK_DEFAULTS, LINK_SHAPES,
NodeView, NODE_STATUSES, Tooltip, TOOLTIP_DEFAULTS, Legend, ChartConfig.
Demo Application
The bundle reuses the demo application of the Widgets Bundle (Bootstrap 3 / 4 / 5, Bootswatch themes,
color mode), with its own homepage, configured in tests/config/packages/widgets_demo.yaml:
a D3.js dashboard and the D3.js icon. Demo widgets are in tests/Widgets:
SyncFlowOverview- Servers exchanging data with a processing hubServicesMesh- Force diagram, one link per animationTechStack- Bubble chart, theme series paletteEtlPipeline- Configurable: 0 to 3 servers per sync mode, lanes shape & animationLinksCatalog- One sync flow server per links animation
make up # Start containers: app, sf6, sf7, sf8
Then open http://app.d3js.widgets.local (see docker-compose.yml for hosts).
Testing
make verify # Quality checks + PHPUnit in all containers (Symfony 6.4, 7.4 & 8.0)
make quality # Quality checks (lint, code style, PHPStan), current container
php vendor/bin/phpunit # PHPUnit, current container
Test suites: tests/Core (theme colors, renderer), tests/Integration (generic blocks & widgets test cases
of the Widgets Bundle, on D3.js blocks & demo widgets) and tests/Operational (demo homepage, ETL parameters).
Links
- Repository: gitlab.com/badpixxel-public/widgets-d3-bundle
- Widgets Bundle: gitlab.com/badpixxel-public/widgets-bundle
License
This bundle is licensed under the MIT License. See the LICENSE file for details.