Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Charts Laravel Package

consoletvs/charts

ConsoleTVs Charts is a Laravel-friendly charting package to build beautiful, interactive charts with a clean API and multiple chart libraries. Easily generate line, bar, pie and more from PHP, integrate with Blade, and render charts with minimal setup.

View on GitHub
Deep Wiki
Context7

The laravel charting package

Frequently asked questions about Charts
What Laravel versions does consoletvs/charts support, and how do I check compatibility?
The package is designed for Laravel 8.x and 9.x, with PHP 8.0+ support. Check the package’s `composer.json` for exact version constraints or run `composer why-not consoletvs/charts` to verify compatibility with your project. Always test in a staging environment before upgrading.
Can I use consoletvs/charts with a decoupled frontend (e.g., React/Vue) instead of Blade?
Yes, but with adjustments. Expose chart data via Laravel API endpoints (e.g., using API resources) and proxy the required JS/CSS assets (Chart.js, Highcharts) to your frontend. The package’s core logic remains PHP-side, so you’ll need to manually render the charts in your frontend framework.
How do I configure multiple chart types (e.g., line, bar, pie) in a single dashboard?
Use the fluent API to define each chart separately. For example, chain methods like `Chart::line()->title('Revenue')` and `Chart::pie()->title('Market Share')` in your controller, then pass the results to Blade. Each chart type shares the same configuration structure for consistency.
Does consoletvs/charts support real-time updates (e.g., WebSocket-driven charts)?
The package itself doesn’t include WebSocket support, but you can integrate it with Laravel Echo or similar tools. Fetch updated data via AJAX and redraw the chart using the library’s native methods (e.g., Chart.js’s `update()`). The package’s API remains flexible for dynamic data.
How do I handle large datasets (e.g., 100K+ rows) without performance issues?
Use Laravel’s query builder or Eloquent to paginate or aggregate data before passing it to the chart. For time-series data, consider downsampling (e.g., rolling averages) or using libraries like `laravel-excel` to preprocess data. Cache chart configurations or data where possible to reduce rendering overhead.
Are there conflicts with existing JS charting libraries (e.g., Chart.js already loaded in my app)?
The package includes vendor assets by default, which may conflict if you’ve already loaded Chart.js or Highcharts. Disable auto-publishing in `config/charts.php` and manually include only the required assets. Audit your JS bundle for duplicates using browser dev tools.
Can I customize tooltips, legends, or other advanced chart features beyond the fluent API?
The fluent API abstracts common features for simplicity, but you can extend functionality by accessing the underlying chart library (e.g., Chart.js) directly. Use the `getChart()` method to retrieve the raw chart object and apply custom configurations or plugins.
How do I test charts in my Laravel application (unit/feature tests)?
Mock the chart data in your tests and use Laravel’s `Http` or `View` facades to assert rendered output. For Blade charts, test the `@chartjs` or `@highcharts` directives by capturing the rendered HTML. Use `Chart::fake()` (if available) or manually verify data structures passed to the chart.
What’s the best way to deploy consoletvs/charts in production? Should I cache chart assets?
Publish the package’s assets (`php artisan vendor:publish --tag=charts-assets`) and configure your web server (Nginx/Apache) to cache JS/CSS files aggressively. For dynamic charts, cache the *data* (e.g., using Laravel’s cache) rather than the rendered output to avoid stale visualizations.
Are there alternatives to consoletvs/charts for Laravel, and when should I consider them?
Alternatives include `darkaoner/laravel-chartjs` (simpler, Chart.js-only) or `torann/laravel-google-charts` (Google Charts integration). Choose `consoletvs/charts` if you need multi-library support, reusable configurations, or a fluent API. Opt for alternatives if you’re locked into a specific charting library or prefer minimalism.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai