Use 2 Y-axis on same panel

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

  • What are you trying to achieve?
    I would like to use 2 Y axis because some data have max values = 10 and other are percentages.

  • How are you trying to achieve it?
    I’m using the method .inside the dashboard.new().addPanel(). Currently the data comes from a SQL query. All the data is displayed but some data are near the 0 because others are much greater.

  • What did you expect to happen?
    I would like the use a 2nd Y axis

  • Can you copy/paste the configuration(s) that you are having problems with?

`.addPanel(
  {
      "title": "Test Campaing Passed",
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": data_source,
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 10,
        "w": 24,
        "x": 0,
        "y": 24
      },
      "hiddenSeries": false,
      "id": 6,
      "legend": {
        "alignAsTable": 1,
        "avg": true,
        "current": true,
        "max": true,
        "min": true,
        "rightSide": true,
        "show": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "connected",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "8.4.1",
      "pointradius": 2,
      "points": true,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": sql_data_source,
          "format": "time_series",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": sql_testcampaigns_passed,
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:349",
          "format": "short",
          "logBase": 1,
          "show": true
        },
        {
          "$$hashKey": "object:350",
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    }
)

`

The SQL query contains 3 datas:
Test Campaign count
Test Campaign passed
Test Campaign passed percentage.
This last one, I would like to use the 2nd axis

  • Did you follow any online instructions? If so, what is the URL?
    I didn’t find revelent documentation

Thanks.

Hi @toug31,

Thanks for opening this post.

We do have this blog post which explains how to use 2 Y-axis

Also found this community post which as well:

I hope this helps.

Great to see some JSON code! Now, I added it to my own dashboard, removing the "$$hashKey": "object:349", lines in the hope that grafana would generate new ids, and the result was ignored (or silently rejected).
Besides, this doesn’t tell which of the 2 y-axes should be on the right, and doesn’t mention scaling (I assumed automatic).

          "yaxes": [
              {
                  "format": "short",
                  "logBase": 1,
                  "show": true
              },
              {
                  "format": "short",
                  "logBase": 1,
                  "show": true
              }
          ],
          "yaxis": {
              "align": false
          }