Support the ongoing development of Laravel.io →
Configuration Eloquent Architecture
Last updated 1 year ago.
0

Please show error log

Last updated 1 year ago.
0

[2014-07-29 22:30:40] production.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'JpGraph\src\jpgraph\Graph' not found' in D:\SensorClusterApp\app\controllers\TemperatureController.php:19 Stack trace: #0 [internal function]: Illuminate\Exception\Handler->handleShutdown() #1 {main} [] []

Last updated 1 year ago.
0

If you're ok with javascript graphs you have tons of them available. Chartjs is very simple to integrate.

Or try adding

base_path() . '/vendor/{JpGraph_dir}'

to app/start/global.php at the end (or it might go to ClassLoader in same file). It might work.

Last updated 1 year ago.
0

Yea i could use that, but i would like to understand why its not working..

Last updated 1 year ago.
0

You don't need to add a line to require vendor/autoload.php in your controller. You DO, however, need to run composer dump-autoload from the command line.

Last updated 1 year ago.
0

I see. you not yet complete in config/app.php and publish this

require 'D:/SensorClusterApp/Vendor/autoload.php';

i think not need

Last updated 1 year ago.
0

Ok got it! But how do i instantiate a class that is inside a wrapper? JpGraph.php has a lot of classes, doing

$graph = new \JpGraph\src\jpgraph\Graph();

doesnt work!

Last updated 1 year ago.
0

Here it is, the working example, put this in routes.php JpGraph is initialized with static methods load, and then module... load module that you need.


Route::any("/rs", function () {


    JpGraph\JpGraph::load();
    JpGraph\JpGraph::module('pie');


// Some data
    $data = array(50, 28, 25, 27, 31, 20);

// A new pie graph
    $graph = new PieGraph(600, 600, 'auto');

// Setup title
    $graph->title->Set("Pie plot with center circle");
    $graph->title->SetFont(FF_ARIAL, FS_BOLD, 14);
    $graph->title->SetMargin(8); // Add a little bit more margin from the top
// Create the pie plot
    $p1 = new PiePlotC($data);

// Set size of pie
    $p1->SetSize(0.32);

// Label font and color setup
    $p1->value->SetFont(FF_ARIAL, FS_BOLD, 10);
    $p1->value->SetColor('black');

// Setup the title on the center circle
    $p1->midtitle->Set("Test mid\nRow 1\nRow 2");
    $p1->midtitle->SetFont(FF_ARIAL, FS_NORMAL, 10);

// Set color for mid circle
    $p1->SetMidColor('white');

// Use percentage values in the legends values (This is also the default)
    $p1->SetLabelType(PIE_VALUE_PER);

// Add plot to pie graph
    $graph->Add($p1);

// .. and send the image on it's marry way to the browser

    $response = Response::make(
                    $graph->Stroke()
    );

    $response->header('content-type', 'image/png');

    return $response;
});

Last updated 1 year ago.
0

Thanks @majstors , works flawlessly! I had an issue regarding the BarPlot class, but adding:

JpGraph\JpGraph::module('bar');

helped.

Last updated 1 year ago.
0

I'm still struggling to get JpGraph working in Laravel 5. What are the complete steps to reference all the classes?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

ViktorHSN viktorhsn Joined 29 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.