i am running a query on azure workbook that gives costs for on-demand and spot instances month to date within a number of resource groups. i want to have this data shown in bar chart as well where it could show for example a number of bars in a graph that in Resource Group A you have $100 for Spot and $500 for spot this month to date etc. when i switch visualization to bar chart or any other graph it shows the error: "Could not find appropriate columns for Bar chart." i do not know what column have i got wrong and what to change in this json.
{
"type": "Usage",
"timeframe": "MonthToDate",
"dataset": {
"granularity": "Monthly",
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"filter": {
"and": [
{
"dimensions": {
"name": "ResourceGroup",
"operator": "In",
"values": [
"RG1",
"RG2",
"RG3",
"RG4",
"RG5"
]
}
},
{
"dimensions": {
"name": "ServiceName",
"operator": "In",
"values": [
"Virtual Machines"
]
}
}
]
},
"grouping": [
{
"type": "Dimension",
"name": "ResourceGroup"
},
{
"type": "Dimension",
"name": "PricingModel"
}
],
"visualization": {
"chartType": "BarChart",
"title": "Cost by Resource Group",
"legend": "show"
}
}
}
when i change visualization to Bar chart or any other chart it shows the error: Could not find appropriate columns for Bar chart.
i was expecting for a bar chart diagram that would show the cost of on-demand and spot instances categorized with their respective resource groups.

To create a bar chart that gives costs for on-demand and spot instances within a number of resource groups, you need to give X-axis & Y-axis objects as shown.
You have only one aggregation function selected in the code
Sum for PreTaxCost.To create a bar chart, you must first choose at least one dimension and one aggregate function.
Refer MSDoc for the above detailed information.