legendText: String

Legend text is a textual description of what is represented by each of the dataPoints. The name of dataPoint is taken as a default value, which could be overwritten by custom text by setting this property.

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

Default: “dataPoint1”, “dataPoint2”..
Example: “apple”, “mango”..

  • It is only applicable in case of pie, doughnut, funnel and pyramid chart.
  • If legendText is not set, its value is set as name for the dataPoint.

var  chart =  new  CanvasJS.Chart("container",
  data:[ {
   dataPoints: [
    {x: 10 , y: 50 , legendText: "Apple" },



Try it Yourself by Editing the Code below.

  Also See:    

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