flatroy/nova-treemap-chart-card 问题修复 & 功能扩展

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

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

flatroy/nova-treemap-chart-card

最新稳定版本:0.0.2

Composer 安装命令:

composer require flatroy/nova-treemap-chart-card

包简介

A Laravel Nova card to show Treemap charts

README 文档

README

This package allows you to add three-map fields to your resource details page and dashboards in Nova.

example

DISCLAIMER:

This package is still work in progress. Feel free to help improve it.

Requirements

Installation

Just run:

composer require flatroy/nova-treemap-chart-card

After installation, you can use the components listed here.

Basic Usage

// in App\Nova\User
...
use Flatroy\NovaTreemapChartCard\NovaTreemapChartCard;
...

/**
 * Get the fields displayed by the resource.
 *
 * @param \Laravel\Nova\Http\Requests\NovaRequest $request
 * @return array
 */
public function fields(NovaRequest $request)
{
    $data = [
        ['x' => 'Design', 'y' => 0.051],
        ['x' => 'Accounting', 'y' => 0.050],
        ['x' => 'Data Science', 'y' => 0.048],
        ['x' => 'Marketing', 'y' => 0.046],
        ['x' => 'Quality Assurance', 'y' => 0.046],
        ['x' => 'R&D', 'y' => 0.046],
    ];
    
    return [
        ...
        (new NovaTreemapChartCard())
            ->title('Some custom title')
            ->series($data)
            ->onlyOnDetail(),
        // or you can use like that:
        (new NovaTreemapChartCard())
            ->title('Some other custom title')
            ->series($this->model()?->find($request->resourceId)?->chartData)
            ->onlyOnDetail(),
        // or you can suggest how to do it better?
        ...
    ];
}


// if you want to put logic inside model - add this inside model:

namespace App\Models;
...
class User extends Model
{
...
    protected function getChartDataAttribute()
    {
        return [
            ['x' => 'Design', 'y' => 0.051],
            ['x' => 'Accounting', 'y' => 0.050],
            ['x' => 'Data Science', 'y' => 0.048],
            ['x' => 'Marketing', 'y' => 0.046],
            ['x' => 'Quality Assurance', 'y' => 0.046],
            ['x' => 'R&D', 'y' => 0.046],
        ];
    }
...
}

Feel free to come with suggestions for improvements.

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固