legendText: String

Sets the text that describes the dataSeries in legend.

legendText can also contain keywords inside the string. Keywords are property names mentioned inside curly braces like “{name}”, “{x}: {y}”, etc.

Default: “DataSeries 1”, “DataSeries 2” ..etc
Example: “2010”, “2011”..
Note
  • If legendText is not set, name property of dataSeries is taken as legendText.
var  chart =  new  CanvasJS.Chart("container",
{
 .
 .
 data:[{
  legendText: "2005",

  },
 ]
 .
 .
});
chart.render();

Try Editing The Code

  Also See:    


If you have any questions, please feel free to ask in our forums.Ask Question

7 Comments

  1. kartik says:

    is it possible to use legend in doughnut type. Like if I want the legend to be shown in center for a doughnut chart

    • Anjali says:

      kartik,

      It is not possible yet. But we are working on this feature which you can expect by the end of next week .

If you have any questions, please feel free to ask in our forums. Ask Question