Please see details on using Plotly layout options in the charts configuration docs.
When chart mode is set to Advanced, you can specify Plotly layout options JSON to customize the chart using available options in Plotly. Below is the link for legend title option in Plotly layout options.
https://plotly.com/javascript/reference/#layout-legend-title-text
You only need to pass the Name attribute inside the JSON structure that feeds the chart with the name of the series: