Download the PHP package enscope/yii2-chartjs-widget without Composer

On this page you can find all versions of the php package enscope/yii2-chartjs-widget. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii2-chartjs-widget

yii2-chartjs-widget

Yii2 Chart widget with support for chart.js 2.0.

Installation

To install the widget in your application, run

composer require enscope/yii2-chartjs-widget:~1.0

or add

"enscope/yii2-chartjs-widget" : "~1.0"

to the require section of your application's composer.json file.

It is possible to use the source code directly, but it is recommended to use composer, for your own good.

Basic Usage

Main class of the widget is ChartJsWidget, which is the only one you need in your views. Basic configuration goes like this:

{ChartJsWidget::widget([
    'chartType' => ChartJsWidget::CHART_LINE,
    'canvasOptions' => [
        'height' => 200
    ],
    'chartOptions' => [
        'animation' => false,
        'bezierCurve' => false,
        'maintainAspectRatio' => false,
        'responsive' => true,
        'tooltips' => [
            'callbacks' => [
                'label' => ChartJsWidget::js('function (item) { return (item.yLabel + "%"); }')
            ]
        ]
    ],
    'chartData' => $chartData
])}

All supported chart types are defined as constants:

const CHART_LINE = 'line';
const CHART_BAR = 'bar';
const CHART_RADAR = 'radar';
const CHART_POLAR_AREA = 'polarArea';
const CHART_PIE = 'pie';
const CHART_DOUGHNUT = 'doughnut';

To include javascript callbacks in configuration, ChartJsWidget::js(..) helper is available to allow for simple expression instantiation even for users, who are using Smarty as a templating engine for their app (like in this case). The helper simply instantiates yii\web\JsExpression with specified string.

The properties of the widget are as follows:

Planned Enhancements

Acknowledgments

This widget was inspired by 2amigOS! ChartJs widget, which unfortunatelly was not available for chart.js 2.0, so I decided to create a new one with some inspiration borrowed in terms of basic structure.


All versions of yii2-chartjs-widget with dependencies

PHP Build Version
Package Version
Requires bower-asset/chartjs Version 2.1.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package enscope/yii2-chartjs-widget contains the following files

Loading the files please wait ....