title: displaying bar chart in laravel
body: <p>I try to display bar chart based on data stored in table of database like image below, below image just for ilustration
  <a href="https://i.stack.imgur.com/f6bSS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/f6bSS.png" alt="Bar Chart "></a></p>
  
  <ol>
  <li>Route</li>
  </ol>
  
  <pre class="lang-php prettyprint-override"><code>Route::get('/chart', 'ChartController@index');
  Route::get('/chart', 'ChartController@chart');
  </code></pre>
  
  <ol start="2">
  <li>Controller </li>
  </ol>
  
  <pre class="lang-php prettyprint-override"><code>public function index()
  {
      return view('chart.index');
  }
  
  public function chart()
  {
      $result = DB::table('agreement')-&gt;select('val_agrement')-&gt;get();
      return response()-&gt;json($result);
  }            
  
  </code></pre>
  
  <ol start="3">
  <li>blade template</li>
  </ol>
  
  <pre class="lang-html prettyprint-override"><code>@extends('adminlte::page')
      @section('content')
          &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.3/css/bootstrap-select.min.css"&gt;
              &lt;body&gt;
              &lt;div class="row"&gt;
              &lt;div class="col-md-10 col-md-offset-1"&gt;
              &lt;div class="panel panel-default"&gt;
                  &lt;div class="panel-heading"&gt;&lt;b&gt;CHART&lt;/b&gt;&lt;/div&gt;
                      &lt;div class="panel-body"&gt;
                      &lt;canvas id="canvas" height="300" width="700"&gt;&lt;/canvas&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;/div&gt;
          &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"&gt;&lt;/script&gt;
          &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.3/js/bootstrap-select.min.js" charset="utf-8"&gt;&lt;/script&gt;
          &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.bundle.js" charset="utf-8"&gt;&lt;/script&gt;
          &lt;script&gt;
              var url = "{{url('chart')}}";
              var ctx = document.getElementById("canvas").getContext('2d');
              var myChart = new Chart(ctx, {
                  type: 'bar',
                  data: {
                      labels:VALUEA,
                      datasets: [{
                          label: 'VALUEA',
                          data: valuea,
                          borderWidth: 1
                      }]
                  },
                  options: {
                      scales: {
                          yAxes: [{
                              ticks: {
                                  beginAtZero:true
                              }
                          }]
                      }
                  }
              });
          &lt;/script&gt;
      @endsection
  </code></pre>
  
  <p>how to create chart in laravel, so far, my code as above. thank you</p>
  
  <p>im sorry, its difficult to write blade code here.</p>