示例#1
2
 /**
  * Outputs the chart javascript into the page
  *
  * Pass in a string of the html elementID that you want the chart to be
  * rendered into. Plus, if the dataTable function was never called on the
  * chart to assign a DataTable to use, it will automatically attempt to use
  * a DataTable with the same label as the chart.
  *
  * @param string $elementID
  * @return string Javscript code blocks
  */
 public function outputInto($elementID = NULL)
 {
     if ($this->dataTable === NULL) {
         $this->dataTable = $this->chartLabel;
     }
     if (gettype($elementID) == 'string' && $elementID != NULL) {
         $this->elementID = $elementID;
     }
     return Lavacharts::_build_script_block($this);
 }
示例#2
1
 /**
  * Checks to see if the given chart type and title exists in the volcano storage.
  *
  * @access public
  * @since v2.4.2
  * @return string 
  * @static 
  */
 public static function exists($type, $label)
 {
     return \Khill\Lavacharts\Lavacharts::exists($type, $label);
 }
 public function getGenerarSaberBasica($id)
 {
     $usuario = Auth::user();
     $informar = Informe::where('id', $id)->where('simulacro', 'Tu saber')->first();
     $lava = new Lavacharts();
     // See note below for Laravel
     $materias = $lava->DataTable();
     $materias->addStringColumn('Simulacros');
     $materias->addNumberColumn('Cognitiva');
     $materias->addNumberColumn('Comunicativa');
     $materias->addNumberColumn('Socio-Afectiva');
     $materias->setDateTimeFormat('Y');
     for ($i = 0; $i < sizeof($informar); $i++) {
         $simu = '.';
         $materias->addRow([$simu, $informar->proMat1, $informar->proMat2, $informar->proMat3]);
     }
     $lava->ColumnChart('Simulacros', $materias, ['titleTextStyle' => ['color' => '#6f6ae1', 'fontSize' => 50], 'legend' => ['position' => 'none'], 'colors' => ['#49ABAA', '#A8A913', '#DAA10E'], 'datatable' => $materias, 'barGroupWidth' => 5, 'width' => 490, 'height' => 330, 'isStacked' => false, 'vAxis' => ['format' => 'decimal', 'minValue' => 0, 'maxValue' => 100, 'gridlines' => ['count' => 6]], 'hAxis' => ['format' => 'decimal']]);
     return view('informes.generar-saber-basica', ['informar' => $informar, 'lava' => $lava]);
 }
 public function renderChart($chartType, $chartLabel, $elemId)
 {
     return $this->lava->render($chartType, $chartLabel, $elemId);
 }
示例#5
1
 /**
  * Chart showing the % places filled for each event
  */
 private function produceCompetitionsFilledChart($competitions)
 {
     $competitionsChart = new Lavacharts();
     $competitionsTable = $competitionsChart->DataTable();
     $competitionsTable->addStringColumn('Competition')->addNumberColumn('Percent full');
     foreach ($competitions as $competition) {
         $max = 0;
         $entries = 0;
         foreach ($competition->details()->get() as $detail) {
             $entries += $detail->entries()->get()->count();
             $max += $detail->max;
         }
         if ($max > 0 && $entries > 0) {
             $percentage = sprintf('%0.2f', $entries / $max * 100);
             $competitionsTable->addRow([$competition->name, $percentage]);
         }
     }
     $competitionsChart->BarChart('CompetitionsFilled', $competitionsTable, ['title' => 'Places already filled (%) for each competition', 'legend' => ['position' => 'bottom'], 'max' => 100, 'min' => 0, 'height' => 350]);
     return $competitionsChart;
 }
        {
            "area": "kothrud"
        },
        {
            "area": "katraj"
        }
    ]
}

