• Stars
    star
    102
  • Rank 335,584 (Top 7 %)
  • Language
    PHP
  • License
    MIT License
  • Created about 6 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Use Chartjs in laravel-admin

Use Chartjs in laravel-admin

DEMO

Login using admin/admin

Screenshot

qq20180917-132122

Installation

composer require laravel-admin-ext/chartjs

php artisan vendor:publish --tag=laravel-admin-chartjs

Configuration

Open config/admin.php, add configurations that belong to this extension at extensions section.

    'extensions' => [

        'chartjs' => [
        
            // Set to `false` if you want to disable this extension
            'enable' => true,
        ]
    ]

Usage

Create a view in views directory like resources/views/admin/chartjs.blade.php, and add following codes:

<canvas id="myChart" width="400" height="400"></canvas>
<script>
$(function () {
    var ctx = document.getElementById("myChart").getContext('2d');
    var myChart = new Chart(ctx, {
        type: 'bar',
        data: {
            labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
            datasets: [{
                label: '# of Votes',
                data: [12, 19, 3, 5, 2, 3],
                backgroundColor: [
                    'rgba(255, 99, 132, 0.2)',
                    'rgba(54, 162, 235, 0.2)',
                    'rgba(255, 206, 86, 0.2)',
                    'rgba(75, 192, 192, 0.2)',
                    'rgba(153, 102, 255, 0.2)',
                    'rgba(255, 159, 64, 0.2)'
                ],
                borderColor: [
                    'rgba(255,99,132,1)',
                    'rgba(54, 162, 235, 1)',
                    'rgba(255, 206, 86, 1)',
                    'rgba(75, 192, 192, 1)',
                    'rgba(153, 102, 255, 1)',
                    'rgba(255, 159, 64, 1)'
                ],
                borderWidth: 1
            }]
        },
        options: {
            scales: {
                yAxes: [{
                    ticks: {
                        beginAtZero:true
                    }
                }]
            }
        }
    });
});
</script>

Then show it on the page

class ChartjsController extends Controller
{
    public function index(Content $content)
    {
        return $content
            ->header('Chartjs')
            ->body(new Box('Bar chart', view('admin.chartjs')));
    }
}

For more usage, please refer to the official documentation of chartjs.

Donate

Help keeping the project development going, by donating a little. Thanks in advance.

PayPal Me

-1

License

Licensed under The MIT License (MIT).

More Repositories

1

helpers

Several tools to help you in development
PHP
135
star
2

media-manager

Provides a web interface to manage local files
Blade
134
star
3

china-distpicker

中国省/市/区(县)三级级联选择器
PHP
131
star
4

log-viewer

Log viewer for laravel
PHP
129
star
5

redis-manager

Redis manager for laravel-admin
HTML
103
star
6

config

Config manager for laravel-admin
PHP
95
star
7

material-ui

Material-UI extension for laravel-admin
PHP
95
star
8

scheduling

Scheduling task manager for laravel-admin
PHP
92
star
9

large-file-upload

An Extension For Laravel-Admin
JavaScript
75
star
10

backup

An admin interface for managing backups
PHP
74
star
11

cropper

PHP
73
star
12

latlong

A latitude & longitude selector
PHP
69
star
13

UEditor

UEditor extension for laravel-admin
PHP
62
star
14

wangEditor

wangEditor extension for laravel-admin
JavaScript
61
star
15

grid-lightbox

Turn your grid into a lightbox & gallery
CSS
58
star
16

reporter

This tool stores the exception information into the database and provides a developer-friendly web interface to view the exception information.
PHP
58
star
17

api-tester

API tester for laravel-admin
Blade
55
star
18

grid-sortable

WIP
PHP
40
star
19

summernote

Summernote extension for laravel-admin
PHP
37
star
20

env-manager

Env Manager for Laravel-admin
PHP
34
star
21

id-validator

验证中国大陆居民身份证、港澳居民居住证以及台湾地区居民居住证
PHP
34
star
22

daterangepicker

Integrates daterangepicker into laravel-admin
JavaScript
33
star
23

simplemde

Simplemde markdown editor extension for laravel-admin
PHP
33
star
24

data-table

data table for laravel-admin
PHP
32
star
25

media-player

Play audio/videos in laravel-admin
JavaScript
31
star
26

json-editor

JSON Editor for Laravel-admin
PHP
31
star
27

ckeditor

Integrate CKEDITOR into laravel-admin
JavaScript
30
star
28

phpinfo

Outputs information about PHP's configuration in laravel-admin
PHP
27
star
29

composer-viewer

Composer Viewer for Laravel-admin
PHP
27
star
30

multi-language

Blade
25
star
31

quill

Quill Editor extension for laravel-admin
CSS
23
star
32

lock-screen

PHP
22
star
33

messages

PHP
21
star
34

admin-config

Manage your database configuration as profiles
PHP
21
star
35

star-rating

Star Rating extension for laravel-admin
JavaScript
21
star
36

simditor

Integrates simditor into Laravel-admin
JavaScript
16
star
37

sparkline

Integrates jQuery sparkline into laravel-admin
PHP
16
star
38

code-mirror

Code editor extension for laravel-admin
JavaScript
15
star
39

tencent-map

PHP
15
star
40

file-browser

A Simple File Browser Extension For Laravel-Admin
HTML
15
star
41

auth-attempts

Add captcha and login attempts for laravel-admin
HTML
14
star
42

translation

PHP
12
star
43

file-manager

file-manager for laravel-admin
HTML
12
star
44

rbac

开发中,勿安装
PHP
10
star
45

watermark

PHP
10
star
46

lodpod-editor

Lodpod print template visual editor LodPod打印模板Web可视化编辑器扩展
JavaScript
10
star
47

select-tree

数据模型树 的 select 联动选择插件
HTML
9
star
48

wangEditor2

wangEditor v2 for Laravel-admin
PHP
9
star
49

echarts

baidu echarts for laravel-admin
PHP
9
star
50

data-dictionary

Mysql Data dictionary, Mysql数据字典
HTML
9
star
51

php-editor

PHP editor extension for laravel-admin based on code-mirror
PHP
8
star
52

code-editor

PHP
6
star
53

typeahead

Integrates Typeahead.js into laravel-admin
PHP
5
star
54

screenfull

This is an extension to integrates screenfull.js into laravel-admin.
PHP
4
star
55

python-editor

Python editor extension for laravel-admin based on code-mirror
PHP
4
star
56

component-js

JavaScript
4
star
57

js-editor

Javascript editor extension for laravel-admin based on code-mirror
PHP
4
star
58

clike-editor

Several c-lick language editor extensions for laravel-admin based on code-mirror
PHP
3
star
59

aliyun-sms

阿里云短信扩展
2
star
60

css-editor

CSS editor extension for laravel-admin based on code-mirror
PHP
2
star