Giter Site home page Giter Site logo

kevinkhill / lavacharts Goto Github PK

View Code? Open in Web Editor NEW
618.0 24.0 143.0 11.17 MB

Lavacharts is a graphing / charting library for PHP 5.4+ that wraps Google's Javascript Chart API.

Home Page: http://lavacharts.com

License: Other

PHP 91.98% JavaScript 8.02%
php graphing charting-library composer google-charts charts

lavacharts's Introduction

Lavacharts 3.1.12

Total Downloads License Minimum PHP Version Gitter PayPal

Lavacharts is a graphing / chart library for PHP5.4+ that wraps the Google Chart API.

Stable: Current Release Build Status Coverage Status

Dev: Development Release Build Status Coverage Status

Developer Note

Please don't be discouraged if you see that it has been "years" since an update, but rather think that Lavacharts has settled into a "stable" state and requires less tinkering from me. I would love to add new features, but my responsibilities leave little room for my projects. I am happy to field issues, answer questions, debug and help if needed. Lavacharts is not vaporware! 😄

Package Features

  • Updated! Laravel 5.5+ auto-discovery
  • Any option for customizing charts that Google supports, Lavacharts should as well. Just use the chart constructor to assign any customization options you wish!
  • Visit Google's Chart Gallery for details on available options
  • Custom JavaScript module for interacting with charts client-side
    • AJAX data reloading
    • Fetching charts
    • Events integration
  • Column Formatters & Roles
  • Blade template extensions for Laravel
  • Twig template extensions for Symfony
  • Carbon support for date/datetime/timeofday columns
  • Now supporting 22 Charts!
    • Annotation, Area, Bar, Bubble, Calendar, Candlestick, Column, Combo, Gantt, Gauge, Geo, Histogram, Line, Org, Pie, Sankey, Scatter, SteppedArea, Table, Timeline, TreeMap, and WordTree!

For complete documentation, please visit lavacharts.com

For contributing, a handy guide can be found here


Installing

In your project's main composer.json file, add this line to the requirements:

"khill/lavacharts": "^3.1"

Run Composer to install Lavacharts:

$ composer update

Framework Agnostic

If you are using Lavacharts with Silex, Lumen or your own Composer project, that's no problem! Just make sure to: require 'vendor/autoload.php'; within you project and create an instance of Lavacharts: $lava = new Khill\Lavacharts\Lavacharts;

Laravel

To integrate Lavacharts into Laravel, a ServiceProvider has been included.

Laravel ~5.5

Thanks to the fantastic new Package Auto-Discovery feature added in 5.5, you're ready to go, no registration required 👍

Configuration

To modify the default configuration of Lavacharts, datetime formats for datatables or adding your maps api key... Publish the configuration with php artisan vendor:publish --tag=lavacharts

Laravel ~5.4

Register Lavacharts in your app by adding these lines to the respective arrays found in config/app.php:

<?php
// config/app.php

// ...
'providers' => [
    // ...

    Khill\Lavacharts\Laravel\LavachartsServiceProvider::class,
],

// ...
'aliases' => [
    // ...

    'Lava' => Khill\Lavacharts\Laravel\LavachartsFacade::class,
]

Configuration

To modify the default configuration of Lavacharts, datetime formats for datatables or adding your maps api key... Publish the configuration with php artisan vendor:publish --tag=lavacharts

Laravel ~4

Register Lavacharts in your app by adding these lines to the respective arrays found in app/config/app.php:

<?php
// app/config/app.php

// ...
'providers' => array(
    // ...

    "Khill\Lavacharts\Laravel\LavachartsServiceProvider",
),

// ...
'aliases' => array(
    // ...

    'Lava' => "Khill\Lavacharts\Laravel\LavachartsFacade",
)

Configuration

To modify the default configuration of Lavacharts, datetime formats for datatables or adding your maps api key... Publish the configuration with php artisan config:publish khill/lavacharts

Symfony

