Chart: get a field after long touch event

Hi have a chart,
generated from the following xml:

<domainfields>
	<item id="ANI970708ASPE">
		<description>Mensajes erroneos en Entrada. Comprobar el motivo, si es corregible se retraduce el mensaje, si el mensaje está enviado mal por el origen, avisar al origen.</description>
		<type>ERR</type>
		<number>0</number>
	</item>
</domainfields>

then I created the chart:

{ 
	view: 'chart', 
	type: 'bar', 
	value: '#number#', 
	label: '#type#', 
	padding:{
		bottom:20,
		right:0,
		left:0
	}, 
	barWidth: 50, 
	radius: 0, 
	alpha: 1, 
	gradient: false, 
	border: 0,
	xAxis: { title: ' ', template: '#number#', lines: false},
	yAxis: { title: '', lines: false, template: ' '}, 
	id: 'ui_chart', 
	datatype: 'xml', 
}

In this way I show correctly the chart and when I long touch a bar I would like to show the field associated at the item. So I did the following:

	$$('ui_chart').attachEvent("onLongTouch", function(id){
		controller.getChartExplication(description);
	});

but the id parameter does not contain the informations about the description, how can i get it?

Thanks
Danilo

Hi,

onLongTouch takes an event object as a parameter. Therefore, you can use the following approach:

$$("yourChart").attachEvent("onLongTouch",function(obj){ var target = obj.target; var id = target.getAttribute("dhx_area_id"); if(id){ showDescription(id); } });

target.getAttribute(“dhx_area_id”) returns “dhx_area_id” attribute of the touched html element. A chart html item has such an attribute with item id as its value.