Legend for ChartBar

My dada

[
   {dsArea: "DC1",cadastrados: 3},
   {dsArea: "DC2",cadastrados: 113},
   {dsArea: "DC3",cadastrados: 4},
   {dsArea: "DC4",cadastrados: 2},
   {dsArea: "DC6",cadastrados: 574}
]

My code

                var barChart1 = new dhtmlXChart({
				view : "bar",
				container : container,
				value : "#cadastrados#",
				label : "#cadastrados#",
				width : 45,
				radius : 0,
				xAxis : {
					title : "Áreas",
					template : "#dsArea#",
					lines : false
				},
				yAxis : {
					title : "nº de Cadastros"
				},
			    color:function(obj){
			    	return colors[index++];
			    },
			    legend: {
			    	width: 75,
			    	template:"#dsArea#"
			    }
			});

Erro: Uncaught TypeError: Cannot read property ‘0’ of undefined dhtmlxchart.js:24

removing the legend, the code works, but I need subtitles on my chart

Sorry, can’t reproduce your issue locally.
Could you make and attach comleted demo?
docs.dhtmlx.com/doku.php?id=othe … leted_demo