2017 © Pedro Peláez
 

library laravelvisjs

Simple package to facilitate and automate the use of charts in Laravel 5.x using Visjs library

image

pjeutr/laravelvisjs

Simple package to facilitate and automate the use of charts in Laravel 5.x using Visjs library

  • Wednesday, October 4, 2017
  • by pjeutr
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

laravel-visjs - Visjs wrapper for Laravel 5.x

Simple package to facilitate and automate the use of (network) charts in Laravel 5.x using Visjs., (*1)

Code is 'ported' from laravel-chartjs., (*2)

Setup:

composer require pjeutr/laravelvisjs

And add the Service Provider in your file config/app.php:, (*3)

Pjeutr\LaravelVisJs\Providers\VisjsServiceProvider::class

Finaly, for now, you must install and add to your layouts / templates the Visjs library that can be easily found for download at: http://visjs.org/. This setting will also be improved., (*4)

Usage:

You can request to Service Container the service responsible for building the charts and passing through fluent interface the chart settings., (*5)

$service = app()->visjs
    ->name()
    ->type()
    ->size()
    ->datasets()
    ->options();

For now the builder needs the name of the chart, the type of chart that can be anything that is supported by visjs and the other custom configurations like, datasets, size and options., (*6)

In the dataset interface you can pass any configuration and option to your chart. All options available in visjs documentation are supported. Just write the configuration with php array notations and its work!, (*7)

Advanced visjs options

Since the current version allows it to add simple json string based options, it is not possible to generate options like:, (*8)

    options: {
        scales: {
            xAxes: [{
                type: 'time',
                time: {
                    displayFormats: {
                        quarter: 'MMM YYYY'
                    }
                }
            }]
        }
    }

Using the method optionsRaw(string) its possible to add a the options in raw format:, (*9)

        $chart->optionsRaw = "{
            legend: {
                display:false
            },
            scales: {
                xAxes: [{
                    gridLines: {
                        display:false
                    }  
                }]
            }
        }";

Examples

1 - Network Chart:, (*10)

// ExampleController.php

$edges = [
    ["from" => 7905, "to" => "7886", "label" => 50068, "length" => 10],
    ["from" => -1, "to" => "7905", "label" => 100, "group" => 40]
];
$nodes = [
    ["id" => -10, "shape" => "circularImage", "size" => 40, "color" => '#999', "borderWidth" => 1],
    ["id" => 7905, "label" => "loyal", "value" => 500, "group" => 'big1'],
    ["id" => 7886, "label" => "sensitive", "value" => 100, "group" => 'big2']
];

$visjs = app()->visjs
        ->name('networkChartTest')
        ->type('Network')
        ->size(['width' => 400, 'height' => 200])
        ->datasets(["nodes" => $nodes, "edges" => $edges])
        ->options([]);

return view('example', compact('visjs'));


 // example.blade.php



{!! $visjs->render() !!}

OBS:

This README as well as the package is in development but will be constantly updated and will keep you informed as soon as are ready for production. Thank you for understanding., (*11)

Any questions or suggestions preferably open a issue!, (*12)

License

LaravelVisJs is open-sourced software licensed under the MIT license., (*13)

The Versions

04/10 2017

dev-master

9999999-dev

Simple package to facilitate and automate the use of charts in Laravel 5.x using Visjs library

  Sources   Download

MIT

The Requires

 

by Avatar pjeutr

chart laravel5 reports graphics visjs pjeutr

04/10 2017

1.0.1

1.0.1.0

Simple package to facilitate and automate the use of charts in Laravel 5.x using Visjs library

  Sources   Download

MIT

The Requires

 

by Avatar pjeutr

chart laravel5 reports graphics visjs pjeutr

03/10 2017

1.0.0

1.0.0.0

Simple package to facilitate and automate the use of charts in Laravel 5.x using Visjs library

  Sources   Download

MIT

The Requires

 

by Avatar pjeutr

chart laravel5 reports graphics visjs pjeutr