I need to make chart that have onClick event and get label that was clicked. I found and adapt solution. This is my code:
$scope.chart;
$scope.onClick = function (points, evt) {
console.log(points, evt);
if ($scope.chart) {
console.log($scope.chart.getPointsAtEvent(evt));
}
};
and view side:
<canvas class="chart chart-horizontal-bar"
chart-series="seriesPM"
chart-labels="labelsPM"
chart-data="dataPM"
chart-options="chartOptions"
chart-click="onClick"
id="chart"
></canvas>
But my $scope.chart is undefined and i don't know how to get this variable.