Move showVariable
to the link
function of your directive:
link: function(scope, element, attrs) {
$(element).handsontable(scope.$eval(attrs.myChart));
scope.showVariable = function(id) {
$('#myChart').handsontable('loadData', $scope.data[id]);
};
}