The package also includes a Bundle for Symfony to enable Lavacharts as a service that can be pulled from the Container.

Add Bundle

Add the bundle to the registerBundles method in the AppKernel, found at app/AppKernel.php:

<?php
// app/AppKernel.php

class AppKernel extends Kernel
{
    // ..

    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Khill\Lavacharts\Symfony\Bundle\LavachartsBundle(),
        );
    }
}

Import Config

Add the service definition to the app/config/config.yml file

imports:
  # ...
  - { resource: "@LavachartsBundle/Resources/config/services.yml"

Usage

The creation of charts is separated into two parts: First, within a route or controller, you define the chart, the data table, and the customization of the output.

Second, within a view, you use one line and the library will output all the necessary JavaScript code for you.

Basic Example

Here is an example of the simplest chart you can create: A line chart with one dataset and a title, no configuration.

Controller

Setting up your first chart.

Data

$data = $lava->DataTable();

$data->addDateColumn('Day of Month')
     ->addNumberColumn('Projected')
     ->addNumberColumn('Official');

// Random Data For Example
for ($a = 1; $a < 30; $a++) {
    $rowData = [
      "2017-4-$a", rand(800,1000), rand(800,1000)
    ];

    $data->addRow($rowData);
}

Arrays work for datatables as well...

$data->addColumns([
    ['date', 'Day of Month'],
    ['number', 'Projected'],
    ['number', 'Official']
]);

Or you can use \Khill\Lavacharts\DataTables\DataFactory to create DataTables in another way

Chart Options

Customize your chart, with any options found in Google's documentation. Break objects down into arrays and pass to the chart.

$lava->LineChart('Stocks', $data, [
    'title' => 'Stock Market Trends',
    'animation' => [
        'startup' => true,
        'easing' => 'inAndOut'
    ],
    'colors' => ['blue', '#F4C1D8']
]);

Output ID

The chart will needs to be output into a div on the page, so an html ID for a div is needed. Here is where you want your chart <div id="stocks-div"></div>

  • If no options for the chart are set, then the third parameter is the id of the output:
$lava->LineChart('Stocks', $data, 'stocks-div');
  • If there are options set for the chart, then the id may be included in the options:
$lava->LineChart('Stocks', $data, [
    'elementId' => 'stocks-div'
    'title' => 'Stock Market Trends'
]);
  • The 4th parameter will also work:
$lava->LineChart('Stocks', $data, [
    'title' => 'Stock Market Trends'
], 'stocks-div');

View

Pass the main Lavacharts instance to the view, because all of the defined charts are stored within, and render!

<?= $lava->render('LineChart', 'Stocks', 'stocks-div'); ?>

Or if you have multiple charts, you can condense theh view code withL

<?= $lava->renderAll(); ?>

Changelog

The complete changelog can be found here

Stargazers over time

Stargazers over time

lavacharts's People

Contributors

am-css avatar amismb avatar antoniotajuelo avatar chaerilm avatar darklotus avatar elpiel-efuture avatar kevinkhill avatar lex111 avatar marcusirgens avatar miqwit avatar mpociot avatar nelsonbaez avatar rajivseelam avatar roarkmccolgan avatar stevebauman avatar stonos avatar timp999 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lavacharts's Issues

Laravel5 support

Hi

I might be wrong but I think it's not compatible with Laravel5.

I get

  [BadMethodCallException]
  Call to undefined method [package]

Script php artisan clear-compiled handling the post-update-cmd event returned with an error

  [RuntimeException]
  Error Output:

right after I add 'Khill\Lavacharts\Laravel\LavachartsServiceProvider', in app.php as instructed for Laravel.

Seems OK in Laravel4.
Would you like to make it compatible with Laravel5?

Better Support for Multiple charts on a page

When having multiple charts (different kind of charts) on a page, there are various issues regarding the js output, one major factor is that for each output the google jsapi inclusion is added, as I am at the moment, having anywhere between 10 - 15 charts on a page this is seriously going to impact on the calls/load times etc of a page.

Along with other elements associated with having multiple charts on a page (see issue #9) perhaps more support for multiple charts being added could be added in to future versions.....

Carbon Version

khill/lavacharts 2.4.2 requires nesbot/carbon ~1.14

The app I want to use this with requires nesbot/carbon 1.8.

Can change your composer.json to allow for >= 1.14?

Error in Laravel 5.1

Hi guys,

When trying to use Lavacharts with Laravel 5.1 we've got this error. Any help would be very appreciated.

[2015-05-26 15:25:16] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Illuminate\View\Compilers\BladeCompiler::createMatcher()' in /opt/www/orclstat/vendor/khill/lavacharts/src/Laravel/BladeTemplateExtensions.php:23
Stack trace:
#0 {main}

Composer fails on install

having trouble installing via composer:

Your requirements could not be resolved to an installable set of packages.

Problem 1
- khill/lavacharts 2.0.1 requires nesbot/carbon 1.13.* -> satisfiable by nesbot/carbon[1.13.0].
- khill/lavacharts 2.0.2 requires nesbot/carbon 1.13.* -> satisfiable by nesbot/carbon[1.13.0].
- khill/lavacharts 2.0.3 requires nesbot/carbon 1.13.* -> satisfiable by nesbot/carbon[1.13.0].
- khill/lavacharts 2.0.4 requires nesbot/carbon 1.13.* -> satisfiable by nesbot/carbon[1.13.0].
- Conclusion: don't install nesbot/carbon 1.13.0
- Installation request for khill/lavacharts 2.0.* -> satisfiable by khill/lavacharts[2.0.1, 2.0.2, 2.0.3, 2.0.4].

I am running 1.4 of carbon - how can I get around this?

namespace 'Khill\Lavacharts\Javascript\JavascriptFactory' not found

hi,

the namespace 'Khill\Lavacharts\Javascript\JavascriptFactory' isn't good.
the class is located in Khill\Lavacharts\

Fatal error: Class 'Khill\Lavacharts\Javascript\JavascriptFactory' not found in /home/jeuconcours/public_html/dev/vendor/khill/lavacharts/src/Charts/Chart.php on line 427

lava.loadData NumberFormat

I have a graph that has a store's sales by default but a button lets the user select labor or cost of goods. Then the graph sends a new request and reloads that table data into the graph using the lava.loadData function. I think the function contains an automatic redraw but is there anyway I could get it to apply my NumberFormat? I know I am using is correctly and functions fine on the initial draw but when I use the function "lava.loadData" the data loads and redraws beautifully just without my NumberFormat where I am specifying a prefix and pattern when I create the initial column server side.

I'm thinking while typing this up and maybe If I can echo out that Lava::NumberFormat object right before the lava.loadData function call or inside the function? I feel like the function should look for the NumberFormat object and apply it if specified or I could just be doing it wrong. Hopefully you understand what I am saying and I can provide code to clear up confusion if needed.

Barchart problem

should be Votes and not Food Poll

            http://laravel.io/bin/1yYqb

Also, what is the blade equivalent of line 1 for line 4 please ? http://laravel.io/bin/BLyn9

You might want to include <?php instead of just <? which doesn't work on all systems and semicolon at end. Thanks !

disable routes?

Hi all. Great plugin, really easy to use. Was checking my routes today and noticed this one adds a few - how can I remove them?

| | GET|HEAD lavacharts |
| Closure | | |
| | GET|HEAD lavacharts/examples |
| Closure | | |
| | GET|HEAD lavacharts/examples2 |
| Closure | | |
| | GET|HEAD line/basic |
| Closure | | |
| | GET|HEAD line/advanced |

Working Without Composer

So I started to incorporate the Symfony autoloader and Carbon (from @briannesbitt) which seemed like a good idea to allow the usage of Lavacharts outside of composer. I then started thinking it might be a bad idea, to include other vendor files in the package, which would possibly double up when used with composer. I suppose I could create another repo, for a composerless install including the dependencies as well as this repo, which would be dedicated to using composer.

Basically, I don't know which would be the best route to take to include everyone. If anyone could give me ideas or guidance on the best route to take I would greatly appreciate it.

Chart binding label is hard coded in JavascriptFactory.php

Currently the dashboard only works if you pass the binding label as 'MyPie' in the controller because that label is hard coded in JavascriptFactory.php around line 292:

$boundChart = $dashboard->getBinding('MyPie')->getChartWrapper()->getChart();

I'm currently getting around this issue by calling getBindings() and pulling the label from the first result. I'm sure there's a better way to do this but it works:

$allBinding = $dashboard->getBindings();
foreach ($allBinding as $thisBinding)
{
$bindingLabel = $thisBinding->getLabel();
break;
}
$boundChart = $dashboard->getBinding($bindingLabel)->getChartWrapper()->getChart();

Can't render 2 charts with the same type in the same view

Using Laravel, I am trying to render multiple column (or pie) charts in the same view, but I just get the last one rendered. For example, if I render 2 pie charts and 1 column chart, I get the column chart, and the last piechart rendered, not both pies.

I wonder If this can be done, or am I missing something..

Thank you!!! :)

multiple charts

When using multiple charts on a single page an error will be thrown up.

Uncaught TypeError: Cannot set property 'data' of undefined.

(when removing one of the charts, the chart does work)

Can't we support all of Google Charts' options?

I think Lavacharts should support any Google Charts option instead of just an arbitrary subset of them. For example, there seem to be no way to add legend.maxLines; neither as maxLines on the Legend object nor as pure legend.maxLines on the *Chart.

Now I just get this exception:

"maxLines" is not a valid property for Legend->__construct, must be one of [ alignment | position | textStyle ]

It feels like such an arbitrary limitation. I would love it if Lavacharts were just a small wrapper around the Google Charts API. What do you think?

Event callback is displaying error: "lava.event is not a function."

I have a Lavacharts Areachart displaying a stock price graph and it's working fine. I'd like to give users the ability to change the graph's time frame by clicking buttons. (see image below).
lava event error

I'm using Laravel 5.1.
Here is some relevant code from my view:

<script type="text/javascript">
        function loadDataHandler(loadData, StockPrice){
            console.log(StockPrice.loadData());
        }

        function getGraphData(timeFrame){
            $.getJSON('/graph/'+ '{{ $stock->stock_code }}/' + timeFrame, function (dataTableJson) {
                console.log(dataTableJson);
                lava.loadData('StockPrice', dataTableJson, function (chart) {
                    console.log(chart);
                });
            });
        }
</script>

<div class="btn-group btn-group-sm" role="group">
  <button class="btn btn-default active" onclick="getGraphData('last_month')">30 Days</button>
  <button class="btn btn-default" onclick="getGraphData('last_3_months')">3 Months</button>
  <button class="btn btn-default" onclick="getGraphData('last_6_months')">6 Months</button>
  <button class="btn btn-default" onclick="getGraphData('last_year')">12 Months</button>
  <button class="btn btn-default" onclick="getGraphData('last_2_years')">2 Years</button>
  <button class="btn btn-default" onclick="getGraphData('last_5_years')">5 Years</button>
  <button class="btn btn-default" onclick="getGraphData('last_10_years')">All</button>
<button class="btn btn-default" onclick="getGraphData('all_time')">10 Years</button>
</div>

@areachart('StockPrice', 'stock_price_div')

I have two functions in my controller, this one generates the initial graph shown in the screenshot above.

    public function show($id){
        $graphData = $this->stock->getGraphData($id);
        $stockPriceLava = new Lavacharts;
        $prices = \Lava::DataTable();
        $prices->addStringColumn('Date')
            ->addNumberColumn('Price')
            ->addRows($graphData);

        $stockPriceLava = \Lava::AreaChart('StockPrice')
            ->dataTable($prices)
            ->setOptions([
                'width' => 550,
                'height' => 325,
                'title' => 'Price of '.strtoupper($id),
                'events' => ['ready' => \Lava::Ready('getGraphData')]
            ]);

        return view('pages.individualstock')->with([
            'stockPriceLava' => $stockPriceLava,
            'stock' => Stock::where('stock_code', $id)->first(),
            'metrics' => StockMetrics::where('stock_code', $id)->first()
        ]);
}

And this one returns the DataTable JSON based on the stock code and the timeframe.

public function graph($stockCode, $timeFrame){
        $graphData = $this->stock->getGraphData($stockCode, $timeFrame);
        $prices = \Lava::DataTable();
        $prices->addStringColumn('Date')
            ->addNumberColumn('Price')
            ->addRows($graphData);
        return $prices->toJson();
}

This is the route for the AJAX call.

Route::get('graph/{stockCode}/{timeFrame}', 'StockController@graph');

When I click each of the buttons, JSONs of the correct sizes are being returned according to the console log, however the graph doesn't update, and I have that red error in the corner telling me that, "lava.event is not a function". There are no errors or warnings in the console.

Searching for "lava.event" in the page's source code reveals this line:

google.visualization.events.addListener($this.chart, "ready", function (event) {return lava.event(event, $this.chart, getGraphData);});

Any ideas as to what I'm doing wrong here?

How to access chart options?

Hey, I'm just curious how you access chart options? Are these not set in the config array when you build a graph like so?:

$config = array( 'title'=>'Tickets by Category', 'chartArea' => array('width'=>'100%') );

Lava::PieChart($config['title'])->setConfig($config);

unable to use library with Laravel5

i have added the requirement to the composer.json and did composer update

used one of the examples (pie chart)

and added the provider...which then failes with:
BadMethodCallException in ServiceProvider.php line 111:
Call to undefined method [package]

ErrorException in Lavacharts.php line 156: Undefined variable: lavaClass

Hey,

with the dev version, I always get:
ErrorException in Lavacharts.php line 156: Undefined variable: lavaClass

I already updated the code to the new constructor. Any idea what the cause for this might be? Can't post the code right now because I am not at the office but thought that you maybe have an answer anyways that could help.

Thank you!

Pie Chart doesn´t render decimal values?

Hi,

I use your fantastic package in a small app, but i have 2 problems:

  1. I´m recording expenses, and the app must be capable to save amounts like this 12.50 but the pie chart doesn´t work when amounts have this format 12.50 just this format 12 or 125.
  2. The other problem is that the pie chart only work in my local wamp server when i deploy to hostgator to a shared hosting (all other funtion work) but the pie chart doesn´t work.

This is the Pie chart in local

image

And this is the same app in hostgator

image

I upload a simple example of Google Charts to the server and works

image

What you think can be the cause of this?

CategoryFilter does not pass $columnLabel

CategoryFilter does not pass the required $columnLabel. It works when I change /src/Filters/Category.php line 11 from:

public function __construct()

to

public function __construct($columnLabel)

Calendar Chart cannot show multiple years records as in data set

I manually swapped the record using the demo code shown in here (http://lavacharts.com/#example-calendar). To be exact, I change

foreach (range(2, 5) as $month) {
    for ($a=0; $a < 20; $a++) {
        $day = rand(1, 30);
        $sales->addRow(array("2014-${month}-${day}", rand(0,100)));
    }
}

to

$sales->addRow(array("2015-1-1", 30));
$sales->addRow(array("2014-3-5", 40));

There should be two records, one from 2014, another from 2015. However, the resulting graph is like this:
image

Looks like the record of 2015 is totally missing, any ideas on how to resolve?

Laravel says "Class 'App\Http\Controllers\Lava' not found"

After adding "khill\lavacharts" : "2.2.*" to composer.json, executing "composer update" and adding "Khill\Lavacharts\Laravel\LavachartsServiceProvider" in app.php, when I use "Khill\Lavacharts\Lavacharts" from custom Controller, Laravel returns an error saying that class 'App\Http\Controllers\Lava' is not found.

I'm using Laravel 5.

focusTarget option not available

Hey,

it looks like that the focusTarget option is only available for the BarChart, even though the other charts would support it as well. I would need it for Line and Area Charts to show values that are beneath others.

Thanks

export to excel

Is there any chance that you will make it possible to export charts to excel/csv ?

How to use Lavacharts in CodeIgniter ?

Hi,

I would like to use Lavacharts as a CodeIgniter helper. I put the src/Khill/Lavachart drectory in my helpers directory and created a lavacharts_helper.php file :

require_once APPPATH."/helpers/Lavacharts/Lavacharts.php";

Then, I try to call it with :

$lava = new Lavacharts();

But it did'nt worked. So I tried :

$lava = new Khill\Lavacharts\Lavacharts();

But I got a fatal error : "Fatal error: Class 'Khill\Lavacharts\Volcano' not found in application/helpers/Lavacharts/Lavacharts.php on line 118"

I don't use Composer or Laravel. Is it mandatory ?

Thanks

Support for ScatterChart

Are there any plans for adding support for ScatterChart? I've need for that and I've already found it easy to add new class and support for it. It's mostly compatible with columnChart but it has some own configuration options for points. However I don't know your policy for accepting pull requests for new chart-types.

If you not currently working on it, I could create new chart-class add support for at least to those point-specific options and add corresponding test-file. Do you think that's good way to proceed?

Having trouble.

I'm using dev-dev, since dev-master won't work. I can't seem to get this code working.

        $salesTable = Lava::DataTable('Sales');
        $salesTable->addColumn('number', 'Day', 'day');
        $salesTable->addColumn('number', 'Sales', 'sales');
        $salesTable->addColumn('number', 'Amount', 'amount');
        foreach()
            $data[0] = date('d', $time);
            $data[1] = $output[date('d', $time)]['price'];
            $data[2] = $output[date('d', $time)]['amount'];
            $salesTable->addRow($data);
        }

        $config = array(
            'title' => 'AnF Sales',
        );
       Lava::LineChart('Sales')
                 ->setConfig($config))->outputInto('sales_div');

