<commit_before>/**
 * Created with IntelliJ IDEA.
 * User: issa
 * Date: 2/10/14
 * Time: 1:18 AM
 */


app.directive('aFloat', function() {
    function link(scope, element, attrs){
        scope.$watch('afData', function(){
            init(scope.afData,scope.afOption);
        });
        scope.$watch('afOption', function(){
            init(scope.afData,scope.afOption);
        });


        function init(o,d){
            var totalWidth = element.width(), totalHeight = element.height();

            if (totalHeight === 0 || totalWidth === 0) {
                throw new Error('Please set height and width for the aFloat element'+'width is '+element);
            }

            if(element.is(":visible") && !isUndefined(d) && !isUndefined(o)){
                $.plot(element, o , d);
            }
        }
    }
    return {
        restrict: 'EA',
        template: '<div></div>',
        link: link,
        replace:true,
        scope: {
            afOption: '=',
            afData: '='
        }
    };
});<commit_msg>angular float improvement: Enable triggering rendering the chart based on user request<commit_after>/**
 * Created with IntelliJ IDEA.
 * User: issa
 * Date: 2/10/14
 * Time: 1:18 AM
 */


app.directive('aFloat', function() {
    function link(scope, element, attrs){
        scope.$watch('afData', function(){
            init(scope.afData,scope.afOption);
        });
        scope.$watch('afOption', function(){
            init(scope.afData,scope.afOption);
        });

        scope.$watch('afRender', function(){
            if(scope.afRender){

               // alert('render chart is '+scope.afRender);
                $.plot(element,scope.afData,scope.afOption);
               // init(scope.afData,scope.afOption);
            }

        },true);


        function init(o,d){
            var totalWidth = element.width(), totalHeight = element.height();

            if (totalHeight === 0 || totalWidth === 0) {
                throw new Error('Please set height and width for the aFloat element'+'width is '+element);
            }

            if(element.is(":visible") && !isUndefined(d) && !isUndefined(o)){
                $.plot(element, o , d);
            }
        }
    }
    return {
        restrict: 'EA',
        template: '<div></div>',
        link: link,
        replace:true,
        scope: {
            afOption: '=',
            afData: '=',
            afRender:'='
        }
    };
});
{'fraction_non_alphanumeric': 0.1562245728234337, 'fraction_numerical': 0.008136696501220505, 'mean_word_length': 1.7785310734463278, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5530890', 'n_tokens_mistral': 728, 'n_tokens_neox': 695, 'n_words': 154}