';
    $string = '   chart: {
        type: "column"
                } ';
    dd(json_decode($string));
    return view('prueba');
    $stocksTable = \Khill\Lavacharts\Lavacharts::DataTable();
    // Lava::DataTable() if using Laravel
    dd($stocksTable);
    $stocksTable->addDateColumn('Day of Month')->addNumberColumn('Projected')->addNumberColumn('Official');
    // Random Data For Example
    for ($a = 1; $a < 30; $a++) {
        $stocksTable->addRow(['2015-10-' . $a, rand(800, 1000), rand(800, 1000)]);
    }
    dd(json_encode(url('/')));
    //dd(url('cortes_agenda/logoGDC.png'));
    $img = Image::make(url('cortes_agenda/logoGDC.png'))->resize(300, 200);
    $img->save(url('cortes_agenda/NEWlogoGDC.png'));
    //dd($img);
    /*return $img->response('png');*/
    //$est=\App\Models\tipoEstablecimientoSalud::find(11)->establecimientoSalud()->get();
    $est9 = \App\Models\establecimientoSalud::find(155)->tipoEstablecimiento()->get();
示例#7
0
<?php

use BenchmarkPHP\UserAgentParser\Helper;
use Khill\Lavacharts\Lavacharts;
require_once __DIR__ . '/vendor/autoload.php';
$results = json_decode(file_get_contents('cache/benchmark-results.json'), true);
$lava = new Lavacharts();
$data = $lava->DataTable();
$data->addStringColumn('User Agent Parser')->addNumberColumn('Execution Time (s)')->addNumberColumn('Memory Used (MB)');
foreach ($results as $libraryName => $result) {
    $data->addRow([$libraryName, round($result['time'], 2), round($result['memory'] / (1024 * 1024), 2)]);
}
$lava->BarChart('Benchmark Results', $data, ['title' => 'User Agent Parser Benchmark', 'barGroupWidth' => 50]);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="">

    <title>Starter Template for Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
          integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
    <!-- Optional theme -->
                    $topsökord[] = $chart['Sökord'];
                    $topklicks[] = $chart['Klick'];
                }
            }
        }
        //echo base_url() . 'admin/rapport_upload/';
        $top = array_combine($topsökord, $topklicks);
        arsort($top);
        array_shift($top);
        $top5 = array_slice($top, 0, 5);
        while ($sökord = current($top5)) {
            $sökordtop[] = key($top5);
            $klickstop[] = $sökord;
            next($top5);
        }
        $lava = new Lavacharts();
        $finances = $lava->DataTable();
        $finances->addStringColumn('sökord')->addNumberColumn('Klick')->setDateTimeFormat('Y')->addRow(array($sökordtop[0], $klickstop[0]))->addRow(array($sökordtop[1], $klickstop[1]))->addRow(array($sökordtop[2], $klickstop[2]))->addRow(array($sökordtop[3], $klickstop[3]))->addRow(array($sökordtop[4], $klickstop[4]));
        $columnchart = $lava->ColumnChart('Finances')->setOptions(array('datatable' => $finances, 'title' => 'Top 5 sökord', 'colors' => ['#de232a'], 'titleTextStyle' => $lava->TextStyle(array('color' => '#de232a', 'fontSize' => 20))));
        ?>
								 <h2 id="csv-title"><?php 
        echo $period['0'];
        ?>
</h2>
								 <div id="<?php 
        echo $period['0'];
        ?>
"></div>
								 <?php 
        echo $lava->render('ColumnChart', 'Finances', $period['0']);
        ?>
示例#9
0
<?php

use Khill\Lavacharts\Lavacharts;
$this->title = 'Show All Proccess';
$lava = new Lavacharts();
$cpuDataTable = $lava->DataTable();
$cpuDataTable->addNumberColumn('cpu');
$cpuDataTable->addRow(array($cpuUsage));
$lava->GaugeChart('cpuUsage', $cpuDataTable, ['greenFrom' => 0, 'greenTo' => 79, 'yellowFrom' => 80, 'yellowTo' => 89, 'redFrom' => 90, 'redTo' => 100]);
$memTotal = intval(round($memTotal / 1024, 0));
$memFree = intval(round($memFree / 1024, 0));
$memDataTable = $lava->DataTable();
$memDataTable->addNumberColumn('mem');
$memDataTable->addRow(array($memTotal - $memFree));
$lava->GaugeChart('memUsage', $memDataTable, ['yellowFrom' => $memTotal - 256, 'yellowTo' => $memTotal - 128, 'redFrom' => $memTotal - 128, 'redTo' => $memTotal, 'min' => 0, 'max' => $memTotal]);
?>


