PHP code example of pjeutr / laravelvisjs
1. Go to this page and download the library: Download pjeutr/laravelvisjs library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pjeutr / laravelvisjs example snippets
Pjeutr\LaravelVisJs\Providers\VisjsServiceProvider::class
$service = app()->visjs
->name()
->type()
->size()
->datasets()
->options();
options: {
scales: {
xAxes: [{
type: 'time',
time: {
displayFormats: {
quarter: 'MMM YYYY'
}
}
}]
}
}
$chart->optionsRaw = "{
legend: {
display:false
},
scales: {
xAxes: [{
gridLines: {
display:false
}
}]
}
}";
// 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
<div style="width:75%;">
{!! $visjs->render() !!}
</div>