📅  最后修改于: 2023-12-03 14:43:43.927000             🧑  作者: Mango
LarapexChart is a powerful charting library for Laravel, based on the popular ApexCharts.js. It provides developers with an easy-to-use interface for creating beautiful and interactive charts in their Laravel applications.
To install LarapexChart in your Laravel project, you can use composer:
composer require khill/larapex-charts
After the installation, you need to publish the configuration file:
php artisan vendor:publish --tag=larapex-charts_config
This will create a larapex-charts.php
file in the config
directory of your Laravel application.
To start using LarapexChart, you can create a new chart instance in your controller or view:
use Khill\LarapexCharts\LarapexChart;
$chart = new LarapexChart();
Next, you can set the chart type, series data, and other options according to your needs:
$chart->setType('line')
->setXAxis(['Jan', 'Feb', 'Mar', 'Apr', 'May'])
->setSeries([
['name' => 'Sales', 'data' => [30, 40, 35, 50, 49]],
['name' => 'Expenses', 'data' => [25, 20, 30, 35, 40]],
])
->setColors(['#0084ff', '#f76304'])
->setTitle('Monthly Sales')
->setSubtitle('2021')
->setHeight(400);
Finally, you can render the chart in your Blade template using the renders()
method:
{!! $chart->render() !!}
For detailed documentation and examples, please visit the official LarapexChart GitHub repository.
LarapexChart provides Laravel developers with a simple yet powerful way to create stunning charts in their applications. With its rich features and seamless integration, it is a must-have tool for visualizing data and making insights. Give LarapexChart a try and take your charts to the next level!