Giter Site home page Giter Site logo

vjvenky / chartello Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chartello/chartello

0.0 0.0 0.0 2.57 MB

Visualize your Laravel app data in simple dashboards.

Home Page: https://demo.chartello.com

License: MIT License

JavaScript 99.28% PHP 0.20% CSS 0.27% Vue 0.24% Blade 0.01%

chartello's Introduction

Chartello

tests GitHub license

Chartello provides a simple UI for visualizing your data in your Laravel-powered app.

screenshot

Demo →

Installation

Add the package to your project via composer:

composer require chartello/chartello

Publish the package resources:

php artisan chartello:install

Run new migrations:

php artisan migrate

Voilà! Open yourapp.test/chartello on your local machine. You should see the Chartello dashboard.

Configuration

Dashboard Authorization

Chartello dashboards allow users to write SQL queries against your database. This makes it important for you to ensure that they are protected behind appropriate permissions.

When you install Chartello, it adds a app\Http\Middleware\ProtectChartello middleware to your app. This, by default, limits the access to these dashboards only to your local environment. You should modify this middleware to define how access to these dashboards should be restricted in your production environment.

/**
 * Define the authorization logic for accessing Chartello.
 *
 * @param $request
 * @return bool
 */
protected function authorize($request)
{
    if (App::environment('local')) {
        return true;
    }

    return $request->user() && in_array($request->user()->email, [
        //
    ]);
}

Dashboard Routes

After installing Chartello, its configuration file will be located at config/chartello.php. This file allows you to customize the path to the Chartello dashboards and adjust HTTP middleware that should be used when serving them.

Usage

Writing Queries

Chartello currently supports two types of panels:

1. Trend Charts

A trend chart expects an x column with date/datetime values and a numeric y column.

To populate a trend chart, create a new panel in the UI and enter a query similar to this one:

SELECT DATE(created_at) AS x, COUNT(*) AS y
FROM users
WHERE created_at BETWEEN @start AND @end
GROUP BY x
ORDER BY x ASC

Including the BETWEEN @start AND @end filter ensures that your chart reflects the date range selection available in the UI.

2. Tables

Tables are flexible and accept almost any SELECT queries.

If you wish the data in your table to reflect the date selection from the UI, you should include the BETWEEN @start AND @end filter in your query.

Here is an example query for populating a table panel:

SELECT name, email, created_at
FROM users
WHERE created_at BETWEEN @start AND @end
ORDER BY created_at DESC
LIMIT 5

License

The MIT License (MIT). Please see License File for more information.

chartello's People

Contributors

matt-daneshvar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.