<commit_before>angular.module('yds').directive('ydsBubble', ['Data', '$window', function(Data, $window) {
    return {
        restrict: 'E',
        scope: {
            projectId: '@',     // ID of the project that the data belong
            viewType: '@',      // Name of the array that contains the visualised data
            lang: '@',          // Lang of the visualised data

            exporting: '@',     // Enable or disable the export of the plot
            elementH: '@',      // Set the height of the component
            titleSize: '@',     // The size of the chart's main title
            legend: '@',        // Enable or disable chart legend

            addToBasket: '@',   // Enable or disable "add to basket" functionality, values: true, false
            basketBtnX: '@',    // X-axis position of the basket button
            basketBtnY: '@',    // Y-axis position of the basket button

            embeddable: '@',    // Enable or disable the embedding of the component
            embedBtnX: '@',     // X-axis position of the embed button
            embedBtnY: '@',     // Y-axis position of the embed button
            popoverPos: '@'     // The side of the embed button from which the embed information window will appear
        },
        templateUrl: ((typeof Drupal != 'undefined')? Drupal.settings.basePath  + Drupal.settings.yds_project.modulePath  +'/' :'') + 'templates/bubble.html',
        link: function (scope, element, attrs) {
            var scatterContainer = angular.element(element[0].querySelector('.bubble-container'));

            //create a random id for the element that will render the plot
            var elementId = "bubble" + Data.createRandomId();
            scatterContainer[0].id = elementId;

            var projectId = scope.projectId;
            var viewType = scope.viewType;
            var lang = scope.lang;
            var exporting = scope.exporting;
            var elementH = scope.elementH;
            var titleSize = scope.titleSize;
            var legend = scope.legend;

            //check if the projectId and the viewType attr is defined, else stop the process
            if (angular.isUndefined(projectId) || projectId.trim()=="") {
                scope.ydsAlert = "The YDS component is not properly configured." +
                    "Please check the corresponding documentation section";
                return false;
            }

            //check if pie-type attribute is empty and assign the default value
            if(_.isUndefined(viewType) || viewType.trim()=="")
                viewType = "default";

            //check if the language attr is defined, else assign default value
            if(angular.isUndefined(lang) || lang.trim()=="")
                lang = "en";

            //check if the exporting attr is defined, else assign default value
            if(angular.isUndefined(exporting) || (exporting!="true" && exporting!="false"))
                exporting = "true";

            //check if legend attr is defined, else assign default value
            if (_.isUndefined(legend) || legend.trim()=="")
                legend = "false";

            //check if the component's height attr is defined, else assign default value
            if(angular.isUndefined(elementH) || isNaN(elementH))
                elementH = 200;

            //check if the component's title size attr is defined, else assign default value
            if(angular.isUndefined(titleSize) || titleSize.length == 0 || isNaN(titleSize))
                titleSize = 18;

            //set the height of the plot
            scatterContainer[0].style.height = elementH + 'px';

            Data.getProjectVis("bubble", projectId, viewType, lang)
                .then(function (response) {
                    var options = response.data;

                    // Add element ID to render the chart to in the options
                    options.chart.renderTo = elementId;

                    // Set title size in options
                    options.title.style = {
                        fontSize: titleSize + "px"
                    };

                    // Set legend in options
                    options.legend.enabled = (legend === "true");

                    // Set exporting options
                    options.exporting = {
                        buttons: {
                            contextButton: {
                                symbol: 'url(' + ((typeof Drupal != 'undefined') ? Drupal.settings.basePath + Drupal.settings.yds_project.modulePath + '/' : '') + 'img/fa-download-small.png)',
                                symbolX: 12,
                                symbolY: 12
                            }
                        },

                        enabled: (exporting === "true")
                    };

                    // Add function to check if URI for a point exists in order to open details page for it
                    options.plotOptions.series.point = {
                        events: {
                            click: function() {
                                var point = event.point;
                                if (_.has(point, "uri")) {
                                    $window.open(point.uri, "_blank");
                                }
                            }
                        }
                    };

                    new Highcharts.Chart(options);<commit_msg>Make bubble chart point click go to project details instead of the URI<commit_after>angular.module('yds').directive('ydsBubble', ['YDS_CONSTANTS', 'Data', '$window', function(YDS_CONSTANTS, Data, $window) {
    return {
        restrict: 'E',
        scope: {
            projectId: '@',     // ID of the project that the data belong
            viewType: '@',      // Name of the array that contains the visualised data
            lang: '@',          // Lang of the visualised data

            exporting: '@',     // Enable or disable the export of the plot
            elementH: '@',      // Set the height of the component
            titleSize: '@',     // The size of the chart's main title
            legend: '@',        // Enable or disable chart legend

            addToBasket: '@',   // Enable or disable "add to basket" functionality, values: true, false
            basketBtnX: '@',    // X-axis position of the basket button
            basketBtnY: '@',    // Y-axis position of the basket button

            embeddable: '@',    // Enable or disable the embedding of the component
            embedBtnX: '@',     // X-axis position of the embed button
            embedBtnY: '@',     // Y-axis position of the embed button
            popoverPos: '@'     // The side of the embed button from which the embed information window will appear
        },
        templateUrl: ((typeof Drupal != 'undefined')? Drupal.settings.basePath  + Drupal.settings.yds_project.modulePath  +'/' :'') + 'templates/bubble.html',
        link: function (scope, element, attrs) {
            var scatterContainer = angular.element(element[0].querySelector('.bubble-container'));

            //create a random id for the element that will render the plot
            var elementId = "bubble" + Data.createRandomId();
            scatterContainer[0].id = elementId;

            var projectId = scope.projectId;
            var viewType = scope.viewType;
            var lang = scope.lang;
            var exporting = scope.exporting;
            var elementH = scope.elementH;
            var titleSize = scope.titleSize;
            var legend = scope.legend;

            //check if the projectId and the viewType attr is defined, else stop the process
            if (angular.isUndefined(projectId) || projectId.trim()=="") {
                scope.ydsAlert = "The YDS component is not properly configured." +
                    "Please check the corresponding documentation section";
                return false;
            }

            //check if pie-type attribute is empty and assign the default value
            if(_.isUndefined(viewType) || viewType.trim()=="")
                viewType = "default";

            //check if the language attr is defined, else assign default value
            if(angular.isUndefined(lang) || lang.trim()=="")
                lang = "en";

            //check if the exporting attr is defined, else assign default value
            if(angular.isUndefined(exporting) || (exporting!="true" && exporting!="false"))
                exporting = "true";

            //check if legend attr is defined, else assign default value
            if (_.isUndefined(legend) || legend.trim()=="")
                legend = "false";

            //check if the component's height attr is defined, else assign default value
            if(angular.isUndefined(elementH) || isNaN(elementH))
                elementH = 200;

            //check if the component's title size attr is defined, else assign default value
            if(angular.isUndefined(titleSize) || titleSize.length == 0 || isNaN(titleSize))
                titleSize = 18;

            //set the height of the plot
            scatterContainer[0].style.height = elementH + 'px';

            Data.getProjectVis("bubble", projectId, viewType, lang)
                .then(function (response) {
                    var options = response.data;

                    // Add element ID to render the chart to in the options
                    options.chart.renderTo = elementId;

                    // Set title size in options
                    options.title.style = {
                        fontSize: titleSize + "px"
                    };

                    // Set legend in options
                    options.legend.enabled = (legend === "true");

                    // Set exporting options
                    options.exporting = {
                        buttons: {
                            contextButton: {
                                symbol: 'url(' + ((typeof Drupal != 'undefined') ? Drupal.settings.basePath + Drupal.settings.yds_project.modulePath + '/' : '') + 'img/fa-download-small.png)',
                                symbolX: 12,
                                symbolY: 12
                            }
                        },

                        enabled: (exporting === "true")
                    };

                    // Add function to check if URI for a point exists in order to open details page for it
                    options.plotOptions.series.point = {
                        events: {
                            click: function() {
                                var point = event.point;
                                if (_.has(point, "uri") && _.has(point, "type")) {
                                    var url = YDS_CONSTANTS.PROJECT_DETAILS_URL + "?id=" + point.uri + "&type=" + point.type;

                                    $window.open(url, "_blank");
                                }
                            }
                        }
                    };

                    new Highcharts.Chart(options);
{'fraction_non_alphanumeric': 0.10007199424046076, 'fraction_numerical': 0.002339812814974802, 'mean_word_length': 1.4413444639718804, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6691087', 'n_tokens_mistral': 2688, 'n_tokens_neox': 2556, 'n_words': 842}