Protochart

Handling Click Events On Chart

To handle the click events you need to run the clickable option to true. Then you can monitor ProtoChart:plotclick event on the chart DIV. You can learn more about Event Handling via Prototype JS site.

var options = {
	xaxis: {min: 0, max: 15},
	yaxis: {min: 0, max: 15},
	lines: {show: true},
	bars: {show: false},
	points: {show: true},
	mouse: {track:true},
	grid: {clickable: true}
};

var d1 = [[0,0]];
			
var graph = new Proto.Chart($('placeholder'), [d1], options);


$('placeholder').observe('ProtoChart:plotclick', function(event){

	var position = event.memo[0];
	d1.push([position.x, position.y]);
	d1 = d1.sort(function(a, b){ return a[0] - b[0]; });
	graph = new Proto.Chart($('placeholder'), [d1], options);
});