I'm trying to create a a bar chart using an NVD3 angular directive from here: http://krispo.github.io/angular-nvd3/#/
The chart I'm using is this one: http://krispo.github.io/angular-nvd3/#/discreteBarChart
This is my html for creating the chart on the page (the context doesn't seem to be important in this scenario):
<nvd3 options="options"
data="top10bar"
ng-mouseenter="mouseEnterEvent($event)"></nvd3>
This is the controller code (within which the tag sits)
app.controller('BarChartController', function ($scope) {
$scope.options = {
chart: {
type: 'discreteBarChart',
height: 350,
margin: {
top: 20,
right: 20,
bottom: 60,
left: 55
},
width: 500,
x: function (d) {
return d.label;
},
y: function (d) {
return d.value;
},
showValues: true,
transitionDuration: 500,
xAxis: {
axisLabel: 'X Axis'
},
yAxis: {
axisLabel: 'Y Axis',
axisLabelDistance: 30
},
tooltips: false,
discretebar: {
rectClass: ['discreteBar', 'tableRow']
},
interactive: true
}
};
$scope.mouseEnterEvent = function (event) {
console.log("EVENT!");
console.log(event);
};
$scope.$on('elementMouseover.tooltip', function (event, data) {
console.log("In scope.on");
console.log(event);
console.log(data);
console.log("end");
});
$scope.$on('tooltipShow.directive', function (angularEvent, event) {
angularEvent.targetScope.$parent.event = event;
angularEvent.targetScope.$parent.$digest();
});
Of the three event handlers you can see at the bottom of the controller, only the first one works because I have an ng-mouseenter option specified in nvd3. However, this works when the mouse enters over the entire chart div. What I want is to detect a mouse over on an individual bar so that I can highlight it and then highlight another part of my view.
How would you go about doing what I'm trying to achieve here? Any help is much appreciated, cheers!