-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 95a3413
Showing
19 changed files
with
518 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/.idea | ||
/vendor | ||
/node_modules | ||
package-lock.json | ||
composer.phar | ||
composer.lock | ||
phpunit.xml | ||
.phpunit.result.cache | ||
.DS_Store | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 George Daneke | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# Nova Threemap Chart Card | ||
|
||
|
||
This package allows you to add three-map fields to your resource details page and dashboards in [Nova](https://nova.laravel.com). | ||
|
||
It basically takes a field with a decimal value between 0 and 1 and shows it as a percentage progress bar. | ||
|
||
To edit a field, we recommend using the standard Number (\Laravel\Nova\Fields\Number) field. | ||
|
||
<img src="https://github.com/flatroy/nova-progressbar-field/blob/main/img/img.png" alt="example"> | ||
|
||
#### DISCLAIMER: | ||
|
||
This package is still work in progress. Feel free to help improve it. | ||
|
||
- [Requirements](#requirements) | ||
- [Installation](#installation) | ||
- [Basic Usage](#basic-usage) | ||
- [Advanced Options](#advanced-options) | ||
|
||
--- | ||
|
||
## Requirements | ||
|
||
- [Laravel v9.0.\*](https://laravel.com/docs/9.0) | ||
- [Laravel Nova v4.\*](https://nova.laravel.com/docs/4.0/) | ||
|
||
--- | ||
|
||
## Installation | ||
|
||
Just run: | ||
|
||
```bash | ||
composer require flatroy/nova-treemap-chart-card | ||
``` | ||
|
||
After this the setup will be complete, you can use the components listed here. | ||
|
||
--- | ||
|
||
## Basic Usage | ||
|
||
```php | ||
// in App\Nova\User | ||
... | ||
use Flatroy\FieldProgressbar\FieldProgressbar; | ||
use Laravel\Nova\Fields\Number; | ||
... | ||
|
||
/** | ||
* 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "flatroy/nova-treemap-chart-card", | ||
"description": "A Laravel Nova card to show Treemap charts", | ||
"keywords": [ | ||
"laravel", | ||
"nova", | ||
"treemap", | ||
"chart", | ||
"card", | ||
"apexcharts" | ||
], | ||
|
||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "George Daneke", | ||
"email": "[email protected]", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": "^7.4|^8.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Flatroy\\NovaTreemapChartCard\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Flatroy\\NovaTreemapChartCard\\CardServiceProvider" | ||
] | ||
} | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/*! | ||
* ApexCharts v3.35.3 | ||
* (c) 2018-2022 ApexCharts | ||
* Released under the MIT License. | ||
*/ | ||
|
||
/*! svg.draggable.js - v2.2.2 - 2019-01-08 | ||
* https://github.com/svgdotjs/svg.draggable.js | ||
* Copyright (c) 2019 Wout Fierens; Licensed MIT */ | ||
|
||
/*! svg.filter.js - v2.0.2 - 2016-02-24 | ||
* https://github.com/wout/svg.filter.js | ||
* Copyright (c) 2016 Wout Fierens; Licensed MIT */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"/js/card.js": "/js/card.js", | ||
"/css/card.css": "/css/card.css" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const mix = require('laravel-mix'); | ||
const webpack = require('webpack'); | ||
const path = require('path'); | ||
|
||
class NovaExtension { | ||
name() { | ||
return 'nova-extension'; | ||
} | ||
|
||
register(name) { | ||
this.name = name; | ||
} | ||
|
||
webpackConfig(webpackConfig) { | ||
webpackConfig.externals = { | ||
vue: 'Vue', | ||
}; | ||
|
||
webpackConfig.resolve.alias = { | ||
...(webpackConfig.resolve.alias || {}), | ||
'laravel-nova': path.join(__dirname, '../../vendor/laravel/nova/resources/js/mixins/packages.js'), | ||
}; | ||
|
||
webpackConfig.output = { | ||
uniqueName: this.name, | ||
}; | ||
} | ||
} | ||
|
||
mix.extend('nova', new NovaExtension()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"dev": "npm run development", | ||
"development": "mix", | ||
"watch": "mix watch", | ||
"watch-poll": "mix watch -- --watch-options-poll=1000", | ||
"hot": "mix watch --hot", | ||
"prod": "npm run production", | ||
"production": "mix --production", | ||
"nova:install": "npm --prefix='../../vendor/laravel/nova' ci" | ||
}, | ||
"devDependencies": { | ||
"@vue/compiler-sfc": "^3.2.22", | ||
"laravel-mix": "^6.0.41", | ||
"postcss": "^8.3.11", | ||
"vue-loader": "^16.8.3" | ||
}, | ||
"dependencies": { | ||
"apexcharts": "^3.35.3", | ||
"vue3-apexcharts": "^1.4.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* Nova Card CSS */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Card from './components/Card'; | ||
|
||
Nova.booting((app, store) => { | ||
app.component('nova-treemap-chart-card', Card); | ||
}); |
Oops, something went wrong.