Set 0 values when no data over 5 min

Hello,

i use a MySQL database in this database are coming every minute data.

For the History of this data i have a own dashbaord, the user select a “batch number” and then all data to this number are loading.

i uses follow sql for this:

SELECT
  UNIX_TIMESTAMP(zeit) as time_sec,
  cast(replace(WERT1,',','.') as double) as "WERT1",
  cast(replace(WERT2,',','.') as double) as "WERT2",
  cast(replace(WERT3,',','.') as double) as "WERT3",
  cast(replace(WERT4,',','.') as double) as "WERT4"
FROM exporttable
WHERE AKTZEIT BETWEEN (SELECT min(AKTZEIT) FROM exporttable WHERE BATCH LIKE $Batch) AND (SELECT max(AKTZEIT) FROM exporttable WHERE BATCH LIKE $Batch)

it is working but, i have one problem:

the data comes every minute, but wenn the machine is off i have no data, and the when the machine are working after many hours the laste value und the current value are “connected”:

i would like to have the line on zero and no connections.

I found no solution for this Problem. Can everybody help me?

Hi @weble,

Welcome to the :grafana: community support forums !!

We are excited that you joined our OSS community. Please read about some of the FAQs in the community :slight_smile:

What you can do is use the options on the right side go to → Graph Styles → Connect null values → and select “never” and then see if that works for you.

Let us know if this helps.

What about if it isn’t a graph? I have a panel that shows On / Off values based on ICMP ping and if it returns no value after it drops out of time range the button disappears on me. Can I default to a value if the query returns null because outside of the time range?