Change X Axis to non-time label

Hello!

I’m trying to build a panel that plots histograms. I’ve noticed that the “Graph” Panel has that option. However, it doesn’t display it as I want it. My panel displays the data that like this:

I just want to change the x axis time labels 00:00, 02:00. 04:00… to “Name 1”, “Name 2”, “Name 3”…
I’ve read the documentation and also read the “Graph Panel” code but I couldn’t figure out.

Thanks!

Looking good!

Exactly how to do this depends on the library you’re using for drawing the graph. Many of the built-in panels uses Flot, but you’re free to use any charting library.

Do you know which library you’re using?

1 Like

Thank you!

Well I’m using the ‘@grafana/ui/’ - GraphwithLegend module. I didn’t know I could use any library for drawing the graph, does that mean I can use for example Plotly to achieve what I want? I’m very new to this.

Definitely! The grafana/ui library is ready-made components that might be too restricting, depending on your use case.

You can use any library, including Plotly. Although I don’t know a good example of using Plotly, here are some examples on how to use Flot, or SVG using D3.

If you do get Plotly up and running, I’d love to add a simple example to the grafana-plugin-examples repository.

1 Like

I added an example on how to use Plotly in a panel plugin:

1 Like

Oh thank you very much, that was fast!! :star_struck: :star_struck:

1 Like

No problem. Good luck with the plugin!