Kusto - Remove additional text from variable (Legend) in Kusto chart

Viewed 529

I have a Kusto chart that has Legend with the Variable name (Platform) from the Query. I would like to remove the additional text from this Legend. I did some research and was able to see similar results from SQL but could you please tell me how do I do it in KQL.

for example, from below I would like to remove the word Platform and package size from the Legend and display just the Win_T3 & Linux_T3

  1. "Platform": "Win"_"T3" : PackageSize
  2. "Platform": "Linux"_"T3" : PackageSize

enter image description here

Below is the Data Table enter image description here

Below is how the Legend appears in the Chart enter image description here

I wanted the chart Legend to show just windows_C4 . Remove the Legend and Patch Size from the Legend . You could see in the first picture from the table the Patch Size for Legend in doff time

2 Answers

This is pretty hacky, but I thought I'd share it anyway because it somewhat helps the readability.

What I did was I changed the names of the columns to something that can't render, like escaped spaces:

<query>
| summarize ['&nbsp;']=PatchSize by ['&#32;']=LegendName, Timestamp

If you select these as y-columns and series columns, in your case this should output a legend like:

:Windows_C4:

Not ideal, not pretty and not very future proof but maybe be better than nothing. I found you can change the column names to almost anything, even emojis.

You can manipulate the value in the relevant column, just before you render the chart. Something like this:

<your query>
| parse Platform with '"Platform": "' PlatformPart1 '"_"' PlatformPart2 '" : PackageSize'
| extend Platform = strcat(PlatformPart1, '_', PlatformPart2)
| project-away PlatformPart1, PlatformPart2
| render ...
Related