<div class="row">
	<div class="col-md-3">
		<div class="panel panel-default">
		<div class="panel-heading">
			<h3 class="panel-title"> 
				<span class="glyphicon glyphicon-cog" aria-hidden="true"></span> 
				CPU
			</h3>
		</div>
		<div class="panel-body">
			<?php 
echo $lava->render('GaugeChart', 'cpuUsage', 'cpuUsage-placehold', ['width' => 256, 'height' => 256]);
?>
示例#10
-1
 /**
  * @param        $widget
  * @param array  $filters
  * @param string $timeGroup
  *
  * @throws UnexpectedValueException
  * @throws InvalidArgumentException
  * @return mixed
  */
 public function renderChart($widget, $filters = [], $timeGroup = "")
 {
     try {
         $chartType = $widget->charttype;
         /** @var \Mpociot\Cockpit\Metric $metric */
         $metric = app(Config::get("cockpit.metrics_namespace", "App\\Cockpit\\Metrics\\") . $widget->metric);
         $metric->setTimeGroup($timeGroup);
         $metric->setChartType($chartType);
         // Get metric results
         $result = $metric->getValues($widget->submetric, array_merge($this->globalFilter->toArray(), $filters));
         // Get metric title
         $title = $metric->getTitle();
         if (!$result instanceof DataTable) {
             throw new UnexpectedValueException('Expected a datatable, but received ' . gettype($result));
         }
         // Create the Lavacharts Chart instance
         $charts = new Lavacharts();
         $charts->jsFactory->coreJsRendered(true);
         $chartName = "chart_" . $widget->getKey();
         $chart = $charts->{$chartType}($chartName);
         $chart->title($title);
         $chart->datatable($result);
         // Render the Chart to HTML
         return $charts->render($chartType, $chartName, $chartName, true);
     } catch (ReflectionException $e) {
         throw new InvalidArgumentException($e->getMessage());
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function show($permission)
 {
     $lava = new Lavacharts();
     // See note below for Laravel
     $temperatures = $lava->DataTable();
     $temperatures->addDateColumn('Date')->addNumberColumn('Max Temp')->addNumberColumn('Mean Temp')->addNumberColumn('Min Temp')->addRow(array('2014-10-1', 67, 65, 62))->addRow(array('2014-10-2', 68, 65, 61))->addRow(array('2014-10-3', 68, 62, 55))->addRow(array('2014-10-4', 72, 62, 52))->addRow(array('2014-10-5', 61, 54, 47))->addRow(array('2014-10-6', 70, 58, 45))->addRow(array('2014-10-7', 74, 70, 65))->addRow(array('2014-10-8', 75, 69, 62))->addRow(array('2014-10-9', 69, 63, 56))->addRow(array('2014-10-10', 64, 58, 52))->addRow(array('2014-10-11', 59, 55, 50))->addRow(array('2014-10-12', 65, 56, 46))->addRow(array('2014-10-13', 66, 56, 46))->addRow(array('2014-10-14', 75, 70, 64))->addRow(array('2014-10-15', 76, 72, 68))->addRow(array('2014-10-16', 71, 66, 60))->addRow(array('2014-10-17', 72, 66, 60))->addRow(array('2014-10-18', 63, 62, 62));
     $linechart = $lava->LineChart('Temps')->dataTable($temperatures)->title('Weather in October');
     return view('permissions.show')->withChart($linechart);
 }