gebrail/charts-reports

Package to generate charts with Amcharts directly from laravel , without interacting with JavaScript.

1.0.0 2022-12-12 21:51 UTC

This package is auto-updated.

Last update: 2025-06-13 05:37:17 UTC


README

Paquete para generar gr谩ficos con Amcharts directamente desde laravel, sin interactuar con JavaScript.

Guia de inicio rapido

Pre-requisitos

No hay configuraci贸n adicional u otros par谩metros todav铆a.

馃敯 Este paquete se puede usar en Laravel 7 o superior.

Instalaci贸n

Puedes instalar el paquete a trav茅s de composer

composer require gebrail/charts-reports

馃敯 Este paquete tambien ofrece la opci贸n de generar graficas con artisan, mediante la interfaz de l铆nea de comandos que viene junto a Laravel.

Guia rapida de como usar

Ejemplo

Para crear su primer gr谩fico, dir铆jase a su controlador.

En su controlador agregue las siguientes lineas

$data = User::select(array('name', 'sales'))->take(3)->get();

 $options = [
              'chart_name' => 'Donut Chart',
              'chart_type' => 'Pie & Donut',    
              'chart_subtype' => 'Donut',
              'field_category' => 'name',
              'field_value' => 'sales',
              'chart_data'=> $data,
           ];
$chart = new ChartReport($options);

return view('graph', compact('chart'));

Agregue las siguientes lineas a su vista

<!doctype html>
<html lang="en">
  <head>
{!! $chart->renderChartLibrary() !!}
{!! $chart->renderJs() !!}
  </head>
  <body>
   {!! $chart->renderHtml() !!}
    </body>
</html>

Para generar la gr谩fica debemos hacer el llamado de la funci贸n renderHtml(), podemos usarla en cualquier parte siempre que este dentro de la etiqueta body.

###Resultado

###Graficas disponibles del paquete

  • Simple Pie Chart.
  • Donut Chart.
  • Dragging Pie Slices
  • Simple Column
  • Column with Rotated Labels.
  • Clustered Column Chart.
  • Line & Area

##馃摌Ir a la Documentaci贸n

License

MIT