I've got this code, and it says the label is empty. I can't find out how to set the chart label. If i remove output into and dd it, the label isn't set.

Error with options

Hey, awesome package sadly I have a problem:

Argument 1 passed to Khill\Lavacharts\Charts\Chart::backgroundColor() must be an instance of Khill\Lavacharts\Configs\BackgroundColor, string given

My Code:

        $loginAttempts = LavachartsFacade::DataTable();

        $loginAttempts->addDateColumn('Date')
            ->addNumberColumn('Successful Attempts')
            ->addNumberColumn('Failed Attempts')
            ->addRow(array('2014-10-1', 67, 65))
            ->addRow(array('2014-10-2', 67, 18))
            ->addRow(array('2014-10-3', 0, 0))
            ->addRow(array('2014-10-4', 67, 65))
            ->addRow(array('2014-10-5', 67, 18))
            ->addRow(array('2014-10-6', 80, 64));

        $linechart = LavachartsFacade::LineChart('Temps')
            ->dataTable($loginAttempts)
            ->title('Login attempts within the last 7 days')
            ->setOptions(['backgroundColor' => 'red']);

Same error when I use ->backgroundColor

What am I doing wrong? I use Laravel 5.

Thanks

How to properly add a callback?

Hey,

sorry for this kind of question, sadly I am not that good with JS and can't figure out how to do that.

