5

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

Jeganaak
  • 313
  • 1
  • 3
  • 23

2 Answers2

2

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 it's better than nothing. I found you can change the column names to almost anything, even emojis.

Martin H
  • 349
  • 4
  • 16
0

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 ...
Slavik N
  • 4,705
  • 17
  • 23
  • The column name is actually "Platform" and that is appearing in the Legend. In this case how do I modify the Query pls – Jeganaak Oct 05 '21 at 05:51
  • Sorry is not working. Please see I added the image in the original question of a sample Graph. on the right in the Legend it says Sid:TS1:Baseline . So I wanted to remove the SID and Baseline just keep the TS1. In the Table, the column SId has only the value TS1. So the table shows the right text but when it comes to chart it gets changed. – Jeganaak Oct 05 '21 at 17:16
  • Please update your question to have a sample query with minimal input in datatable format, a screenshot of what you get, and an explanation of what you expect to get instead. – Slavik N Oct 06 '21 at 05:42
  • I have updated my question with the Table and Graph details . Thanks. – Jeganaak Oct 06 '21 at 05:57
  • Instead of a screenshot of the data, please put it in [datatable format](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/datatableoperator) please. And also provide a sample query. Thanks. – Slavik N Oct 06 '21 at 06:05
  • The data in your question is still not in datatable format... Please update. – Slavik N Oct 08 '21 at 07:25