mark
mark

Reputation: 62836

In App Insights how to assign text labels to the X-axis values?

Consider the following query:

...
| project minutes, agentCount, maxDOP
| summarize round(avg(minutes)) by agentCount, maxDOP
| order by avg_minutes asc
| project rn=row_number(), avg_minutes, strcat('A', agentCount, 'x', maxDOP, 'M')
| render columnchart

This produces the following graph: enter image description here

The problem is that the labels down below are sorted lexicographically, which does not correspond to the actual order by avg_minutes. I would like to have these text labels instead of the row numbers on the graph, but I cannot figure out how to do it.

Displaying them inside the bars (turned vertically, of course) is also a solution, if possible. Anything that would make clear which label corresponds to which bar would be much better than the current display.

Upvotes: 0

Views: 1342

Answers (1)

SauravDas-MT
SauravDas-MT

Reputation: 1446

Column chart is a type of categorical charts allow users to represent a dimension or column on the X-axis of a chart, this is especially useful in histograms.

Coming to your problem -

I would like to have these text labels instead of the row numbers on the graph, but I cannot figure out how to do it.

You can achieve it simply by removing the row number from the project line of the query, as shown below.

...
| project minutes, agentCount, maxDOP
| summarize round(avg(minutes)) by agentCount, maxDOP
| order by avg_minutes asc
| project strcat('A', agentCount, 'x', maxDOP, 'M'), avg_minutes
| render columnchart

I tried something similar with sample data in Azure Data Explorer as and achieved the desired result as shown in the picture below.

KQL

I would suggest to read Use Kusto queries document from Microsoft and Chart visualizations document for more information.

Upvotes: 1

Related Questions