Try is as below.
$("svg rect.bar-1").on 'click', -> console.log("clicked the first bar of bar chart")
Please check below mentioned link for more info.
Added support for handling click events
UPDATE
Morris.Donut({
element: 'donut-example',
data: [
{label: "Download Sales", value: 12},
{label: "In-Store Sales", value: 30},
{label: "Mail-Order Sales", value: 20}
]
});
$( "#donut-example" ).click(function() {
alert( "Handler for .click() called." );
});
LIVE DEMO : JSBin
Color for each segments :
Morris.Donut({
element: 'donut-example',
data: [
{label: "Download Sales", value: 12 },
{label: "In-Store Sales", value: 30},
{label: "Mail-Order Sales", value: 20}
],
colors:['#FF0000',"#00FF00","#FFFF00"]
});
Color Demo : JsBin