public function show($sectorName) { $sectorGraphData = SectorHistoricals::getIndividualSectorGraphData($sectorName, 'last_month', 'Market Cap'); $sectorCaps = \Lava::DataTable(); $sectorCaps->addStringColumn('Date')->addNumberColumn('Sector Cap')->addRows($sectorGraphData); $sectorCapsLava = \Lava::AreaChart('SectorCaps')->dataTable($sectorCaps)->setOptions(['width' => 725, 'height' => 320, 'title' => 'Total Sector Cap (Billions)']); return view('pages.sectors')->with(['sectorCapsLava' => $sectorCapsLava, 'selectedSector' => $sectorName, 'selectedSectorDayChange' => SectorHistoricals::getSelectedSectorDayChange($sectorName), 'sectors' => SectorHistoricals::getSectorDayChanges("sectorDayGain", 30), 'sectorWeekDay' => SectorHistoricals::getSectorWeekDay(), 'stocksInSector' => StockMetrics::getMetricsByStockList(Stock::where('sector', $sectorName)->lists('stock_code'), 'all')]); }
public function index() { //Line graph for market cap $totalMarketCapGraphData = SectorHistoricals::getIndividualSectorGraphData('All', 'last_month', 'Market Cap'); $marketCaps = \Lava::DataTable(); $marketCaps->addStringColumn('Date')->addNumberColumn('Market Cap')->addRows($totalMarketCapGraphData); $marketCapsLava = \Lava::AreaChart('MarketCaps')->dataTable($marketCaps)->setOptions(['width' => 725, 'height' => 360, 'title' => 'ASX Market Cap (Billions)']); //PieChart for Sectors' Market Caps $individualSectorCapsGraphData = SectorHistoricals::getAllSectorGraphData('top_5'); $sectorCaps = \Lava::DataTable(); $sectorCaps->addStringColumn('Sector Name')->addNumberColumn('Percent')->addRows($individualSectorCapsGraphData); $sectorCapsLava = \Lava::PieChart('Sectors')->dataTable($sectorCaps)->customize(['tooltip' => ['text' => 'percentage']])->setOptions(['width' => 725, 'height' => 360, 'title' => 'Sector Caps (Billions)', 'pieSliceText' => 'label']); return view('pages.home')->with(['marketCapsLava' => $marketCapsLava, 'sectorDayGains' => SectorHistoricals::getSectorDayChanges('sectorDayGain'), 'sectorDayLosses' => SectorHistoricals::getSectorDayChanges('sectorDayLoss'), 'sectorDayGainTitle' => SectorHistoricals::getSectorDayChangeTitle('sectorDayGain'), 'sectorDayLossTitle' => SectorHistoricals::getSectorDayChangeTitle('sectorDayLoss')]); }
<body> <a href="https://github.com/kevinkhill/" id="forkMe"> <img src="<?php echo asset('images/forkme.png'); ?> " alt="Fork me on GitHub"> </a> <h1 class="exampleTitle"> <?php echo link_to('/lavacharts/examples', 'LavaChart Examples'); ?> \ Basic A Chart </h1> <?php echo Lava::AreaChart('Stocks')->outputInto('stock_div'); echo Lava::div(1000, 400); if (Lava::hasErrors()) { echo Lava::getErrors(); } ?> <br /> <div class="prettyprintContainer"> <span class="prettyprintContainerLabel">Closure Route/Controller</span> <div class="prettyprintCode"> <pre class="prettyprint linenums"> $stocksTable = Lava::DataTable('Stocks'); $stocksTable->addColumn('date', 'Date', 'date')
<?php $meses = getMeses(); $año = Input::get('año', $time->year); $facturas = Facturas::groupby('mes')->select(DB::raw("mes ,año , sum(monto) as total"))->where("año", "=", $año)->get(); $stocksTable = Lava::DataTable(); $stocksTable->addStringColumn('Epoca')->addNumberColumn('Total $'); foreach ($facturas as $factura) { $label = $meses[$factura['mes']] . "/" . $factura["año"]; $rowData = array($label, $factura['total']); $stocksTable->addRow($rowData); } $chart = Lava::AreaChart('FacturaChart')->title('Total de Monto de Recibo Por Mes')->colors(array('blue')); $chart->datatable($stocksTable); ?> <h3 class="text-success text-center">Grafico de Facturas Por Mes</h3> {{ Lava:: render('AreaChart', 'FacturaChart', 'FacturaChart', true) }} {{ Form::open(['method' => 'GET' , 'class' => 'form-inline']) }} <div class="col-md-4 col-md-offset-4"> {{ Form::number('año', $año, ['class'=>'form-control', 'min'=>'1999','max'=>'2099']) }} {{ Form::submit("Ver", ['class' => 'btn btn-primary']) }} </div> {{ Form::close() }}