How to label X-axis?

Hi.

Grafana 6.5.0

How do I label the X-axis of a histogram so that it’s clear whether the bins are showing seconds, milliseconds, or whatever?

I can label the Y-axis (which for a histogram is rather less important than the X-axis, I think), but I don’t see where to label the units of the X-axis. I can’t imagine this is missing - it’s such a basic feature for any type of graph to be able to label the axes…

Can someone point me in the right direction?

Thanks,

Antony.

Does nobody know how to do this?

Or is it really not possible?

I would find both quite surprising.

Please - can anyone give me a clue?

Thanks,

Antony.

I don’t think it’s possible to set up custom labels of the X-axis in the graph panel (unless you make a relevant query returning both labels and values from your data source), but you can always add the relevant information in the panel title.

Best regards,
Lukas

Have you tried using the ‘Alias’ field on the query? You can add your units to the Alias, e.g…

{{metric}} (sec)
{{metric}} (ms)

etc.

Hm, I can’t quite work out what you mean I should do, or what the result is
supposed to be.

Can you give me a specific example of what to enter in which field (or the
equivalent JSON, if that’s easier without having to do screenshots), in order
to get a label on the X-axis telling me what the units of measurement are, in
the same way as I can get a label on the Y-axis by filling in the “Label” field
for the “Left Y” sectiosn of the “Axes” tab?

Thanks,

Antony.

Sorry, I don’t have a dashboard with a histogram I can use to explain what I mean, but using ‘Alias’ is not a solution to labeling the x-axis; it’s a clunky workaround that would at least get a unit representation in the labels of each bucket.

In the example I gave, specifying ‘{{metric}} (sec)’ in the ‘Alias’ field of the metric you are graphing would lead to the metric name being displayed below each bucket with ’ (sec)’ tagged onto the end of the metric name.

There are other internal Grafana fields you can specify if ‘{{metric}}’ is not what you are labeling the buckets with.

Aha.

If your suggestion results in the unit being appended to every bucket label on
the X-axis, then I prefer my current workaround, which is to include the unit
name in the panel title.

Most of my histogram panels currently have 12 bucket labels across a width of
400 pixels, so I’m very happy to maintain the gap between the numbers instead
of filling each one with “sec” :slight_smile:

Thanks,

Antony.