Format legend title of pie chart

I am using influxdb. I have written a query like below

select count(*) as metric from API_LOGS group by REQUEST_TYPE

I see legend for pie chart like below.

|API_LOGS.metric_RESPONSE_TIME {REQUEST_TYPE: mutation}|1.726 K|86%|
|---|---|---|
|API_LOGS.metric_RESPONSE_TIME {REQUEST_TYPE: query}|273|14%|

As you see legend title is API_LOGS.metric_RESPONSE_TIME {REQUEST_TYPE: mutation} while i need it to be as mutation or query. Is there a way i can achieve it.

You can use alias patterns to format the legend keys: https://grafana.com/docs/features/datasources/influxdb/#alias-patterns

Here is an example on the play site: https://play.grafana.org/d/000000002/influxdb-templated?orgId=1&fullscreen&edit&panelId=1

1 Like