I started to consider what's the best practice for one-variable data visualization? Shall the legend be included in this case or not? What's important the component headliner indicates what's data refers to so in my opinion it shouldn't be necessary but I would like to hear your opinion :)
Avoid to show the legend if it only has one entry
As you said this information could be included in the heading. This is also how Google Sheets does it. There won't be a legend displayed if there is only one data series present.
If the number of data series is dynamic (e.g. the user can add them at will), you could consider showing the legend to underline the fact that you can display different multiple data series.
I think if you can provide a clear title (Headliner) and also have appropriate labels for the x and y axis then for single variable data visualization the legend would be redundant.
This can be easily tested by providing both a design with and without the legend and see if removing the legend causes any difficulties for the audience in understanding the information.
One of the common principles in data visualization design is increasing the data/ink ratio, that is, you want to make sure that the amount of ink/pixels dedicated to the display of information and data is as high as possible. Removing redundant or unnecessary information or visual elements is one of the best ways to do this.