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.
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
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-19
