PHPackages                             abhilash/sales-charts - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. abhilash/sales-charts

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

abhilash/sales-charts
=====================

Generate Charts for Sales Purposes

07PHP

Since Dec 15Pushed 4y ago1 watchersCompare

[ Source](https://github.com/abhilash14001/Sales-Chart)[ Packagist](https://packagist.org/packages/abhilash/sales-charts)[ RSS](/packages/abhilash-sales-charts/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Sales-Chart
===========

[](#sales-chart)

Generate Charts for Sales Purposes

Installation
------------

[](#installation)

```
composer require abhilash/sales-chart

```

Usage
-----

[](#usage)

[![Sales Charts - Projects which is ongoing and completed](https://camo.githubusercontent.com/d07c2596aaaf2d9ad35dcb5ecd252fd1b1c29cdbe012483b6a6393cba9de4081/68747470733a2f2f76796d6170732e7465616d3234736576656e2e6f6e6c696e652f6173736574732f696d616765732f63686172742e706e67)](https://camo.githubusercontent.com/d07c2596aaaf2d9ad35dcb5ecd252fd1b1c29cdbe012483b6a6393cba9de4081/68747470733a2f2f76796d6170732e7465616d3234736576656e2e6f6e6c696e652f6173736574732f696d616765732f63686172742e706e67)

If you want to generate a chart above, grouping **project\_price** by month and year of **project\_submit\_date** or **created\_at** value according to your choice, here's the code.

**Controller**:

```
use Abhilash\SalesCharts\SalesChartServices\SalesCharts;

// ...

  $groupBy = function ($item) {

            return Carbon::create($item->project_submit_date)->format("Y-m");

        };

        $map_condition_for_completed = function ($func) {

            if ($func->status != 'completed') {

                $func->price = 0;
            }

            return $func;

        };

        $map_condition_for_ongoing = function ($func) {

            if ($func->status != 'ongoing') {

                $func->price = 0;
            }

            return $func;

        };

        $select_condition = function ($query) {
            return $query->select('payment_projects.price as price', 'projects.price as total_price', 'project_submit_date', 'status');
        };
        $options_for_completed_project = [
            'chart_type' => 'line',
            'label_name' => 'Completed',
            'chart_title' => 'sales_price',
            'model' => Projects::class,                //model name to be entered
            'order_by' => 'project_submit_date',
            'label_field' => 'project_submit_date',
            'group_by' => $groupBy,
            'map_condition' => $map_condition_for_completed,
            'chart_options' => [
                'backgroundColor' => 'rgba(60, 141, 188, 0.9)',
                'borderColor' => 'rgba(60, 141, 188, 0.8)',
            ]
        ];

        $options_for_ongoing_project = [
            'chart_type' => 'line',
            'label_name' => 'Ongoing',
            'chart_title' => 'sales_price',
            'model' => Projects::class,                                 //model name to be entered

  'order_by' => 'project_submit_date',
            'label_field' => 'project_submit_date',
            'group_by' => $groupBy,
            'map_condition' => $map_condition_for_ongoing,
            'join_type' => 'leftjoin',
            'select_condition' => $select_condition,

            'join_condition' => ['payment_projects', 'payment_projects.projects_id', 'projects.id'],

            'chart_options' => [

                'backgroundColor' => 'rgba(210, 214, 222, 1)',
                'borderColor' => 'rgba(210, 214, 222, 1)'
            ],
        ];
$chart = new SalesCharts($options_for_ongoing_project, $options_for_completed_project);     //can pass either 1 or 2 arguments based on your requirement

return view('dashboard', compact('chart'));

```

**View File**

```
@extends('layouts.app')

@section('content')

                Dashboard

                    {!! $chart->renderHtml() !!}

@endsection

@section('js')
{!! $chart->renderScripts() !!}
@endsection

```

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/90bb926709e2b36694c94f143522f518db6e0f318ff63249c7a7a0599e4f9b75?d=identicon)[abhilash14001](/maintainers/abhilash14001)

---

Top Contributors

[![abhilash14001](https://avatars.githubusercontent.com/u/66018792?v=4)](https://github.com/abhilash14001 "abhilash14001 (22 commits)")

### Embed Badge

![Health badge](/badges/abhilash-sales-charts/health.svg)

```
[![Health](https://phpackages.com/badges/abhilash-sales-charts/health.svg)](https://phpackages.com/packages/abhilash-sales-charts)
```

###  Alternatives

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.4k187.2M2.6k](/packages/composer-composer)[symfony/event-dispatcher

Provides tools that allow your application components to communicate with each other by dispatching events and listening to them

8.6k985.9M3.4k](/packages/symfony-event-dispatcher)[symfony/polyfill-php80

Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions

1.7k815.2M457](/packages/symfony-polyfill-php80)[symfony/var-exporter

Provides tools to export, instantiate, hydrate, clone and lazy-load PHP objects

2.1k378.1M441](/packages/symfony-var-exporter)[seld/phar-utils

PHAR file format utilities, for when PHP phars you up

875180.0M32](/packages/seld-phar-utils)[dansmith/laravel5-foundation

Zurb Foundation components for Laravel5

104.6k](/packages/dansmith-laravel5-foundation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
