PHPackages                             dgc/chart-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. dgc/chart-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

dgc/chart-bundle
================

Chart bundle

1.5.1(8y ago)1325↓100%MITJavaScriptPHP &gt;=5.6

Since May 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/dg-company/chart-bundle)[ Packagist](https://packagist.org/packages/dgc/chart-bundle)[ RSS](/packages/dgc-chart-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (8)Used By (0)

ChartBundle
===========

[](#chartbundle)

Bundle to create charts from SQL or MongoDB database queries

Requirements
------------

[](#requirements)

- PHP 5.6+
- Doctrine ORM and/or Doctine ODM
- Symfony2+

Installation
------------

[](#installation)

Request bundle using composer

```
composer require dgc/chart-bundle

```

Add ChartBundle to your AppKernel.php

```
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            ...

            new DGC\ChartBundle\DGCChartBundle(),

            new AppBundle\AppBundle(),
        ];
        ...

```

Add JavaScript and CSS dependencies to your views

```
...

    {% include '@DGCChart/Includes/lib_daterangepicker.html.twig' %}
    {% include '@DGCChart/Includes/lib_echarts.html.twig' %}
    {% include '@DGCChart/Includes/lib_morris.html.twig' %}

...

```

Add Charts
----------

[](#add-charts)

TestController.php

```
// Create a new aggregator
$aggregator = $this->get('dgc_chart.factory.aggregator')->createSqlAggregator();

// Build the query
$aggregator
    ->setDatabaseConnection($this->get("doctrine.dbal.ext_connection"))
    ->getQueryBuilder()
    ->select('`date`, orders, clients')
    ->from('stats')
    ->orderBy('date', 'DESC')
;

// Set which fields will be used for X and Y values
$aggregator
    ->setXField('date')
    ->addYField('orders', 'Number of orders')
    ->addYField('clients', 'Number of clients')
    ->addResultCallback(function ($data) {
        return $data; //optional: manipulate data used to render the chart
    })
;

// Optionally create and add filters
$filter = $this->get("dgc_chart.factory.filter")->createDateRangeFilter("test");
$filter->setSqlField('date');

// Create the chart
$chart = $this->get('dgc_chart.factory.chart')->createAdvancedChart('test');
$chart
    ->setTitle("Just a test")
    ->addAggregator($aggregator)
    ->addFilter($filter)
;

return $this->render('@App/Test/index.html.twig', array(
    'chart' => $chart->render(),
    'filter' => $filter->render()
));

```

index.html.twig

```
{{ filter|raw }}
{{ chart|raw }}

```

Chart types
-----------

[](#chart-types)

- AdvancedChart (eCharts)
- LineChart (Morris.js)
- PieChart (Morris.js)
- BarChart (Morris.js)

### AdvancedChart

[](#advancedchart)

```
$chart = $this->get('dgc_chart.factory.chart')->createAdvancedChart('test');
$chart
    ->setHeight(...)
    ->setWidth(...)
    ->setLabelFormat(...)
    ->setSeriesLabelPosition(...)
    ->setXAxisLabelInterval(...)
    ->setYAxisLabelInterval(...)
    ->setRelativeScale(...)
    ->setHorizontal(...)
    ->showXAxis(...)
    ->showYAxis(...)
    ->showToolbar(...)
    ->showData(...)
    ->showDownload(...)
    ->showSplitLines(...)
    ->setTooltipFormat(...)
    ->hideLabelLengthDependent(...)

    ->setTitle("Just a test")
    ->addAggregator($aggregator)
    ->addFilter($filter)
;

```

### LineChart

[](#linechart)

```
$chart = $this->get('dgc_chart.factory.chart')->createLineChart('test');
$chart
    ->setSmooth(...)

    ->setTitle("Just a test")
    ->addAggregator($aggregator)
    ->addFilter($filter)
;

```

### PieChart

[](#piechart)

```
$chart = $this->get('dgc_chart.factory.chart')->createPieChart('test');
$chart
    ->setStartAngle()
    ->formatTooltip()
    ->setThresholdDisplayPieSlice()
    ->setThresholdDisplayPieSliceDescription()

    ->setTitle("Just a test")
    ->addAggregator($aggregator)
    ->addFilter($filter)
;

```

### BarChart

[](#barchart)

```
$chart = $this->get('dgc_chart.factory.chart')->createBarChart('test');
$chart
    ->setTitle("Just a test")
    ->addAggregator($aggregator)
    ->addFilter($filter)
;

```

### ListChart

[](#listchart)

```
$chart = $this->get('dgc_chart.factory.chart')->createListChart('test');
$chart
    ->setTitle("Just a test")
    ->addAggregator($aggregator)
    ->addFilter($filter)
;

```

Filter
------

[](#filter)

- Date range filter
- Number range filter
- Reference filter (choices)

### Date range filter

[](#date-range-filter)

```
$filter = $this->get("dgc_chart.factory.filter")->createDateRangeFilter("test");
$filter
    ->setStartDate(...)
    ->setEndDate(...)
    ->setDateFormat(...)
    ->setSqlField(...)
    ->setSqlFieldRangeEnd(...)
    ->setMongoField(...)
;

```

Number range filter
-------------------

[](#number-range-filter)

```
$filter = $this->get("dgc_chart.factory.filter")->createNumberRangeFilter("test");
$filter
    ->setLabel(...)
    ->setUnit(...)
    ->setMin(...)
    ->setMax(...)
    ->setRangeMin(...)
    ->setRangeMax(...)
    ->setMongoField(...)
    ->setSqlField(...)
;

```

Reference filter (choices)
--------------------------

[](#reference-filter-choices)

```
$filter = $this->get("dgc_chart.factory.filter")->createReferenceFilter("test");
$filter
    ->setReference(...)
    ->setChoices(...)
    ->setLabel(...)
    ->setMongoField(...)
    ->addCustomWhereClause(...)
;

```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~63 days

Recently: every ~79 days

Total

6

Last Release

2963d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/26bb169c473c48fd9b4533740c1a4a49d0378bcb5fb7d477c8a255bceb69ebe2?d=identicon)[kempkensteffen](/maintainers/kempkensteffen)

---

Top Contributors

[![neuni](https://avatars.githubusercontent.com/u/1769653?v=4)](https://github.com/neuni "neuni (14 commits)")[![DanielMenke](https://avatars.githubusercontent.com/u/8995003?v=4)](https://github.com/DanielMenke "DanielMenke (2 commits)")

---

Tags

symfonysqlmongodbchartsechartsmorris

### Embed Badge

![Health badge](/badges/dgc-chart-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/dgc-chart-bundle/health.svg)](https://phpackages.com/packages/dgc-chart-bundle)
```

###  Alternatives

[doctrine/mongodb-odm-bundle

Symfony Doctrine MongoDB Bundle

38418.7M195](/packages/doctrine-mongodb-odm-bundle)[sonata-project/doctrine-orm-admin-bundle

Integrate Doctrine ORM into the SonataAdminBundle

46117.7M155](/packages/sonata-project-doctrine-orm-admin-bundle)[omines/datatables-bundle

Symfony DataTables Bundle with native Doctrine ORM, Elastica and MongoDB support

2851.4M6](/packages/omines-datatables-bundle)[facile-it/mongodb-bundle

Bundle service integration of official \[mongodb/mongo-php-library\](https://github.com/mongodb/mongo-php-library) driver library

38212.1k1](/packages/facile-it-mongodb-bundle)[doesntmattr/mongodb-migrations-bundle

Symfony MongoDBMigrationsBundle

23484.5k1](/packages/doesntmattr-mongodb-migrations-bundle)[boekkooi/twig-jack-bundle

Handy additional features for Twig within symfony 2

2323.0k](/packages/boekkooi-twig-jack-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
