<commit_before>(function(insight) {

    /*
     * The BarSeries is an abstract base class for columns and rows.
     * @class insight.BarSeries
     * @extends insight.Series
     * @param {String} name - A uniquely identifying name for this series
     * @param {insight.DataSet} data - The DataSet containing this series' data
     * @param {insight.Scales.Scale} x - the x axis
     * @param {insight.Scales.Scale} y - the y axis
     */
    insight.BarSeries = function BarSeries(name, data, x, y) {

        insight.Series.call(this, name, data, x, y);

        // Private variables ------------------------------------------------------------------------------------------

        var self = this;

        // Internal variables -------------------------------------------------------------------------------------------

        self.valueAxis = undefined;
        self.keyAxis = undefined;
        self.classValues = [insight.Constants.BarClass];

        // Private functions ------------------------------------------------------------------------------------------

        function tooltipFunction(d) {
            return self.tooltipFormat()(self.valueFunction()(d));
        }

        function duration(d, i) {
            return 200 + (i * 20);
        }

        function opacity() {
            // If we are using selected/notSelected, then make selected more opaque than notSelected
            if (d3.select(this).classed('notselected')) {
                return 0.5;
            }

            //If not using selected/notSelected, make everything opaque
            return 1;
        }

        function seriesSpecificClassName(d) {

            var additionalClass = ' ' + self.name + 'class';
            var baseClassName = self.itemClassName(d);
            var itemClassName = baseClassName + additionalClass;

            return itemClassName;
        }

        // Internal functions -----------------------------------------------------------------------------------------

        self.isHorizontal = function() {
            return undefined;
        };

        self.draw = function(chart) {

            self.tooltip = chart.tooltip;
            self.selectedItems = chart.selectedItems;

            var groupSelector = 'g.' + self.name + '.' + insight.Constants.BarGroupClass,
                barSelector = 'rect.' + self.name + '.' + insight.Constants.BarGroupClass;

            var data = self.dataset();

            var groups = chart.plotArea
                .selectAll(groupSelector)
                .data(data, self.keyFunction());

            var newGroups = groups.enter()
                .append('g')
                .classed(self.name, true)
                .classed(insight.Constants.BarGroupClass, true);

            var newBars = newGroups.selectAll(barSelector);

            newBars = newGroups.append('rect')
                .attr('class', self.itemClassName)
                .attr('in_series', self.name)
                .attr('fill', self.color)
                .attr('clip-path', 'url(#' + chart.clipPath() + ')')
                .on('mouseover', self.mouseOver)
                .on('mouseout', self.mouseOut)
                .on('click', self.click);

            var seriesTypeCount = chart.countSeriesOfType(self);
            var seriesIndex = chart.seriesIndexByType(self);
            var groupIndex = 0;

            var height = (self.isHorizontal()) ? barBreadth : colBarLength;
            var width = (self.isHorizontal()) ? barLength : barBreadth;
            var xPosition = (self.isHorizontal()) ? 0 : keyPosition;
            var yPosition = (self.isHorizontal()) ? keyPosition : valuePosition;


            // Select and update all bars
            var seriesSelector = '.' + self.name + 'class.' + self.classValues[0];
            var bars = groups.selectAll(seriesSelector)
                .transition()
                .duration(duration)
                .attr('x', xPosition)
                .attr('y', yPosition)
                .attr('height', height)
                .attr('width', width)<commit_msg>Fix BarSeries highlighting<commit_after>(function(insight) {

    /*
     * The BarSeries is an abstract base class for columns and rows.
     * @class insight.BarSeries
     * @extends insight.Series
     * @param {String} name - A uniquely identifying name for this series
     * @param {insight.DataSet} data - The DataSet containing this series' data
     * @param {insight.Scales.Scale} x - the x axis
     * @param {insight.Scales.Scale} y - the y axis
     */
    insight.BarSeries = function BarSeries(name, data, x, y) {

        insight.Series.call(this, name, data, x, y);

        // Private variables ------------------------------------------------------------------------------------------

        var self = this;

        // Internal variables -------------------------------------------------------------------------------------------

        self.valueAxis = undefined;
        self.keyAxis = undefined;
        self.classValues = [insight.Constants.BarClass];

        // Private functions ------------------------------------------------------------------------------------------

        function tooltipFunction(d) {
            return self.tooltipFormat()(self.valueFunction()(d));
        }

        function duration(d, i) {
            return 200 + (i * 20);
        }

        function opacity() {
            // If we are using selected/notSelected, then make selected more opaque than notSelected
            if (d3.select(this).classed('notselected')) {
                return 0.5;
            }

            //If not using selected/notSelected, make everything opaque
            return 1;
        }

        function seriesSpecificClassName(d) {

            var additionalClass = ' ' + self.name + 'class';
            var baseClassName = self.itemClassName(d);
            var itemClassName = baseClassName + additionalClass;

            return itemClassName;
        }

        // Internal functions -----------------------------------------------------------------------------------------

        self.isHorizontal = function() {
            return undefined;
        };

        self.draw = function(chart) {

            self.tooltip = chart.tooltip;
            self.selectedItems = chart.selectedItems;

            var groupSelector = 'g.' + self.name + '.' + insight.Constants.BarGroupClass,
                barSelector = 'rect.' + self.shortClassName();

            var data = self.dataset();

            var groups = chart.plotArea
                .selectAll(groupSelector)
                .data(data, self.keyFunction());

            var newGroups = groups.enter()
                .append('g')
                .classed(self.name, true)
                .classed(insight.Constants.BarGroupClass, true);

            var newBars = newGroups.selectAll(barSelector);

            newGroups.append('rect')
                .attr('class', self.itemClassName)
                .attr('in_series', self.name)
                .attr('fill', self.color)
                .attr('clip-path', 'url(#' + chart.clipPath() + ')')
                .on('mouseover', self.mouseOver)
                .on('mouseout', self.mouseOut)
                .on('click', self.click);

            var seriesTypeCount = chart.countSeriesOfType(self);
            var seriesIndex = chart.seriesIndexByType(self);
            var groupIndex = 0;

            var height = (self.isHorizontal()) ? barBreadth : colBarLength;
            var width = (self.isHorizontal()) ? barLength : barBreadth;
            var xPosition = (self.isHorizontal()) ? 0 : keyPosition;
            var yPosition = (self.isHorizontal()) ? keyPosition : valuePosition;


            // Select and update all bars
            var allBars = groups.selectAll(barSelector);

            allBars.attr('class', self.itemClassName);

            allBars.transition()
                .duration(duration)
                .attr('x', xPosition)
                .attr('y', yPosition)
                .attr('height', height)
                .attr('width', width)
{'fraction_non_alphanumeric': 0.19037064400935846, 'fraction_numerical': 0.002832163526659278, 'mean_word_length': 1.3818181818181818, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '338329', 'n_tokens_mistral': 1998, 'n_tokens_neox': 1876, 'n_words': 468}