Category : charts

Trying to use an array loop inside a chart.js script confuses me. I have a ( for me) ambitious idea…;) Hope someone can help and explain the best approach.. From a StatisticsController I transfer a partylevels-array to an index.blade: return view(‘admin.statistics.index’, [ ‘page_title’ => ‘Statistieken’, ‘f_statistics’ => $f_statistics, ‘partylevels’ => Partylevel::all() ]); In the Blade ..

Read more

When I run this in a blade.php file it return’s a blank white page. I don’t know my error can any one help me. or give any suggestion I am new to Laravel. graph.blade.php <html lang="en"> <head> <title> Bar Chart | Laravel Code</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> ..

Read more

im using php and laravel to create a crypto currency website i want to show currensies rate and a tiny chart (sparklines), exactly like coinmarketcap.com an the home page: at this site, urls of images are like this: https://s3.coinmarketcap.com/generated/sparklines/web/7d/usd/1.png the question is: are these images already stored as files on the server? or are they ..

Read more

I have to make a doughnut chart it should show total number of injured people and total number of dead people //chart controller: class ChartController extends Controller{ public function index() { $injured = "" DB::select(‘select sum(injured), sum(death) from accidents’); $death = DB::select(‘select sum(death) from accidents’); return view(‘stastics’ , compact(‘injured’,’death’)); }} //stastics blade @extends(‘master’); @section(‘content’); `<div ..

Read more

I have an array like this: array(1) { [0]=> string(3) "SB" } array(2) { [0]=> string(3) "SE" [1]=> string(4) "SCS" } …etc and a chart: var ChartX = new Chart($chart, { type: ‘bar’, data: { labels: [‘SCX’, ‘BDX’], datasets: [{ label: ‘Counter’, data: v }] } }); I was able to view data for datasets: ..

Read more

I’m using Chartisan with Chart.js & Laravel. How do I make use of these hooks to access the more complicated styling options in Chart.js? https://chartisan.dev/documentation/frontend/hooks#Custom-Hooks https://www.chartjs.org/docs/latest/samples/scale-options/grid.html <div x-data="{chart: null}" x-init="chart = new Chartisan({ el: ‘#{{ $chartPath }}’, url: ‘@chart($chartPath)’, hooks: new ChartisanHooks() .datasets([{ type: ‘line’, fill: true, borderColor: ‘#BBE9DE’, tension: 0.1 }]) {{– .options({ title: ..

Read more

I worked on laravel charts to display my data but i never find a way to add a parameter inside the query itself. Is there any solution to this? My current query public function handler(Request $request): Chartisan { ->select(DB::raw(‘COUNT(e.id)’)) ->rightJoin(‘test_cases as c’,’e.case_id’,’=’,’c.id’) ->rightJoin(‘test_suites as s’,’c.suite_id’,’=’,’s.id’) ->rightJoin(‘build_versions as b’,’e.build_id’,’=’,’b.id’) ->rightJoin(‘configuration as f’,’f.id’,’=’,’e.finalconfig_id’) ->rightJoin(‘baseconfig_configuration as bc’,’bc.config_id’,’=’,’f.id’) ->rightJoin(‘base_config ..

Read more

I am using Larapex charts for my laravel project but I cannot make the chart render when using a variable that contains my values retrieved from the database. $userLogins = User::select(DB::raw("COUNT(*) as count")) ->whereYear(‘last_login_at’, date(‘Y’)) ->groupBy(DB::raw("Month(last_login_at)")) ->pluck(‘count’); The variable above retrives following values: [1,1,3,1,1,1,1] Which I then try to place within the chart $chart = ..

Read more

I’m using Laravel and I want to pass variable to external js file here is controller code : public function reports() { $phone = Product::where(‘type’,’phone’)->where(‘year’,’2018′)->get(); $phoneCount =count($phone); $laptop = Product::where(‘type’,’laptop’)->where(‘year’,’2018′)->get(); $laptopCount =count($laptop); } return view(‘report’, [‘phone’ => $phoneCount,’laptop’=>$laptopCount ]); and here is external chart.js code but its not work data: { labels: ["phone","laptop"], datasets: [ ..

Read more

I have been able to set the library and display the sample chart successfully using this: return Chartisan::build() ->labels([‘First’, ‘Second’, ‘Third’]) ->dataset(‘Sample’, [1, 2, 3]) ->dataset(‘Sample 2′, [3, 2, 1]); I tried setting up the chart with data from my database but I couldn’t. I noticed that all helpers are not accessible from the BaseChart ..

Read more

I was asked to make a graph where I should extract the names, along with the amount it has per year. The way I did it was just to bring the total and the year for each portal name. $portalInmobiliario = Ticket::selectRaw(‘year(created_at) as anio, count(id) as total’)->where(‘source_id’,1)->groupBy(‘anio’)->get(); $tocToc = Ticket::selectRaw(‘year(created_at) as anio, count(id) as total’)->where(‘source_id’,2)->groupBy(‘anio’)->get(); ..

Read more

I followed the guide on https://charts.erik.cat/guide/ to install Chartisan with echarts in my Laravel 7.4 framework. Everything works fine and I receive a chart. The chart is triggered with this handler function: public function handler(Request $request): Chartisan { return Chartisan::build() ->labels([‘First’, ‘Second’, ‘Third’]) ->dataset(‘Sample’, [1, 2, 3]) ->dataset(‘Sample 2’, [3, 2, 1]); } The dataset ..

Read more

I am following this guide: https://github.com/asantibanez/livewire-charts after installing the necessary dependencies. In my laravel project i imported: livewire -> dashboard view -> dashboard.blade.php in routes/web.php I put the following code: Route::middleware([‘auth:sanctum’, ‘verified’])->get(‘/’, [Dashboard::class])->name(‘livewire.dashboard’); but I get: Sourc..

Read more

I have a table "echatillon_de_commande" public $table = ‘order_tab’; public $fillable = [‘departement’,’pat_nom’,’pat_prenom’,’pat_email’,’pat_telephone1′,’pat_rue1′,’detail_adresse’,’pat_postal’,’pat_ville’,’pat_pays’, ‘produits_detail’,’referance’]; and I wish to have the months of commands and the number of commands placed per month. I can display the result on this view @foreach($commandes as $Echantillon_demande) <div> {{ date(‘d-M-Y’, strtotime($Echantillon_demande->created_at)) }} </div> @endforeach and pass its values in this ..

Read more