Standalone Examples » Segment Click Event

This example shows how to attach your own code to the segment click event.



var pie = new d3pie("pie", {
	header: {
		title: {
			text: "Another Pie"
		}
	},
	data: {
		content: [
			{ label: "One", value: 264131 },
			{ label: "Two", value: 218812 },
			{ label: "Three", value: 157618}
		]
	},
	callbacks: {
		onClickSegment: function(a) {
			alert("Segment clicked! See the console for all data passed to the click handler.");
			console.log(a);
		}
	}
});