2017 © Pedro Peláez
 

yii2-extension yii2-stats-widget

Statistics widget for exploring time series data from diffrent sources of your application

image

pavlm/yii2-stats-widget

Statistics widget for exploring time series data from diffrent sources of your application

  • Wednesday, April 11, 2018
  • by pavlm
  • Repository
  • 2 Watchers
  • 3 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 6 % Grown

The README.md

yii2-stats-widget

Visualizes time series data from your application. Package consists of two parts., (*1)

  • Interactive stats widget based on charts.js library. Widget features are: different date ranges browsing, changing data group interval.
  • Data providers and formatters wich read and adapt data of your application for the stats widget.

Installation

composer require pavlm/yii2-stats-widget, (*2)

Usage

1. Setup StatsAction

Add action to some controller. Configure time series provider., (*3)

    public function actions()
    {
        return [
            'stats-users' => [
                'class' => StatsAction::class,
                'providerFactory' => new TimeSeriesProviderCallbackFactory(function ($rangeStart, $rangeEnd, $period, $timeZone) {
                    return new QueryStatsProvider([
                        'rangeStart' => $rangeStart,
                        'rangeEnd' => $rangeEnd,
                        'period' => $period,
                        'timeZone' => $timeZone,
                        'timeZoneConnection' => new \DateTimeZone('Europe/Moscow'),
                        'query' => (new Query())->from('user'),
                        'dateField' => 'created_at',
                        'dateFieldType' => QueryStatsProvider::DATETYPE_INT,
                    ]);
                }),
                'timeZone' => 'Europe/Moscow',
                'defaultRange' => 'P2Y',
                'defaultPeriod' => 'P1Y',
            ],
        ];
    }

Note: additional time series provider(s) can be found in the pavlm/yii2-stats-providers package., (*4)

2. Add widget to a some application view.

Widget statsAction must be set to the action route configured in step 1., (*5)

echo StatsWidget::widget([
    'statsAction' => ['stats/stats-users'],
]);

3. Open page with stats widget.

StatsWidget example, (*6)

Localization

    'i18n' => [
        'translations' => [
            'stats-widget' => [
                'class' => yii\i18n\PhpMessageSource::class,
                'basePath' => '@pavlm/yii/stats/messages',
            ],
        ],
    ],

The Versions

11/04 2018

dev-master

9999999-dev

Statistics widget for exploring time series data from diffrent sources of your application

  Sources   Download

MIT

The Requires

  • php >=5.5
  • bower-asset/chartjs *

 

The Development Requires

by Avatar pavlm

11/04 2018

v0.1.2

0.1.2.0

Statistics widget for exploring time series data from diffrent sources of your application

  Sources   Download

MIT

The Requires

  • php >=5.5
  • bower-asset/chartjs *

 

The Development Requires

by Avatar pavlm

25/01 2018

v0.1.1

0.1.1.0

Statistics widget for exploring time series data from diffrent sources of your application

  Sources   Download

MIT

The Requires

  • php >=5.5
  • bower-asset/chartjs *

 

The Development Requires

by Avatar pavlm

02/01 2018

v0.1

0.1.0.0

Statistics widget for exploring time series data from diffrent sources of your application

  Sources   Download

MIT

The Requires

  • php >=5.5
  • bower-asset/chartjs *

 

The Development Requires

by Avatar pavlm