Stacked bar chart not displaying as bars

  • What Grafana version and what operating system are you using?
    9.1.0, Ubuntu 22

  • What are you trying to achieve?
    A panel with two groups of stacked bars

  • How are you trying to achieve it?
    Multiple data queries from Influxdb, chart type ‘bar’, two stacking groups, stacking ‘normal’, bar opacity non-zero.

  • What happened?
    Strange mixture of filled but overlapped bars in one group and skinny vertical lines rather than bars in the other.

  • What did you expect to happen?
    Stacked, filled bars

  • import, battery, solar and other above the line
  • export, charging below the line
    Plus the charge line graph, which is okay.
  • Can you copy/paste the configuration(s) that you are having problems with?
    Panel JSON:
{
  "id": 4,
  "gridPos": {
    "h": 8,
    "w": 12,
    "x": 0,
    "y": 8
  },
  "type": "timeseries",
  "title": "Electricity supply",
  "datasource": {
    "type": "influxdb",
    "uid": "KGxEfnW4z"
  },
  "description": "",
  "fieldConfig": {
    "defaults": {
      "custom": {
        "drawStyle": "bars",
        "lineInterpolation": "linear",
        "barAlignment": 0,
        "lineWidth": 1,
        "fillOpacity": 51,
        "gradientMode": "none",
        "spanNulls": false,
        "showPoints": "never",
        "pointSize": 5,
        "stacking": {
          "mode": "none",
          "group": "A"
        },
        "axisPlacement": "auto",
        "axisLabel": "",
        "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
          }
        ]
      },
      "unit": "watt"
    },
    "overrides": [
      {
        "matcher": {
          "id": "byName",
          "options": "Usage value {idx=\"16077\", name=\"Solar-generated-power\"}"
        },
        "properties": [
          {
            "id": "displayName",
            "value": "Solar"
          },
          {
            "id": "color",
            "value": {
              "fixedColor": "yellow",
              "mode": "fixed"
            }
          },
          {
            "id": "custom.stacking",
            "value": {
              "group": "Burn",
              "mode": "normal"
            }
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "Usage value {idx=\"16076\", name=\"Battery-supplied-power\"}"
        },
        "properties": [
          {
            "id": "displayName",
            "value": "Battery"
          },
          {
            "id": "color",
            "value": {
              "fixedColor": "green",
              "mode": "fixed"
            }
          },
          {
            "id": "custom.stacking",
            "value": {
              "group": "Burn",
              "mode": "normal"
            }
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "Instant value {idx=\"16072\", name=\"Grid-export-power\"}"
        },
        "properties": [
          {
            "id": "displayName",
            "value": "Export"
          },
          {
            "id": "color",
            "value": {
              "fixedColor": "blue",
              "mode": "fixed"
            }
          },
          {
            "id": "custom.stacking",
            "value": {
              "group": "Surplus",
              "mode": "normal"
            }
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "Usage value {idx=\"16079\", name=\"Other-generation\"}"
        },
        "properties": [
          {
            "id": "displayName",
            "value": "OtherGen"
          },
          {
            "id": "color",
            "value": {
              "fixedColor": "dark-green",
              "mode": "fixed"
            }
          },
          {
            "id": "custom.stacking",
            "value": {
              "group": "Burn",
              "mode": "normal"
            }
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "Percentage value {idx=\"16071\", name=\"Battery-charge\"}"
        },
        "properties": [
          {
            "id": "displayName",
            "value": "Charge%"
          },
          {
            "id": "custom.axisPlacement",
            "value": "right"
          },
          {
            "id": "custom.drawStyle",
            "value": "line"
          },
          {
            "id": "unit",
            "value": "percent"
          },
          {
            "id": "color",
            "value": {
              "fixedColor": "dark-purple",
              "mode": "fixed"
            }
          },
          {
            "id": "custom.fillOpacity",
            "value": 0
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "Import"
        },
        "properties": [
          {
            "id": "color",
            "value": {
              "fixedColor": "dark-red",
              "mode": "fixed"
            }
          },
          {
            "id": "custom.stacking",
            "value": {
              "group": "Burn",
              "mode": "normal"
            }
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "Charging"
        },
        "properties": [
          {
            "id": "color",
            "value": {
              "fixedColor": "dark-purple",
              "mode": "fixed"
            }
          },
          {
            "id": "custom.stacking",
            "value": {
              "group": "Surplus",
              "mode": "normal"
            }
          }
        ]
      }
    ]
  },
  "options": {
    "tooltip": {
      "mode": "single",
      "sort": "none"
    },
    "legend": {
      "showLegend": true,
      "displayMode": "list",
      "placement": "bottom",
      "calcs": []
    }
  },
  "targets": [
    {
      "datasource": {
        "type": "influxdb",
        "uid": "KGxEfnW4z"
      },
      "query": "from(bucket: \"house\")\r\n  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\r\n  |> filter(fn: (r) =>\r\n    r._measurement == \"Usage\" and\r\n    r.name == \"Solar-generated-power\"\r\n  )",
      "refId": "A"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "KGxEfnW4z"
      },
      "hide": false,
      "query": "from(bucket: \"house\")\r\n  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\r\n  |> filter(fn: (r) =>\r\n    r._measurement == \"Usage\" and\r\n    r.name == \"Battery-supplied-power\" and\r\n    r._value >= 0\r\n  )",
      "refId": "B"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "KGxEfnW4z"
      },
      "hide": false,
      "query": "from(bucket: \"house\")\r\n  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\r\n  |> filter(fn: (r) =>\r\n    r._measurement == \"Instant\" and\r\n    r.name == \"Grid-export-power\" and\r\n    r._value > 0\r\n  )\r\n  |> map(fn: (r) => ({_value:- r._value, _time:r._time, _field:\"Export\"}))",
      "refId": "C"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "KGxEfnW4z"
      },
      "hide": false,
      "query": "from(bucket: \"house\")\r\n  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\r\n  |> filter(fn: (r) =>\r\n    r._measurement == \"Usage\" and\r\n    r.name == \"Other-generation\"\r\n  )",
      "refId": "D"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "KGxEfnW4z"
      },
      "hide": false,
      "query": "from(bucket: \"house\")\r\n  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\r\n  |> filter(fn: (r) =>\r\n    r._measurement == \"Percentage\" and\r\n    r.name == \"Battery-charge\"\r\n  )",
      "refId": "E"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "KGxEfnW4z"
      },
      "hide": false,
      "query": "from(bucket: \"house\")\r\n  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\r\n  |> filter(fn: (r) =>\r\n    r._measurement == \"Instant\" and\r\n    r.name == \"Grid-export-power\" and\r\n    r._value <=0\r\n  )\r\n    |> map(fn: (r) => ({_value:- r._value, _time:r._time, _field:\"Import\"}))",
      "refId": "F"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "KGxEfnW4z"
      },
      "hide": false,
      "query": "from(bucket: \"house\")\r\n  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\r\n  |> filter(fn: (r) =>\r\n    r._measurement == \"Usage\" and\r\n    r.name == \"Battery-supplied-power\" and\r\n    r._value < 0\r\n  )\r\n|> map (fn: (r) => ({_value:r._value, _time:r._time, _field:\"Charging\"}))",
      "refId": "G"
    }
  ],
  "transparent": true
}

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