Bar charts requires a string field

Hi, I have 5 prometheus queries which display fine when “Time series”, the default is chosen for the chart. I need to have all measures that you can see in the snapshot hereunder to Bar chart, when I switch to bar chart I get an error as you can see in the 2nd snapshot. How can I fix this please? Why I need this is because I need 3 series in barchart and have one series in lines on the bars
1st snapshot

2nd snapshot

Do you envision something like this, with time in the x-axis and both bars and lines representing the different series?

Exactly grant2, this is what I am looking for. In the past I managed to acheive this in Power BI as you can notice in the snapshot. As I am migrating to Grafana a I find more robust and easier to setup and more nice features, I recently decided to migrate to Grafana
By the way, you can notice up in the snapshot “Time Filter” by day or month, do we have something similar in Grafana?

Power BI screenshot

Not sure that I understand your question, but if Power BI has this for a Time Filter…
image

then Grafana has this…
image

But I think you already knew that :smiley:

Can you see from my previous screenshot how to combine lines and bars? It’s basically using an override to specify which series you want to appear as bars.

Yes, I can see the overrides but as indicated in the title of this thread, as soon as I chose “Bar Chart” I get

bar-charts-requires-a-string-field

Sorry, used the bad word, I meant DATE not time for the filter

So in case it is not clear, there are several types of “bar charts”. This type (vertical or horizontal) requires a string field (as you found out):
image

This type of “bar chart” is really just a regular time series graph, but with bars instead of points or lines:


More info:
(Time series | Grafana documentation)
(Time series | Grafana documentation)

OK grant, so let me ask the question as follows: How do I add a string field to my prom query

sql_waiting_tasks_count{wait="FT_IFTSHC_MUTEX"} / 60000

This returns the following result

sql_waiting_tasks_count{alias=“Sieracsqlservers”, exported_instance=“SQL2K12”, instance=“salam7:9966”, job=“sql_servers”, wait=“FT_IFTSHC_MUTEX”} 22
sql_waiting_tasks_count{alias=“Sieracsqlservers”, exported_instance=“SQL2K12\SC2K12”, instance=“salam7:9966”, job=“sql_servers”, wait=“FT_IFTSHC_MUTEX”} 5
sql_waiting_tasks_count{alias=“Sieracsqlservers”, exported_instance=“SQL2K17”, instance=“salam7:9967”, job=“sql_servers”, wait=“FT_IFTSHC_MUTEX”}

I am not able to figure out how to add a string field, the doc is a little bit confusing

Can you be more explicit about your source data and what you want to create in Grafana?

Do you want this?

Or this?

The 1st and 2nd one as they represent the same thing but in a different way and they are linked. When I click on any of the items in the 1st one the 2nd graph is updated accordingly. If 1st one is not possible, the 2nd graph is more important for me.

Here are the queries I am using (which I need as Bar charts)

sql_waiting_tasks_count{exported_instance=~“$instance”,wait=“FT_IFTSHC_MUTEX”} / 60000
sql_waiting_tasks_count{exported_instance=~“$instance”,wait=“BACKUPIO”} / 60000
sql_waiting_tasks_count{exported_instance=~“$instance”,wait=“WRITELOG”} / 60000
sql_waiting_tasks_count{exported_instance=~“$instance”,wait=“PAGEIOLATCH_SH”} / 60000
sql_wait_time_ms{exported_instance=~“$instance”,wait=“LCK_M_X”} / 60000

and the one to be in line representation is
sql_pc_SQLStatistics_BatchRequests_over_sec{exported_instance=“$instance”} / 60000

Here is a snapshot of my source

Hi grant, any feedback or suggestion for acheiving this? thanks in advance

Sorry @salam1, but I do not have any experience with Prometheus queries.

I am almost certain that you will need to use a Time series visualization with a combination of bars for:
sql_waiting_tasks_count{exported_instance=~“$instance”,wait=“FT_IFTSHC_MUTEX”} / 60000
sql_waiting_tasks_count{exported_instance=~“$instance”,wait=“BACKUPIO”} / 60000
sql_waiting_tasks_count{exported_instance=~“$instance”,wait=“WRITELOG”} / 60000
sql_waiting_tasks_count{exported_instance=~“$instance”,wait=“PAGEIOLATCH_SH”} / 60000
sql_wait_time_ms{exported_instance=~“$instance”,wait=“LCK_M_X”} / 60000
…and a line for
sql_pc_SQLStatistics_BatchRequests_over_sec{exported_instance=“$instance”} / 60000

To make a chart like this with mixed bars and lines, you need to use an Override: