Download the PHP package iaotle/nova-bar-metrics without Composer
On this page you can find all versions of the php package iaotle/nova-bar-metrics. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download iaotle/nova-bar-metrics
More information about iaotle/nova-bar-metrics
Files in iaotle/nova-bar-metrics
Package nova-bar-metrics
Short Description A Laravel Nova tool for bar chart metrics and frequency distributions.
License MIT
Informations about the package nova-bar-metrics
Updated for newest Laravel Nova!
A Laravel Nova tool for bar chart metrics and frequency distributions
This Nova tool lets you:
- create bar charts
- create frequency distribution charts (using pie charts and/or bar charts)
Bar Chart Metric Screenshot
Frequency Distribution Metric Screenshot (Bar Chart)
Frequency Distribution Metric Screenshot (Pie Chart)
Bar Chart Metrics
For a bar chart metric, just create a metric class like you normally would for a Partition
metric. All the available methods in a Partition
metric are also available for BarChartMetric
! Instead of extending Partition
you would just need to extend BarChartMetric
like so:
You can also use the suffix
, prefix
, dollars
and euros
methods like in a TrendMetric
in Laravel Nova. Besides this, we also have a precision
method to set the precision of the avg
metric shown in the top right corner of the bar chart.
Frequency Distributions for Bar Chart Metrics and Partition Metrics
To create a frequency distributions chart, either extend the BarChartMetric
class or extend the Partition
class and use the trait HasFrequencyDistributions
. You can use the distributions
helper method to create the frequency distribution chart like so:
Example for BarChartMetric
In the example above, 100000 is the step size
to use for the ranges in the frequency distribution and facebook_followers is the column to distribute
by ranges.
Instead of providing the step size
, you may provide the max number of steps instead using the distributionsWithSteps
method and the package would automatically calculate the step size like so:
For friendly formatted ranges (K for thousands, M for millions, B for billions), you can use the withFormattedRangeLabels
method like so:
Example for Partition Metric
Requirements & Dependencies
There are no PHP dependencies except the Laravel Nova package. On the frontend JS, this package uses vue
, chartist
, chartist-plugin-tooltips
and laravel-nova
, all of which are also used by Nova itself.
Installation
You can install this tool into a Laravel app that uses Nova via composer:
Next, if you do not have package discovery enabled, you need to register the provider in the config/app.php
file.
Usage
You can use the console command php artisan nova:barmetric <classname>
to create new BarMetric classes
Contributing
Contributions are welcome and will be fully credited as long as you use PSR-2, explain the issue/feature that you want to solve/add and back your code up with tests. Happy coding!
License
The MIT License (MIT). Please see License File for more information.