How to position y-axes correctly in a triple y-axis time-series graph

  • What Grafana version and what operating system are you using?
    Grafana v10.0.1 (5a30620b855) Linux Debian stable (bookworm)
  • What are you trying to achieve?

A time-series graph with 3 y-axes where 2 adjacent y-axes are in the correct position relative to each other. I want the dominant one of the two to be next to the graph and grid lines.

  • How are you trying to achieve it?
    I’m assuming that the first y-axis definition, the default one, is the one nearest the grid lines.

  • What happened?
    The position is swapped. However even if I redefine the data associated with the axis label it always put the minor axis (with a soft-max or some other attribute I don’t know what), next to the grid lines.

  • What did you expect to happen?
    I expected a predictable behaviour. I need to have the dominant axis next to the grid lines.

  • Can you copy/paste the configuration(s) that you are having problems with?
    I don’t know how to do that. Here is the JSON fwiw:

  "datasource": {
    "type": "influxdb",
    "uid": "jdUWGjInz"
  },
  "gridPos": {
    "h": 16,
    "w": 23,
    "x": 0,
    "y": 5
  },
  "id": 14,
  "libraryPanel": {
    "id": 2,
    "orgId": 1,
    "folderId": 6,
    "folderUid": "D9aEMILMz",
    "uid": "a28362cd-312d-44e5-940c-bf7efb88e8aa",
    "name": "Emon Power",
    "kind": 1,
    "type": "timeseries",
    "description": "",
    "model": {
      "datasource": {
        "type": "influxdb",
        "uid": "jdUWGjInz"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "Power",
            "axisPlacement": "left",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "watt"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "pv"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "green",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "ev"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "dark-blue",
                  "mode": "fixed"
                }
              },
              {
                "id": "custom.axisPlacement",
                "value": "left"
              },
              {
                "id": "custom.axisLabel",
                "value": "Charging"
              },
              {
                "id": "custom.axisSoftMax",
                "value": 1000
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "used"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "semi-dark-purple",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Flow"
            },
            "properties": [
              {
                "id": "custom.axisPlacement",
                "value": "right"
              },
              {
                "id": "custom.axisLabel",
                "value": "Energy"
              },
              {
                "id": "unit",
                "value": "kwatth"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "EV"
            },
            "properties": [
              {
                "id": "custom.axisPlacement",
                "value": "right"
              },
              {
                "id": "unit",
                "value": "kwatth"
              },
              {
                "id": "custom.axisLabel",
                "value": "Energy"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 19,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 1,
      "libraryPanel": {
        "name": "Emon Power",
        "uid": ""
      },
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "jdUWGjInz"
          },
          "query": "from(bucket: \"emon/autogen\")\n//|> range(start: -12h )\n|> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n|> filter(fn: (r) => r._measurement == \"power\")\n|> filter(fn: (r) => r._field =~ /^(pwr1|pwr2|ev|used)/)\n|> aggregateWindow(every: v.windowPeriod,  fn: mean)\n|> pivot(rowKey:[\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\")\n\n|> map(fn: (r) => ({\n      r with\n      tm: uint(v: r._time)/uint(v:1000000)\n    })\n)\t\n\n|> rename(columns: {pwr1: \"feed\", pwr2: \"pv\", tm: \"time\"})\n|> keep(columns: [\"_time\", \"used\", \"pv\", \"ev\"])\n",
          "refId": "A"
        },
        {
          "datasource": {
            "type": "influxdb",
            "uid": "jdUWGjInz"
          },
          "hide": false,
          "query": "from(bucket: \"emon/autogen\")\n|> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n|> filter(fn: (r) => r._measurement == \"day\")\n|> filter(fn: (r) => r._field =~ /import|export|ev/)\n|> pivot(rowKey:[\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\")\n|> map(fn: (r) => ({\n      r with\n      flow: (r[\"import\"] - r.export) / 10000.0,\n      tev: r.ev/10000.0\n    })\n)\n|> rename(columns: { flow: \"Flow\", tev: \"EV\"})\n|> keep(columns: [\"Flow\", \"_time\", \"EV\"])",
          "refId": "B"
        }
      ],
      "title": "Emon Power",
      "type": "timeseries"
    },
    "version": 1,
    "meta": {
      "folderName": "eMonitor",
      "folderUid": "D9aEMILMz",
      "connectedDashboards": 1,
      "created": "2023-07-31T14:30:29+01:00",
      "updated": "2023-07-31T14:30:29+01:00",
      "createdBy": {
        "avatarUrl": "/avatar/7a85f8b5e944b9d4576af863783db7f7",
        "id": 1,
        "name": "admin"
      },
      "updatedBy": {
        "avatarUrl": "/avatar/7a85f8b5e944b9d4576af863783db7f7",
        "id": 1,
        "name": "admin"
      }
    }
  },
  "title": "Emon Power",
  "targets": [
    {
      "datasource": {
        "type": "influxdb",
        "uid": "jdUWGjInz"
      },
      "query": "from(bucket: \"emon/autogen\")\n//|> range(start: -12h )\n|> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n|> filter(fn: (r) => r._measurement == \"power\")\n|> filter(fn: (r) => r._field =~ /^(pwr1|pwr2|ev|used)/)\n|> aggregateWindow(every: v.windowPeriod,  fn: mean)\n|> pivot(rowKey:[\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\")\n\n|> map(fn: (r) => ({\n      r with\n      tm: uint(v: r._time)/uint(v:1000000)\n    })\n)\t\n\n|> rename(columns: {pwr1: \"feed\", pwr2: \"pv\", tm: \"time\"})\n|> keep(columns: [\"_time\", \"used\", \"pv\", \"ev\"])\n",
      "refId": "A"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "jdUWGjInz"
      },
      "hide": false,
      "query": "from(bucket: \"emon/autogen\")\n|> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n|> filter(fn: (r) => r._measurement == \"day\")\n|> filter(fn: (r) => r._field =~ /import|export|ev/)\n|> pivot(rowKey:[\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\")\n|> map(fn: (r) => ({\n      r with\n      flow: (r[\"import\"] - r.export) / 10000.0,\n      tev: r.ev/10000.0\n    })\n)\n|> rename(columns: { flow: \"Flow\", tev: \"EV\"})\n|> keep(columns: [\"Flow\", \"_time\", \"EV\"])",
      "refId": "B"
    }
  ],
  "options": {
    "tooltip": {
      "mode": "single",
      "sort": "none"
    },
    "legend": {
      "showLegend": true,
      "displayMode": "list",
      "placement": "bottom",
      "calcs": []
    }
  },
  "fieldConfig": {
    "defaults": {
      "custom": {
        "drawStyle": "line",
        "lineInterpolation": "linear",
        "barAlignment": 0,
        "lineWidth": 1,
        "fillOpacity": 0,
        "gradientMode": "none",
        "spanNulls": false,
        "showPoints": "auto",
        "pointSize": 5,
        "stacking": {
          "mode": "none",
          "group": "A"
        },
        "axisPlacement": "left",
        "axisLabel": "Power",
        "axisColorMode": "text",
        "scaleDistribution": {
          "type": "linear"
        },
        "axisCenteredZero": false,
        "hideFrom": {
          "tooltip": false,
          "viz": false,
          "legend": false
        },
        "thresholdsStyle": {
          "mode": "off"
        }
      },
      "color": {
        "mode": "palette-classic"
      },
      "mappings": [],
      "thresholds": {
        "mode": "absolute",
        "steps": [
          {
            "color": "green",
            "value": null
          },
          {
            "color": "red",
            "value": 80
          }
        ]
      },
      "unit": "watt"
    },
    "overrides": [
      {
        "matcher": {
          "id": "byName",
          "options": "pv"
        },
        "properties": [
          {
            "id": "color",
            "value": {
              "fixedColor": "green",
              "mode": "fixed"
            }
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "ev"
        },
        "properties": [
          {
            "id": "color",
            "value": {
              "fixedColor": "dark-blue",
              "mode": "fixed"
            }
          },
          {
            "id": "custom.axisPlacement",
            "value": "left"
          },
          {
            "id": "custom.axisLabel",
            "value": "Charging"
          },
          {
            "id": "custom.axisSoftMax",
            "value": 1000
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "used"
        },
        "properties": [
          {
            "id": "color",
            "value": {
              "fixedColor": "semi-dark-purple",
              "mode": "fixed"
            }
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "Flow"
        },
        "properties": [
          {
            "id": "custom.axisPlacement",
            "value": "right"
          },
          {
            "id": "custom.axisLabel",
            "value": "Energy"
          },
          {
            "id": "unit",
            "value": "kwatth"
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "EV"
        },
        "properties": [
          {
            "id": "custom.axisPlacement",
            "value": "right"
          },
          {
            "id": "unit",
            "value": "kwatth"
          },
          {
            "id": "custom.axisLabel",
            "value": "Energy"
          }
        ]
      }
    ]
  },
  "description": "",
  "type": "timeseries"
}
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No

  • Did you follow any online instructions? If so, what is the URL?
    Not specifically. I’ve been unable to find any help.

In this snapshot (snapshot you can see what I want to do. On the left there are two y-axes “Power” and “Charging” (that’s also power). I want to put the “Power” axis next to the graph. The “Charging” axis only applies to the series “ev” which is blue and zero. The series “pv” and “used” are related to the “Power” axis. The grid lines are related to the “Charging” axis which is unhelpful, misleading even.

The “ev” series is related to the “Charging” axis by using overrides. Curiously if I swap the overrides to be “pv” and “used” and set “ev” as the main (default) series/axis I get exactly the same graph.

How can I configure this to display as I want it?