title: InfluxQL/Grafana: Get maximum per day
body: <p>I want to get the maximum of a time series per day, so one data point each day at time 00:00:00. The maximum should be calculated over the range 00:00:00 until 23:59:59 for each day.</p>
  
  <p>What i got so far:</p>
  
  <pre><code>SELECT max("temperature") FROM "Temperature" WHERE $timeFilter GROUP BY time(1d)
  </code></pre>
  
  <p>($timeFilter is used by Grafana for displaying only the selected time range)
  With that query i get the output data points at the wrong time.</p>
  
  <p>EDIT:
  When i run</p>
  
  <pre><code>&gt; precision rfc3339
  &gt; SELECT max("temperature") FROM "Temperature" WHERE time &gt; now() - 7d GROUP BY time(1d) fill(null)
  
  name: Temperature
  time                 max
  ----                 ---
  2020-03-22T00:00:00Z 4.5
  2020-03-23T00:00:00Z 9.687
  2020-03-24T00:00:00Z 10.75
  2020-03-25T00:00:00Z 8.5
  2020-03-26T00:00:00Z 11.062
  2020-03-27T00:00:00Z 10.25
  ...
  </code></pre>
  
  <p>in the CLI, the timestamps seem right.</p>
  
  <p>But in Grafana the data points are placed at 02:00 each day.
  <a href="https://i.stack.imgur.com/AMqkU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AMqkU.png" alt="misalignment"></a></p>
  
  <p>Thanks!</p>