How to filter and show last 30 or 100 records for visualization from streaming data?

Hello,

I have below queries

Query A:

SELECT payload.torque, payload.timeStamp FROM `pf6000.pf6000_data.0315_livetightening_results` WHERE payload.toolSerialNumber="$ToolNumber" AND payload.parameterSetName = "$Program" and payload.resultType="Tightening" and payload.torqueFinalTarget=$TorqueTarget ORDER BY payload.timeStamp ASC limit 30

Query B:

SELECT (AVG(payload.torque) - ( 3 * ( STDDEV(payload.torque) )) ) AS LCL, (AVG(payload.torque) + ( 3 * ( STDDEV(payload.torque) )) ) AS UCL , AVG(payload.torque) AS AVG, avg(payload.torqueminlimit) as LSL, avg(payload.torquemaxlimit) as USL, avg(payload.torqueFinalTarget) as TARGET, MIN(payload.timeStamp) FROM `pf6000.pf6000_data.0315_livetightening_results` WHERE  payload.toolSerialNumber="$ToolNumber" AND payload.parameterSetName = "$Program" and payload.resultType="Tightening" and payload.torqueFinalTarget=$TorqueTarget order by min(payload.timestamp) asc limit 30

Which gives me control chart as attached. I am using limit 30 to filter last 30 data points.
But the chart does not show the latest last 30 data points. Instead it asks me to ‘Zoom to Data’.
If I zoom it, then dates at the time ranges on the top right hand corner is wrong. It is showing 3 months old date ranges. I want to see last 2 days date range or last 30 data points. why it is not showing latest last 30 data points?


Please review the submission template and include more details:

  • What Grafana version and what operating system are you using?

  • What are you trying to achieve?

  • How are you trying to achieve it?

  • What happened?

  • What did you expect to happen?

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • Did you follow any online instructions? If so, what is the URL?

And please remember the Grafana Forum’s 3 BEST PRACTICES:

  1. Please post inside a subcategory
  2. For questions and advice, please try to use the template below
  3. If you post a question and someone solves it, please mark is as SOLVED

~ THANK YOU!! the grafana team