Override series name to change legend name

Hi all,

I am just getting used to Grafana and really loving it. I am using ioBroker for home automation and am logging power consumption for some devices into a MySQL DB.

In Grafana I use the MySQL plugin to fetch and display the data. The select looks like this:

SELECT
floor(n.ts/1000) as time,
n.val as value,
d.name as metric
FROM ts_number n,datapoints d
WHERE n.id = 20 and n.id=d.id
ORDER BY n.ts ASC

The series names d.name are cryptic and unfortunately given, so I cannot change them nor can I add columns to the table with a pretty name.

Is there anyhow a way to change the series names to make it good looking?
Thanks!