Have you ever googled something so many times without success that you thought it must be impossible, only to later realize that you just weren’t using the right words? It happened to me this week, so I’m posting this in the hopes that someone else using the same language I was using might find their answer sooner.
The issue came up when visualizing a metric in Kibana where the value was recorded in seconds. The problem is that most people can’t look at values like “1000 seconds” or “2.4 million seconds” and intuitively understand that those are about 16 minutes and 4 weeks, respectively. So, I started googling around for how to scale the y-axis in Kibana.
As it turns out, to most people, to “scale” the axis means to adjust the upper and lower bounds, or converting between log and linear axes. The former I’d have called “range; the latter are two different scales, but with “scale” here being a noun. I was using “scale” as a verb, meaning to change the units. I didn’t find what I was looking for until I literally searched for “divide y-axis”. Finally I found this Stack Overflow question that gave me a very simple solution. In the advanced JSON input for the y-axis, just enter the following to convert a value in seconds into days:
Easy peasy. Obviously, the 86400 can be swapped out for any other scale factor you might need. It is also a good idea to enter a custom label for the axis, to make the units explicit to readers.
I would love to know if there were a way of telling Kibana that the y-axis value had units of seconds and to automatically scale as needed to the most readable units based on the range, as other plotting software can do. In the meantime, this hard coded mapping will get me something more readable, at least for a particular range of values.