What I want is to call a JS function after the chart has been rendered and is ready to be displayed. How can I achieve that?

I tried adding this into PHP:

LavachartsFacade::Ready('test');

and this into the blade template:

    <script>

        function test (event, chart) {
            alert('Test');

            // Useful for using chart methods such as chart.getSelection();
            console.log(chart.getSelection());
        }
    </script>

Sadly the alert won't appear. What is the correct way to do that?

Thank you very much for your help!

Scatter Plot?

Would you consider supporting Scatter plot charts?

These are somewhat more useful than Gauge charts.

-FT

Js issue

Hi, i'm getting "ReferenceError: google is not defined" in chrome dev tools, my code is the one of the donut example (exactly the same), extra: the blade view code is inside a ng-view that loads dynamic
http://lavacharts.com/#example-donut

Charts supported

Are all of these charts supported please ?
developers.google.com/chart/interactive/docs/gallery/barchart

Feature requests

Hey,

there are some things for which I could not see a solution in the docs, please correct me if i missed something. I think that those things might be useful therefore I will write them down and you can decide what you think about them and maybe implement them in future version.

  1. [DONE] Is there a way to check if the requested chart is available, to avoid an exception when trying to display a non existing chart? That should not be the case, but it would be more convenient to display something like "Graph currently unavailable" instead of having to deal with possible exceptions if something goes wrong.

  2. [DONE] Is there a way to load/reload an chart over AJAX? For example when the user presses a button?

  3. [ALREADY IMPLEMENTED] Currently the JavaScript code is placed right where the chart should be displayed. Is this required, or would it be possible to place it at a custom location? I wanted to show an loading overlay until the chart has been rendered, sadly now the JS code for the chart(s) is executed way before the code for the overlay.

  4. Is there a way to define a path where the required assets are stored locally? Currently it loads them from Google, which is not that great if you want to do performance optimizations.

