Black Lives Matter. Please consider donating to Black Girls Code today.

Why legend-title is not working?

I try to add the legend title and it’s not working for me. Anyone please help me. This is an example

Could you try setting title text via title.text?
Something like:

var layout = {
  title: { text: 'Line and Scatter Plot' },
  legend: {
    title: { text: 'legend title' },