From 4c54a391beaa2e57709519dfb0b1838bd73e55bd Mon Sep 17 00:00:00 2001 From: printempw Date: Sat, 24 Feb 2018 17:08:32 +0800 Subject: [PATCH] Remove package fx3costa/laravelchartjs --- app/Http/Controllers/AdminController.php | 68 +++++++++++------------- composer.json | 3 +- composer.lock | 54 +------------------ config/app.php | 1 - resources/views/admin/index.tpl | 17 ++++-- 5 files changed, 48 insertions(+), 95 deletions(-) diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index d9f27bb3..d6d2315d 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -31,43 +31,39 @@ class AdminController extends Controller $data['texture_uploads'][] = Texture::like('upload_at', $time->toDateString())->count(); } - $chart = app()->chartjs - ->name('overview_chart') - ->type('line') - ->size(['width' => 400, 'height' => 200]) - ->labels($labels) - ->datasets([ - [ - 'label' => trans('admin.index.user-registration'), - 'backgroundColor' => 'rgba(60, 141, 188, 0.6)', - 'borderColor' => '#3c8dbc', - 'pointRadius' => 0, - 'pointBorderColor' => '#3c8dbc', - 'pointBackgroundColor' => '#3c8dbc', - 'pointHoverBackgroundColor' => '#3c8dbc', - 'pointHoverBorderColor' => '#3c8dbc', - 'data' => $data['user_registration'], - ], - [ - 'label' => trans('admin.index.texture-uploads'), - 'backgroundColor' => 'rgba(210, 214, 222, 0.6)', - 'borderColor' => '#d2d6de', - 'pointRadius' => 0, - 'pointBorderColor' => '#c1c7d1', - 'pointBackgroundColor' => '#c1c7d1', - 'pointHoverBackgroundColor' => '#c1c7d1', - 'pointHoverBorderColor' => '#c1c7d1', - 'data' => $data['texture_uploads'], - ] - ]) - ->options([ - 'tooltips' => [ - 'intersect' => false, - 'mode' => 'index' - ] - ]); + $datasets = [ + [ + 'label' => trans('admin.index.user-registration'), + 'backgroundColor' => 'rgba(60, 141, 188, 0.6)', + 'borderColor' => '#3c8dbc', + 'pointRadius' => 0, + 'pointBorderColor' => '#3c8dbc', + 'pointBackgroundColor' => '#3c8dbc', + 'pointHoverBackgroundColor' => '#3c8dbc', + 'pointHoverBorderColor' => '#3c8dbc', + 'data' => $data['user_registration'], + ], + [ + 'label' => trans('admin.index.texture-uploads'), + 'backgroundColor' => 'rgba(210, 214, 222, 0.6)', + 'borderColor' => '#d2d6de', + 'pointRadius' => 0, + 'pointBorderColor' => '#c1c7d1', + 'pointBackgroundColor' => '#c1c7d1', + 'pointHoverBackgroundColor' => '#c1c7d1', + 'pointHoverBorderColor' => '#c1c7d1', + 'data' => $data['texture_uploads'], + ] + ]; - return view('admin.index', compact('chart')); + $options = [ + 'tooltips' => [ + 'intersect' => false, + 'mode' => 'index' + ] + ]; + + return view('admin.index', ['chartOptions' => compact('labels', 'datasets', 'options')]); } public function customize(Request $request) diff --git a/composer.json b/composer.json index ee42a756..b6af0542 100644 --- a/composer.json +++ b/composer.json @@ -12,8 +12,7 @@ "doctrine/inflector": "1.1.0", "laravel/framework": "5.2.*", "devitek/yaml-translation": "^2.0", - "printempw/laravel-datatables-lite": "^1.0", - "fx3costa/laravelchartjs": "^2.5" + "printempw/laravel-datatables-lite": "^1.0" }, "require-dev": { "fzaninotto/faker": "~1.4", diff --git a/composer.lock b/composer.lock index 59229511..8f5d6b71 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "93065cb8a9e776fe417866c9741f35e5", + "content-hash": "7cc7aede94ac363755668bb4198c9ca4", "packages": [ { "name": "classpreloader/classpreloader", @@ -301,58 +301,6 @@ ], "time": "2017-10-15T13:05:10+00:00" }, - { - "name": "fx3costa/laravelchartjs", - "version": "2.5.0", - "source": { - "type": "git", - "url": "https://github.com/fxcosta/laravel-chartjs.git", - "reference": "21eaf327118ca512b6503979d4ae75ad3a463e68" - }, - "dist": { - "type": "zip", - "url": "https://files.phpcomposer.com/files/fxcosta/laravel-chartjs/21eaf327118ca512b6503979d4ae75ad3a463e68.zip", - "reference": "21eaf327118ca512b6503979d4ae75ad3a463e68", - "shasum": "" - }, - "require": { - "illuminate/support": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*", - "php": ">=5.6.4" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Fx3costa\\LaravelChartJs\\Providers\\ChartjsServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Fx3costa\\LaravelChartJs\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Felix", - "email": "fx3costa@gmail.com" - } - ], - "description": "Simple package to facilitate and automate the use of charts in Laravel 5.x using Chartjs v2 library", - "keywords": [ - "chart", - "chartjs", - "fx3costa", - "graphics", - "laravel5", - "reports" - ], - "time": "2018-02-20T17:00:36+00:00" - }, { "name": "gregwar/captcha", "version": "v1.1.5", diff --git a/config/app.php b/config/app.php index 151a44db..13159a2b 100644 --- a/config/app.php +++ b/config/app.php @@ -162,7 +162,6 @@ return [ Devitek\Core\Translation\TranslationServiceProvider::class, Swiggles\Memcache\MemcacheServiceProvider::class, Yajra\Datatables\DatatablesServiceProvider::class, - Fx3costa\LaravelChartJs\Providers\ChartjsServiceProvider::class, /** * Application Service Providers... diff --git a/resources/views/admin/index.tpl b/resources/views/admin/index.tpl index 77266fcc..1cfa2e16 100644 --- a/resources/views/admin/index.tpl +++ b/resources/views/admin/index.tpl @@ -71,9 +71,8 @@
-
- {!! $chart->render() !!} -
+ +
@@ -83,4 +82,16 @@ + @endsection