Those are my ideas/concerns/questions that came up while working with the charts. Maybe there are some more in the future. Besides that, an amazing product. Really happy to found something like that.

Best regards,
Michael

Extending Lavacharts

Hi, first of all I want say that you have created a wonder wrapper for the Google Charts API. My only issue is that I want to extend the Lavacharts class with some functionality that is particular to the Laravel 5 project I am working on but I cannot add methods to this child class because of the last method_exists condition within the __call method . Is there any reason for not allowing your package to be extensible?

DonutChart not allowed

Hi kevin,

First of all thanks for your work, it's so useful for me!

I'm trying to create a DonutChart, but I'm getting a message in a blank page saying "No direct script access allowed" and I can't do nothing. PieChart works as expected.

Thank you.

Date format

Hi,

I'm curious if it's possible to change how dates are displayed in the graph(failled to find info about)

For example, right now a date is displayed as "Sep 12, 2014" and I would like to display it as "12/08/2014".

Thanks

Uncaught TypeError when rendering two charts on the same page

I'm trying to render two separate charts on one page. One Area Chart and one Bar Chart, both with different titles. Individually, either chart will render just fine with no errors, however when I try to render them both at the same time, neither chart is displayed and Google Chrome's console shows the following error:
"Uncaught TypeError: Cannot read property 'StockPrice' of undefined".
var $this = lava.charts.AreaChart["StockPrice"];

I'm using Laravel 5.1. This is the code that renders the charts in the view.

{!! $stockPriceChart->render('AreaChart', 'StockPrice', 'stocks-div', array('height'=>500, 'width'=>800)) !!}
{!! $stockVolumeChart->render('BarChart', 'StockVolume', 'stocks-volume-div', array('height'=>100, 'width'=>800)) !!}

Either line renders their respective charts just fine individually, just not together.

Any ideas?

Allow charts to support responsive build

I would like to be able to provide make the charts produced be scalable for use within responsive pages.

I am aware that this can be done by simply redrawing the charts upon window resize. However I think that the flexibility to do this with a snap delay to prevent idiotic amounts of redraws.

I am having issues with this due to having numerous charts on the page, all within the simple named function of drawChart(), making it unable to call them individually.

Is it possible to have the function name revised allowing for each chart to be interacted with outside the code control of the builder?

LineChart not rendering through ajax

I am rendering a line chart which renders OK on page load but when I send request through ajax then the chart doesn't render. I get the following error:

TypeError: lava.charts[parts[0]][parts[1]].chart is null

What could be the problem?

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.