Hello, I’m looking for some advice for building a dashboard. I’m trying to make a panel that displays an image based on a variable that is selected. For example, let’s say the user chose the variable “NY” and then the panel displays the New York city flag.
For that I’m using a table panel configured to the display images just like shown in the table section in the grafana docs. Since I don’t want to host these images myself, I opted to store the base64 encoded pngs inside variables in grafana, and then I use these variables in the query in order to show the correct image. It works fine, except for the fact that I can’t really resize the images shown in the panel, aside from the cell size.
The problem is that now I’m wondering if there is a better option to achieve this. I plan on exporting this dashboard soon and I’m a bit scared these images might make affect the dashboard negatively, even though I haven’t felt any difference so far.
I’m using version: Grafana v12.0.2 on Ubuntu 24.04
I exported it as a json and it was 2.1 MB. The size itself seems fine, I’m more worried if this is not a good/optimal solution to store and display the images
It depends on the definition of optimal solution.
If it means graphic perfect, then svg format can be better (it scales nicely), if you need to optimize for the size (e.g. slow, unreliable network/clients) then probably high compressed jpeg can be better (maybe emojis if you have all required flags there).
I would say your solution is OK generally: good image format, dashboard can be easily distributed without data, …
Thank you for showing me other ideas. I’d the main problem with my solution right now is my inability to resize the images as needed. Since I’m using a table panel, the only thing I can do is adjust the cell size, which doesn’t really do much.
I saw some people saying that it was possible to achieve the same thing using a Canvas panel, but I couldn’t make it to work. I even tried using SVGs along with it, but to no avail. Would you have some kind of recommendation or idea regarding that? Thank you!
I’m actually storing the base64 encoded images inside dashboard variables. I set them to constant and paste the base64 code inside the value space.
I currently have 28 images and this is a constant number, so there won’t be new images. Basically I have 28 constant dashboard variables, and each one of them holds the base64 code for their respective images.
Use another panel type if you need to do a more. I guess Business Suite for Grafana | Volkov Labs will give you more low level access to visualization. Of course it is not builtin plugin, so end user must to install that plugin first, before using it. Only you know if it is “optimal” for your use case.
I would need to host these images somewhere to use pngs or jpgs, no? That would be my main issue, I would like to keep the images only inside the dashboard
You could also store the base64 in the same datasource for the table you are displaying then have your variable query from it keeping your dashboard not heavy
That makes sense too, I was thinking about that. I mean, so far I haven’t really noticed the dashboard being slow or too heavy so I think I’ll keep the dashboard variables approach. But if I start to see the performance worsen, then I’ll probably do this.
Thank you very much for the help and clarifications!