2017 © Pedro Peláez
 

yii2-extension yii2-googlecharts

Google Charts widget for Yii2.

image

fruppel/yii2-googlecharts

Google Charts widget for Yii2.

  • Tuesday, November 10, 2015
  • by fruppel
  • Repository
  • 4 Watchers
  • 7 Stars
  • 13,401 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 5 Forks
  • 2 Open issues
  • 4 Versions
  • 3 % Grown

The README.md

Google Charts widget for Yii2

A wrapper for Google's charts API (see https://developers.google.com/chart/) to use it with Yii2., (*1)

Installation

The preferred way to install this extension is through composer., (*2)

composer require fruppel/yii2-googlecharts

Usage

Example 1: 3D PieChart with data in DataTable format, (*3)

demo, (*4)



= GoogleCharts::widget([
    'id' => 'my-id',
    'visualization' => 'PieChart',
    'data' => [
        'cols' => [
            [
                'id' => 'topping',
                'label' => 'Topping',
                'type' => 'string'
            ],
            [
                'id' => 'slices',
                'label' => 'Slices',
                'type' => 'number'
            ]
        ],
        'rows' => [
            [
                'c' => [
                    ['v' => 'Mushrooms'],
                    ['v' => 3]
                ],
            ],
            [
                'c' => [
                    ['v' => 'Onions'],
                    ['v' => 1]
                ]
            ],
            [
                'c' => [
                    ['v' => 'Olives'],
                    ['v' => 1]
                ]
            ],
            [
                'c' => [
                    ['v' => 'Zucchini'],
                    ['v' => 1]
                ]
            ],
            [
                'c' => [
                    ['v' => 'Pepperoni'],
                    ['v' => 2]
                ]
            ],
        ]
    ],
    'options' => [
        'title' => 'How Much Pizza I Ate Last Night',
        'width' => 400,
        'height' => 300,
        'is3D' => true,
    ],
    'responsive' => true,
]) ?>

Example 2: AreaChart with data array (will be converted to DataTable), (*5)

demo2, (*6)

 'AreaChart',
        'options' => [
            'title' => 'Company Performance',
            'hAxis' => [
                'title' => 'Year',
                'titleTextStyle' => [
                    'color' => '#333'
                ]
            ],
            'vAxis' => [
                'minValue' => 0
            ]
        ],
    'dataArray' => [
            ['Year', 'Sales', 'Expenses'],
            ['2013',  1000,      400],
            ['2014',  1170,      460],
            ['2015',  660,       1120],
            ['2016',  1030,      540]
    ]
])
?>

Render charts as png image

Set the $asPng option to true like the example below, (*7)

<?= GoogleCharts::widget([
    'asPng' => true,
    ...

Note: This works currently only for core charts and geocharts. See the charts documentation for more information: https://developers.google.com/chart/interactive/docs/printing, (*8)

The Versions

10/11 2015

dev-master

9999999-dev

Google Charts widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

by Florian Ruppel

extension yii widget chart google charts

10/11 2015

v1.1.0

1.1.0.0

Google Charts widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

by Florian Ruppel

extension yii widget chart google charts

01/07 2015

v1.0.1

1.0.1.0

Google Charts widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

by Florian Ruppel

extension yii widget chart google charts

31/10 2014

v1.0

1.0.0.0

Google Charts widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

by Florian Ruppel

extension yii widget chart google charts