public function renderChart($chartType, $chartLabel, $elemId) { return $this->lava->render($chartType, $chartLabel, $elemId); }
/** * Renders the chart into the page * * Given a chart label and an HTML element id, this will output * all of the necessary javascript to generate the chart. * * @access public * @since v2.0.0 * @param string $chartType Type of chart to render. * @param string $chartLabel Label of a saved chart. * @param string $elementId HTML element id to render the chart into. * @param mixed $divDimensions Set true for div creation, or pass an array with height & width * @return string * @static */ public static function render($chartType, $chartLabel, $elementId, $divDimensions = false) { return \Khill\Lavacharts\Lavacharts::render($chartType, $chartLabel, $elementId, $divDimensions); }
<li class="active"><a href="#">Home</a></li> <li><a href="#about">About</a></li> <li><a href="#contact">Contact</a></li> </ul> </div><!--/.nav-collapse --> </div> </nav> <div class="container"> <div class="row"> <div class="col-md-12"> <div id="poll_div"></div> <?php echo $lava->render('BarChart', 'Benchmark Results', 'poll_div'); ?> </div> <div class="col-md-6"> <table class="table table-bordered table-striped"> <tr> <th>Library</th> <th>Execution Time</th> <th>Memory Used (MB)</th> </tr> <?php foreach ($results as $libraryName => $result) { ?> <tr> <td><?php
} $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']); ?> <div class="csv"> <?php if ($getallrapport != '') { ?> <div class="table table-striped"> <?php $summa = array_pop($data); $totalt = array_pop($data); $summaSök = array_pop($data); $summaFilt = array_pop($data); ?> <table class="table table-condensed" border="0" cellpadding="4" cellspacing="0"> <thead>
$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]); ?> <div id="cpuUsage-placehold"></div> </div> <div class="panel-footer"> </div> </div> </div> <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> RAM </h3>
/** * @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()); } }