How to make the time series X axis only show months, not weeks?

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

  • What are you trying to achieve?

Trying to get it so that only MONTHS are shown on the X axis, rather than weeks and then one data point per month

  • How are you trying to achieve it?
    Been trying to use the panel settings, Panel JSON and somehow do it with the SQL query but no dice thus far

  • What happened?
    X axis tick for every week

  • What did you expect to happen?
    Expected to have only X axis ticks where i had data points (one per month)

  • Can you copy/paste the configuration(s) that you are having problems with?
    Panel JSON:
    {
    “id”: 7,
    “type”: “timeseries”,
    “title”: “% of pregame markets won”,
    “gridPos”: {
    “x”: 0,
    “y”: 16,
    “h”: 8,
    “w”: 12
    },
    “fieldConfig”: {
    “defaults”: {
    “custom”: {
    “drawStyle”: “line”,
    “lineInterpolation”: “linear”,
    “barAlignment”: 0,
    “barWidthFactor”: 0.6,
    “lineWidth”: 1,
    “fillOpacity”: 0,
    “gradientMode”: “none”,
    “spanNulls”: false,
    “insertNulls”: false,
    “showPoints”: “auto”,
    “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”
    }
    },
    “color”: {
    “mode”: “palette-classic”
    },
    “mappings”: ,
    “thresholds”: {
    “mode”: “absolute”,
    “steps”: [
    {
    “value”: null,
    “color”: “green”
    },
    {
    “value”: 80,
    “color”: “red”
    }
    ]
    }
    },
    “overrides”: [
    {
    “matcher”: {
    “id”: “byName”,
    “options”: “games_with_pregame_volume”
    },
    “properties”: [
    {
    “id”: “custom.hideFrom”,
    “value”: {
    “tooltip”: false,
    “viz”: true,
    “legend”: true
    }
    }
    ]
    },
    {
    “matcher”: {
    “id”: “byName”,
    “options”: “profitable_pregame_games”
    },
    “properties”: [
    {
    “id”: “custom.hideFrom”,
    “value”: {
    “tooltip”: false,
    “viz”: true,
    “legend”: true
    }
    }
    ]
    },
    {
    “matcher”: {
    “id”: “byName”,
    “options”: “profitable_pregame_rate”
    },
    “properties”: [
    {
    “id”: “color”,
    “value”: {
    “mode”: “fixed”,
    “fixedColor”: “green”
    }
    }
    ]
    }
    ]
    },
    “pluginVersion”: “12.1.0-88106”,
    “targets”: [
    {
    “refId”: “A”,
    “format”: “table”,
    “rawSql”: “SELECT\n DATE_TRUNC(‘month’, settled_day)::timestamp AS time,\n TO_CHAR(DATE_TRUNC(‘month’, settled_day), ‘YYYY-MM’) AS month_label,\n COUNT() FILTER (\n WHERE "pregame_volume [hidden]"::numeric > 0\n ) AS games_with_pregame_volume,\n COUNT() FILTER (\n WHERE "pregame_volume [hidden]"::numeric > 0 AND pregame_pnl > 0\n ) AS profitable_pregame_games,\n ROUND(\n 100.0 * COUNT() FILTER (\n WHERE "pregame_volume [hidden]"::numeric > 0 AND pregame_pnl > 0\n )::numeric / NULLIF(COUNT() FILTER (\n WHERE "pregame_volume [hidden]"::numeric > 0\n ), 0),\n 2\n ) AS profitable_pregame_rate\nFROM game_level_margin_daily\nWHERE $__timeFilter(settled_day)\nGROUP BY DATE_TRUNC(‘month’, settled_day)\nORDER BY time;\n”,
    “editorMode”: “code”,
    “sql”: {
    “columns”: [
    {
    “type”: “function”,
    “parameters”:
    }
    ],
    “groupBy”: [
    {
    “type”: “groupBy”,
    “property”: {
    “type”: “string”
    }
    }
    ],
    “limit”: 50
    },
    “dataset”: “postgres”,
    “rawQuery”: true
    }
    ],
    “datasource”: {
    “uid”: “ceffjw790d24gc”,
    “type”: “grafana-postgresql-datasource”
    },
    “options”: {
    “tooltip”: {
    “mode”: “single”,
    “sort”: “none”,
    “hideZeros”: false
    },
    “legend”: {
    “showLegend”: true,
    “displayMode”: “list”,
    “placement”: “bottom”,
    “calcs”:
    }
    }
    }

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

  • Did you follow any online instructions? If so, what is the URL?

What is your data source? Can you group data by month there?

1 Like

Hello @finneganlsmith for my suggestion you can disply month when you move your pointer at particular time range like this…


for this you can simply change the unit.