Most recent data points are not plotted when window is narrow

I have two graphs with an InfluxDB source that for some reason only display properly when my browser window is over a certain width (around 1580 pixels). When my browser window is less wide than this, the graph ends prematurely (i.e. the right side of the graph with the most recent data points don’t get plotted). Here’s screenshots of what I mean:


As you can see, it’s only the top two graphs which are affected, both of query data from the “diskio” plugin. Here’s an example query from the left graph:

FinalOutput = ["_field", "_time", "_value"]
RawSeries = from(bucket: "InfluxDB")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "diskio")
  |> filter(fn: (r) => r["_field"] == "read_bytes")
  |> filter(fn: (r) => r["name"] == "nvme0n1")
  |> derivative(unit: 1s, nonNegative: true)

NamedSeries = RawSeries
    |> map(fn: (r) => ({_value:r._value, _time:r._time, _field:"Read [SSD]"}))
    |> keep(columns:FinalOutput)

NamedSeries

If I make the window wide so the graph displays properly, then narrow the window, the graph only loses the most recent data points when the data is refreshed.

1 Like

Which version of Grafana are you using?

Antony.

Grafana 7.3.3
InfluxDB 2.0.1
Telegraf 1.16.2

I’m seeing this with another graph now, which has 2 queries that each return 1078 rows. This time I have to make the window even wider for it to draw all the data points. If the window is too narrow, it doesn’t even draw all of the other series. It’s the “Network Traffic” graph here:

The queries this graph uses are:

from(bucket: "InfluxDB")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "net")
  |> filter(fn: (r) => r["_field"] == "bytes_recv")
  |> filter(fn: (r) => r["interface"] == "br0" or r["interface"] == "enp4s0" or r["interface"] == "wg0" or r["interface"] == "v-wsus" or r["interface"] == "v-pihole")
  |> derivative(unit: 1s, nonNegative: true)
  |> map(fn: (r) => ({
      _value: r._value * -8.0,
      _time: r._time,
      _field:
        if r.interface == "br0" then "1GbE Rx"
        else if r.interface == "enp4s0" then "10GbE Rx"
        else if r.interface == "wg0" then "VPN Rx"
        else if r.interface == "v-wsus" then "WSUS Rx"
        else if r.interface == "v-pihole" then "Pihole/LANCache Rx"
        else "???"
    })
  )

from(bucket: "InfluxDB")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "net")
  |> filter(fn: (r) => r["_field"] == "bytes_sent")
  |> filter(fn: (r) => r["interface"] == "br0" or r["interface"] == "enp4s0" or r["interface"] == "wg0" or r["interface"] == "v-wsus" or r["interface"] == "v-pihole")
  |> derivative(unit: 1s, nonNegative: true)
  |> map(fn: (r) => ({
      _value: r._value * 8.0,
      _time: r._time,
      _field:
        if r.interface == "br0" then "1GbE Tx"
        else if r.interface == "enp4s0" then "10GbE Tx"
        else if r.interface == "wg0" then "VPN Tx"
        else if r.interface == "v-wsus" then "WSUS Tx"
        else if r.interface == "v-pihole" then "Pihole/LANCache Tx"
        else "???"
    })
  )

I have found a workaround for the issue: manually specifying “Max data points” in the query options to be a large number (5000 works for me). Could this be a bug with the default value of “Max data points”, which seems to be calculated based on window size?