# Using day as x-axis instead of time

**URL:** <https://community.grafana.com/t/using-day-as-x-axis-instead-of-time/14022>\
**Category:** General\
**Created:** [January 30, 2019, 11:18pm UTC](https://community.grafana.com/t/using-day-as-x-axis-instead-of-time/14022 "2019-01-30T23:18:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dsb](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dsb](https://community.grafana.com/u/dsb)\
**Post date:** [January 30, 2019, 11:18pm UTC](https://community.grafana.com/t/using-day-as-x-axis-instead-of-time/14022/1 "2019-01-30T23:18:21Z")

</div>

Would like to have a set non-month/year specific days as the x-axis, as in: 01, 02, 03, 04, etc…

When I used a time macro (unixEpochFilter) and valid time (or time\_sec) column, the graph I get is not ideal. I would like to have a single colored bar, but as it stands each day gets it’s own color

 ![image](https://us1.discourse-cdn.com/grafana/original/2X/2/26199db37f5fa07ab1006891642c8cec86e8ed75.png)

When I attempt to execute a query without a time macro (or other valid time column) I get an error: Found no column named time or time\_sec

I do have X-axis Mode ‘Series’ selected

Here is my query:  
select  
$\_\_unixEpochGroupAlias(timestamp,$\_\_interval), FROM\_UNIXTIME(timestamp, “%e”) as “day”, count(\*) as “severity”  
from event\_table  
WHERE  
$\_\_unixEpochFilter(timestamp) AND  
severity \> 0 AND  
gateway = CONCAT(‘$gateway’,‘\_Prod’) AND  
FROM\_UNIXTIME(timestamp, “%a”) NOT IN (‘Sat’) AND  
headline NOT IN (‘samplingStatus’) AND  
description NOT IN (‘NetProbe disconnected’, ‘NetProbe unreachable’) AND  
dataview NOT IN (‘GW Gateway Data’, ‘GW Probe Data’, ‘GW Snooze Data’)  
GROUP BY 1, 2  
ORDER BY $\_\_unixEpochGroup(timestamp,$\_\_interval)

Can someone please help?

---

<div class="post-metadata">

**Author:** ![danielgonzalez](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/danielgonzalez/32/7125_2.png) [@danielgonzalez](https://community.grafana.com/u/danielgonzalez)\
**Post date:** [February 1, 2019, 11:31am UTC](https://community.grafana.com/t/using-day-as-x-axis-instead-of-time/14022/2 "2019-02-01T11:31:58Z")

</div>

You can try [Plotly](https://grafana.com/plugins/natel-plotly-panel)

---

<div class="post-metadata">

**Author:** ![dsb](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dsb](https://community.grafana.com/u/dsb)\
**Post date:** [February 4, 2019, 1:46pm UTC](https://community.grafana.com/t/using-day-as-x-axis-instead-of-time/14022/3 "2019-02-04T13:46:57Z")

</div>

I’m trying to not set up a secondary analytics tool at this point. We are really just exploring Grafana as an enterprise option and I don’t want to invest in additional vendor products at this point.

---

<div class="post-metadata">

**Author:** ![danielgonzalez](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/danielgonzalez/32/7125_2.png) [@danielgonzalez](https://community.grafana.com/u/danielgonzalez)\
**Post date:** [February 4, 2019, 3:22pm UTC](https://community.grafana.com/t/using-day-as-x-axis-instead-of-time/14022/4 "2019-02-04T15:22:33Z")

</div>

Plotly is a plugin of grafana

---

<div class="post-metadata">

**Author:** ![dsb](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dsb](https://community.grafana.com/u/dsb)\
**Post date:** [February 5, 2019, 7:27pm UTC](https://community.grafana.com/t/using-day-as-x-axis-instead-of-time/14022/5 "2019-02-05T19:27:47Z")

</div>

I tried it, it did not work. Still hamstrung by “needing” a “time” column, which makes each day of the week appear as its own series.

---

<div class="post-metadata">

**Author:** ![danielgonzalez](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/danielgonzalez/32/7125_2.png) [@danielgonzalez](https://community.grafana.com/u/danielgonzalez)\
**Post date:** [February 6, 2019, 2:09am UTC](https://community.grafana.com/t/using-day-as-x-axis-instead-of-time/14022/6 "2019-02-06T02:09:10Z")

</div>

If I understand you well, ‘simply’ you want to have the same color for every day, you could use the graph you show and in series override put a color for all the series:

 ![image](https://us1.discourse-cdn.com/grafana/original/2X/b/beeced19cf806da60e01695e319f9dc69081ce0e.png)

You can also achieve something similar with plotly,  
your query may or may not return a column of time,  
with plotly, you can do the query as timeserie,  
or as a table, in the first case you will need the time column, in the second you do not need it, in any case, plotly allows you to plot a column on the X axis and a different column on the Y axis.

 ![image](https://us1.discourse-cdn.com/grafana/original/2X/c/cdecf617ef5756234d6bf1b5c52aaff22faa7bf7.png)

 ![image](https://us1.discourse-cdn.com/grafana/original/2X/8/8348fcd0ede2ea8f9badd3d9ac20efd71a8aad1a.png)

I hope to be helpful, if I still can not understand you, please give me more details

---

<div class="post-metadata">

**Author:** ![dsb](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dsb](https://community.grafana.com/u/dsb)\
**Post date:** [February 6, 2019, 2:41pm UTC](https://community.grafana.com/t/using-day-as-x-axis-instead-of-time/14022/7 "2019-02-06T14:41:56Z")

</div>

Thanks Daniel. The Series Override does make sense and for display purposes on this series is good. However, my goal is to have two separate time series on the same graph. The reason I want the DAY as the x-axis is so I can have two weeks display. Basically, like this:

![image](https://us1.discourse-cdn.com/grafana/original/2X/4/4cfe977cf42667be8ff989a612916a4ecdd32120.png)

As for Plotly. I’ve tried it, and I just get weird errors and no data displays at all, in either the time series or table options. Here is the query/response that was used for the table data. As you can see there is data return, but the panel is blank

```
{
  "xhrStatus": "complete",
  "request": {
"method": "POST",
"url": "api/tsdb/query",
"data": {
  "from": "1548859160744",
  "to": "1549463960744",
  "queries": [
    {
      "refId": "A",
      "intervalMs": 600000,
      "maxDataPoints": 960,
      "datasourceId": 10,
      "rawSql": "select \nFROM_UNIXTIME(timestamp, \"%a\") as \"Day\", count(*) as \"Count\"\nfrom event_table \nWHERE\n $__unixEpochFilter(timestamp) AND\n severity > 0 AND\n gateway = CONCAT('MLPX','_Prod') AND\n FROM_UNIXTIME(timestamp, \"%a\") NOT IN ('Sat') AND\n headline NOT IN ('samplingStatus') AND\n description NOT IN ('NetProbe disconnected', 'NetProbe unreachable') AND\n dataview NOT IN ('GW Gateway Data', 'GW Probe Data', 'GW Snooze Data')\nGROUP BY 1\nORDER BY 1\n",
      "format": "table"
    }
  ]
}
  },
  "response": {
"results": {
  "A": {
    "refId": "A",
    "meta": {
      "rowCount": 6,
      "sql": "select \nFROM_UNIXTIME(timestamp, \"%a\") as \"Day\", count(*) as \"Count\"\nfrom event_table \nWHERE\n timestamp >= 1548859160 AND timestamp <= 1549463960 AND\n severity > 0 AND\n gateway = CONCAT('MLPX','_Prod') AND\n FROM_UNIXTIME(timestamp, \"%a\") NOT IN ('Sat') AND\n headline NOT IN ('samplingStatus') AND\n description NOT IN ('NetProbe disconnected', 'NetProbe unreachable') AND\n dataview NOT IN ('GW Gateway Data', 'GW Probe Data', 'GW Snooze Data')\nGROUP BY 1\nORDER BY 1\n"
    },
    "series": null,
    "tables": [
      {
        "columns": [
          {
            "text": "Day"
          },
          {
            "text": "Count"
          }
        ],
        "rows": [
          [
            "Fri",
            16
          ],
          [
            "Mon",
            21
          ],
          [
            "Sun",
            12
          ],
          [
            "Thu",
            22
          ],
          [
            "Tue",
            11
          ],
          [
            "Wed",
            12
          ]
        ]
      }
    ]
  }
}
  }
}

```

 ![image](https://us1.discourse-cdn.com/grafana/original/2X/b/bf482db96f94da4ec0d761bf3c2bab139319c783.png)

---

<div class="post-metadata">

**Author:** ![danielgonzalez](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/danielgonzalez/32/7125_2.png) [@danielgonzalez](https://community.grafana.com/u/danielgonzalez)\
**Post date:** [February 7, 2019, 1:14pm UTC](https://community.grafana.com/t/using-day-as-x-axis-instead-of-time/14022/8 "2019-02-07T13:14:55Z")

</div>

Mmmm I think it is not possible to solve your use case with grafana,  
it’s sad because it’s a very simple problem

---

<div class="post-metadata">

**Author:** ![dsb](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dsb](https://community.grafana.com/u/dsb)\
**Post date:** [February 7, 2019, 1:41pm UTC](https://community.grafana.com/t/using-day-as-x-axis-instead-of-time/14022/9 "2019-02-07T13:41:54Z")

</div>

Agree. This seems like a bit of a gap. Grafana is a powerful tool but when looking through the lens of performance metrics, not having a mechanism to overlay multiple time ranges into the same graph is a bit weird. If Excel can do it…

Anyway, thanks so much for trying!
