Time Series Plotting Issue with future data

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

    • Grafana v12.3.1 (3a1c80ca7c)
  • What are you trying to achieve?

    • I have a query which gives me the power grid prices (historical and future). I want to plot a time series chart that shows the prices from 12h in the past until 24h in the future.
  • How are you trying to achieve it?

    • My query returns the columns “time” and “value”. Using Explore in Grafana and setting the time picker to now-12h to now +24h it perfectly works and shows the correct graph. The tricky part is when I create the panel in my dashboard. Since my other panels use another relative time, I need to hardcode the required timespan in the query options. I did: Relative Time +36h, Time Shift 12h (which effectively means -12h).
  • What happened?

    • Looking at the table the query returns the same results as in Explore before. However, the graph is not being plotted. Thats how it looks like:


      If I turn it into a bar chart the plotting works perfectly. And interestingly, when I go to the suggestions, the suggested time series charts are correctly rendered…


      Also when I remove the relative time + time shift setting it’s being rendered like intended.

  • What did you expect to happen?

    • The graph should also be plotted in the panel, not only in the suggestions
  • Can you copy/paste the configuration(s) that you are having problems with?

    • Influx Query:

      import "math"
      
      w = 15m
      
      historical =
        from(bucket: "evcc")
          |> range(start: 2026-01-05T11:09:04.791Z, stop: 2026-01-06T23:09:04.791Z)
          |> filter(fn: (r) => r._measurement == "tariffGrid")
          |> filter(fn: (r) => r._field == "value")
          |> filter(fn: (r) => r._time < now())
          |> aggregateWindow(every: w, fn: last, createEmpty: false, timeSrc: "_start")
          |> map(fn: (r) => ({
              _time: r._time,
              _value: int(v: math.round(x: float(v: r._value) * 100.0)),
              _field: "value",
              _measurement: "grid_price_ct"
          }))
      
      forecast =
        from(bucket: "MQTT")
          |> range(start: 2026-01-05T11:09:04.791Z, stop: 2026-01-06T23:09:04.791Z)
          |> filter(fn: (r) => r._measurement == "evcc_grid_forecast")
          |> filter(fn: (r) => r._field == "value")
          |> filter(fn: (r) => r._time >= now())
          |> aggregateWindow(every: w, fn: last, createEmpty: false, timeSrc: "_start")
          |> map(fn: (r) => ({
              _time: r._time,
              _value: int(v: math.round(x: float(v: r._value) * 100.0)),
              _field: "value",
              _measurement: "grid_price_ct"
          }))
      
      union(tables: [historical, forecast])
        |> sort(columns: ["_time"])
      
    • Panel JSON

      {
        "id": 102,
        "type": "timeseries",
        "title": "New panel",
        "gridPos": {
          "x": 0,
          "y": 0,
          "h": 8,
          "w": 12
        },
        "fieldConfig": {
          "defaults": {
            "custom": {
              "drawStyle": "line",
              "lineInterpolation": "linear",
              "barAlignment": 0,
              "barWidthFactor": 0.6,
              "lineWidth": 2,
              "fillOpacity": 25,
              "gradientMode": "hue",
              "spanNulls": false,
              "insertNulls": false,
              "showPoints": "always",
              "showValues": false,
              "pointSize": 5,
              "stacking": {
                "mode": "none",
                "group": "A"
              },
              "axisPlacement": "auto",
              "axisLabel": "",
              "axisColorMode": "text",
              "axisBorderShow": false,
              "scaleDistribution": {
                "type": "linear"
              },
              "axisCenteredZero": false,
              "hideFrom": {
                "tooltip": false,
                "viz": false,
                "legend": false
              },
              "thresholdsStyle": {
                "mode": "off"
              },
              "lineStyle": {
                "fill": "solid"
              },
              "axisSoftMin": 16,
              "axisSoftMax": 50
            },
            "color": {
              "mode": "fixed"
            },
            "mappings": [],
            "thresholds": {
              "mode": "absolute",
              "steps": [
                {
                  "value": null,
                  "color": "green"
                },
                {
                  "value": 80,
                  "color": "red"
                }
              ]
            },
            "unit": "ct",
            "fieldMinMax": false,
            "decimals": 1
          },
          "overrides": [
            {
              "matcher": {
                "id": "byName",
                "options": "value"
              },
              "properties": [
                {
                  "id": "thresholds",
                  "value": {
                    "mode": "absolute",
                    "steps": [
                      {
                        "color": "purple",
                        "value": null
                      },
                      {
                        "value": 20,
                        "color": "green"
                      },
                      {
                        "value": 30,
                        "color": "#EAB839"
                      },
                      {
                        "color": "red",
                        "value": 40
                      }
                    ]
                  }
                },
                {
                  "id": "color",
                  "value": {
                    "mode": "thresholds"
                  }
                }
              ]
            },
            {
              "matcher": {
                "id": "byName",
                "options": "Time"
              },
              "properties": []
            }
          ]
        },
        "transparent": true,
        "pluginVersion": "12.3.1",
        "targets": [
          {
            "datasource": {
              "type": "influxdb",
              "uid": "ef1j88sgykg00c"
            },
            "refId": "A",
            "query": "import \"math\"\n\nw = 15m\n\nhistorical =\n  from(bucket: \"evcc\")\n    |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n    |> filter(fn: (r) => r._measurement == \"tariffGrid\")\n    |> filter(fn: (r) => r._field == \"value\")\n    |> filter(fn: (r) => r._time < now())\n    |> aggregateWindow(every: w, fn: last, createEmpty: false, timeSrc: \"_start\")\n    |> map(fn: (r) => ({\n        _time: r._time,\n        _value: int(v: math.round(x: float(v: r._value) * 100.0)),\n        _field: \"value\",\n        _measurement: \"grid_price_ct\"\n    }))\n\nforecast =\n  from(bucket: \"MQTT\")\n    |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n    |> filter(fn: (r) => r._measurement == \"evcc_grid_forecast\")\n    |> filter(fn: (r) => r._field == \"value\")\n    |> filter(fn: (r) => r._time >= now())\n    |> aggregateWindow(every: w, fn: last, createEmpty: false, timeSrc: \"_start\")\n    |> map(fn: (r) => ({\n        _time: r._time,\n        _value: int(v: math.round(x: float(v: r._value) * 100.0)),\n        _field: \"value\",\n        _measurement: \"grid_price_ct\"\n    }))\n\nunion(tables: [historical, forecast])\n  |> sort(columns: [\"_time\"])"
          }
        ],
        "datasource": {
          "uid": "ef1j88sgykg00c",
          "type": "influxdb"
        },
        "interval": "15m",
        "options": {
          "tooltip": {
            "mode": "single",
            "sort": "none",
            "hideZeros": false
          },
          "legend": {
            "showLegend": false,
            "displayMode": "hidden",
            "placement": "right",
            "calcs": []
          }
        },
        "timeFrom": "+36h",
        "timeShift": "12h",
        "hideTimeOverride": false
      }
      
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

    • no errors showing up

thanks a lot in advance! :slight_smile: