Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wpbones/morris-php
https://github.com/wpbones/morris-php
charting-library charts morris morris-javascript morris-php wordpress wp-bones wp-bones-packages
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/wpbones/morris-php
- Owner: wpbones
- License: bsd-2-clause
- Created: 2016-10-23T12:33:02.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2024-10-24T16:49:34.000Z (3 months ago)
- Last Synced: 2024-10-25T23:54:16.080Z (2 months ago)
- Topics: charting-library, charts, morris, morris-javascript, morris-php, wordpress, wp-bones, wp-bones-packages
- Language: PHP
- Size: 18.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# MorrisJS PHP version for WP Bones
[![Latest Stable Version](https://poser.pugx.org/wpbones/morris-php/v/stable?style=for-the-badge)](https://packagist.org/packages/wpbones/morris-php)
[![Latest Unstable Version](https://poser.pugx.org/wpbones/morris-php/v/unstable?style=for-the-badge)](https://packagist.org/packages/wpbones/morris-php)
[![Total Downloads](https://poser.pugx.org/wpbones/morris-php/downloads?style=for-the-badge)](https://packagist.org/packages/wpbones/morris-php)
[![License](https://poser.pugx.org/wpbones/morris-php/license?style=for-the-badge)](https://packagist.org/packages/wpbones/morris-php)
[![Monthly Downloads](https://poser.pugx.org/wpbones/morris-php/d/monthly?style=for-the-badge)](https://packagist.org/packages/wpbones/morris-php)This package provides a simple way to use the [MorrisJS](https://morrisjs.github.io/morris.js/) library in your WordPress plugin.
![MorrisJS PHP version for WP Bones](https://github.com/user-attachments/assets/194a457a-f48e-41f5-bcd7-8676b5506457)
## Requirements
This package works with a WordPress plugin written with [WP Bones framework library](https://github.com/wpbones/WPBones).
## Installation
You can install third party packages by using:
```sh copy
php bones require wpbones/morris-php
```I advise to use this command instead of `composer require` because doing this an automatic renaming will done.
You can use composer to install this package:
```sh copy
composer require wpbones/morris-php
```You may also to add `"wpbones/morris-php": "~0.7"` in the `composer.json` file of your plugin:
```json copy filename="composer.json" {4}
"require": {
"php": ">=7.4.0",
"wpbones/wpbones": "~1.5",
"wpbones/morris-php": "~1.0"
},
```and run
```sh copy
composer install
```## Enqueue for Controller
You can use the provider to enqueue the styles.
```php copy
public function index()
{
// enqueue the minified version
Morris::enqueue();// ...
}
```In your view:
```php copy filename="your_view.php" copy
xkey( [ 'y' ] )
->ykeys( [ 'a', 'b' ] )
->labels( [ 'Series A', 'Series B' ] )
->hoverCallback( 'function(index, options, content){var row = options.data[index];return "sin(" + row.x + ") = " + row.y;}' )
->data( [
[ "y" => '2006', "a" => 100, "b" => 90 ],
[ "y" => '2007', "a" => 75, "b" => 65 ],
[ "y" => '2008', "a" => 50, "b" => 40 ],
[ "y" => '2009', "a" => 75, "b" => 65 ],
[ "y" => '2010', "a" => 50, "b" => 40 ],
[ "y" => '2011', "a" => 75, "b" => 65 ],
[ "y" => '2012', "a" => 100, "b" => 90 ]
] );
```