<commit_before>(function(d3, fc) {
    'use strict';

    fc.series.stackedBar = function() {

        var stackedBar = function(selection) {
            var container;

            selection.each(function(data) {

                // add a 'root' g element on the first enter selection. This ensures
                // that it is just added once
                container = d3.select(this);

                var layers = stackLayout(data);

                var g = fc.utilities.simpleDataJoin(container, 'stacked-bar', layers);

                var bar = g.selectAll('rect')
                    .data(function(d) { return stackLayout.values()(d); })
                    .enter()
                    .append('rect');

                var xValues = stackedBar.xScale().domain();
                var xPositions = xValues.map(function(d) { return stackedBar.xScale()(d); });
                var width = stackedBar.barWidth()(xPositions);

                // update
                bar.attr('x', function(d) { return stackedBar.xScale()(stackLayout.x()(d)) - width / 2; })
                    .attr('y', function(d) {
                        return stackedBar.yScale()(stackLayout.y()(d) + stackedBar.getBaseline()(d));
                    })
                    .attr('width', width)
                    .attr('height', function(d) {
                        var baselineValue = stackedBar.getBaseline()(d);
                        var topValue = stackedBar.y()(d);

                        var bottomPixel = stackedBar.yScale()(baselineValue);
                        var topPixel = stackedBar.yScale()(topValue + baselineValue);

                        return bottomPixel - topPixel;
                    });

                stackedBar.decorate()(g);<commit_msg>Pulls container declaration into lowest possible scope.<commit_after>(function(d3, fc) {
    'use strict';

    fc.series.stackedBar = function() {

        var stackedBar = function(selection) {

            selection.each(function(data) {

                // add a 'root' g element on the first enter selection. This ensures
                // that it is just added once
                var container = d3.select(this);

                var layers = stackLayout(data);

                var g = fc.utilities.simpleDataJoin(container, 'stacked-bar', layers);

                var bar = g.selectAll('rect')
                    .data(function(d) { return stackLayout.values()(d); })
                    .enter()
                    .append('rect');

                var xValues = stackedBar.xScale().domain();
                var xPositions = xValues.map(function(d) { return stackedBar.xScale()(d); });
                var width = stackedBar.barWidth()(xPositions);

                // update
                bar.attr('x', function(d) { return stackedBar.xScale()(stackLayout.x()(d)) - width / 2; })
                    .attr('y', function(d) {
                        return stackedBar.yScale()(stackLayout.y()(d) + stackedBar.getBaseline()(d));
                    })
                    .attr('width', width)
                    .attr('height', function(d) {
                        var baselineValue = stackedBar.getBaseline()(d);
                        var topValue = stackedBar.y()(d);

                        var bottomPixel = stackedBar.yScale()(baselineValue);
                        var topPixel = stackedBar.yScale()(topValue + baselineValue);

                        return bottomPixel - topPixel;
                    });

                stackedBar.decorate()(g);
{'fraction_non_alphanumeric': 0.12319864368465669, 'fraction_numerical': 0.0016953941791466515, 'mean_word_length': 1.4842105263157894, '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': '101789', 'n_tokens_mistral': 971, 'n_tokens_neox': 861, 'n_words': 188}