wpbones/morris-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wpbones/morris-php

Composer 安装命令:

composer require wpbones/morris-php

包简介

WPBones fluent PHP helper classes for morris.js

README 文档

README

Latest Stable Version   Latest Unstable Version   Total Downloads   License   Monthly Downloads

This package provides a simple way to use the MorrisJS library in your WordPress plugin.

MorrisJS PHP version for WP Bones

Requirements

This package works with a WordPress plugin written with WP Bones framework library.

Installation

You can install third party packages by using:

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:

composer require wpbones/morris-php

You may also to add "wpbones/morris-php": "~0.7" in the composer.json file of your plugin:

  "require": {
    "php": ">=7.4.0",
    "wpbones/wpbones": "~1.5",
    "wpbones/morris-php": "~1.1"
  },

and run

composer install

Enqueue for Controller

You can use the provider to enqueue the styles.

use WPKirk\Http\Controllers\Controller;
use WPKirk\MorrisPHP\Morris;

class MorrisPHPController extends Controller
{
  public function index()
  {

    Morris::enqueue();

    return WPKirk()
      ->view('packages.morris-php.index')
      ->withAdminStyle('prism')
      ->withAdminScript('prism')
      ->withAdminStyle('wp-kirk-common');
  }
}

In your view:

<div id="morris-area"></div>

<?php

echo Morris::area( 'morris-area' )
           ->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 ]
                   ] );

统计信息

  • 总下载量: 97
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-11-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固