slavkovrn/yii2-visualize

jQuery Visualize is a extension for Yii 2.0 framework to draw charts for presentation

Installs: 4 338

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 1

Open Issues: 0

Language:JavaScript

Type:yii2-extension

1.0.1 2017-08-05 11:06 UTC

This package is auto-updated.

Last update: 2024-03-12 03:35:35 UTC


README

The extension uses visualize.jQuery.js and makes charts from php array of structure defined.

Visualize widget PHP Array generator.

Visualize widget

Installation

The preferred way to install this extension is through composer.

Either run:

composer require slavkovrn/yii2-visualize

or add

"slavkovrn/yii2-visualize": "*"

to the require section of your composer.json file.

Usage

Set link to extension in your view:

<?php

use slavkovrn\visualize\VisualizeWidget;

?>

<?= VisualizeWidget::widget([
    'id' => 'graphic',      // Id of visualize widget should be unique at page
    'class' => 'graphic',   // Class to define stile
    'name' => 'Visualize',  // Name of visualize widget
    'style' => 'light',     // Style of widget (only 'dark' or 'light' option)
    'width' => 800,         // Width of widget in pixels
    'height' => 200,        // Height of widget in pixels
    'graphic' => [          // data of chart of structure defined
        'SIN' => [
                    number_format(0,5) => sin(0),
                    number_format(Pi()/4,5) => sin(Pi()/4),
                    number_format(Pi()/2,5) => sin(Pi()/2),
                    number_format(Pi()/2+Pi()/4,5) => sin(Pi()/2+Pi()/4),
                    number_format(Pi(),5) => sin(Pi()),
                    number_format(Pi()+Pi()/4,5) => sin(Pi()+Pi()/4),
                    number_format(Pi()+Pi()/2,5) => sin(Pi()+Pi()/2),
                    number_format(Pi()+Pi()/2+Pi()/4,5) => sin(Pi()+Pi()/2+Pi()/4),
                    number_format(2*Pi(),5) => sin(2*Pi()),
                 ],
        'COS' => [
                    number_format(0,5) => cos(0),
                    number_format(Pi()/4,5) => cos(Pi()/4),
                    number_format(Pi()/2,5) => cos(Pi()/2),
                    number_format(Pi()/2+Pi()/4,5) => cos(Pi()/2+Pi()/4),
                    number_format(Pi(),5) => cos(Pi()),
                    number_format(Pi()+Pi()/4,5) => cos(Pi()+Pi()/4),
                    number_format(Pi()+Pi()/2,5) => cos(Pi()+Pi()/2),
                    number_format(Pi()+Pi()/2+Pi()/4,5) => cos(Pi()+Pi()/2+Pi()/4),
                    number_format(2*Pi(),5) => cos(2*Pi()),
                 ],
    ]
]) ?>

write comments to admin