---
  name: sqmresultsmonth
  decscription: Shows values of MPSAS values for each location. 

  in_parameters:
    - year
      type: integer
    - month
      type: integer

  out_parameters:
    - location
      type: string
    - mdate
      type: date
    - serial_no
      type: string
    - mpsas_1
      type: float
    - mpsas_2 
      type: float
    - mpsas_3
      type: float
    - mpsas_4
      type: float
    - mpsas_5
      type: float
  
  dataservice:
    type: service
    name: RunPostgresQuery
    sql: "SELECT l.name as location, s.mdate, d.serial_no, s.mpsas_1, s.mpsas_2, s.mpsas_3, s.mpsas_4, s.mpsas_5 from
 clearsky.mobilesqmreading s right outer join 
 clearsky.location l on s.location = l.lid right outer join 
 clearsky.mobilesqm d on s.device = d.lid 
 where date_part('year', s.mdate) = ? and date_part('month', s.mdate) = ?
 order by l.lid"

  renderservice:
    type: embedded
    html: "<div class="container">

  <div>
    <canvas id="myChart" height=600px width=900px ></canvas>
  </div>
  
  
  <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  <script>
    const ctx = document.getElementById('myChart');
    new Chart(ctx, {
      type: 'bubble',
      data: data,
      options: {
        scales : {
        x: {
            type: 'category',
            labels: labels
          }},
          plugins: {
            legend: {
                display: false
            },
        }
      }
    });
    
  </script>  
</div>"

