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

    fc.series.bar = function() {

        var decorate = fc.utilities.fn.noop,
            xScale = d3.time.scale(),
            yScale = d3.scale.linear(),
            y1Value = function(d, i) { return d.close; },
            xValue = function(d, i) { return d.date; },
            y0Value = d3.functor(0),
            barWidth = fc.utilities.fractionalBarWidth(0.75);

        var xValueScaled = function(d, i) { return xScale(xValue(d, i)); };

        var bar = function(selection) {
            selection.each(function(data) {
                var container = d3.select(this);
                var g = fc.utilities.simpleDataJoin(container, 'bar', data, xValue);

                // enter
                g.enter()
                    .append('path');

                var width = barWidth(data.map(xValueScaled));

                var pathGenerator = fc.svg.bar()
                    .width(width);

                g.each(function(d, i) {

                    var x = xValueScaled(d, i),
                        y0 = y0Value(d, i),
                        barBottom = yScale(y0),
                        barTop = yScale(y0 + y1Value(d, i));

                    var g = d3.select(this)
                        .attr('transform', 'translate(' + x + ', ' + barTop + ')');

                    pathGenerator.x(d3.functor(0))
                        .y(d3.functor(0))
                        .height(function() { return barBottom - barTop; });

                    g.select('path')
                        .attr('d', pathGenerator([d]));
                });

                decorate(g);
            });
        };
<commit_msg>Update Bar Series to support transitions<commit_after>(function(d3, fc) {
    'use strict';

    fc.series.bar = function() {

        var decorate = fc.utilities.fn.noop,
            xScale = d3.time.scale(),
            yScale = d3.scale.linear(),
            y1Value = function(d, i) { return d.close; },
            xValue = function(d, i) { return d.date; },
            y0Value = d3.functor(0),
            barWidth = fc.utilities.fractionalBarWidth(0.75);

        var xValueScaled = function(d, i) { return xScale(xValue(d, i)); };

        var bar = function(selection) {
            selection.each(function(data) {
                var container = d3.select(this);
                var g = fc.utilities.simpleDataJoin(container, 'bar', data, xValue);

                // enter
                g.enter()
                    .append('path');

                var width = barWidth(data.map(xValueScaled));

                var pathGenerator = fc.svg.bar()
                    .width(width);

                g.each(function(d, i) {

                    var x = xValueScaled(d, i),
                        y0 = y0Value(d, i),
                        barBottom = yScale(y0),
                        barTop = yScale(y0 + y1Value(d, i));

                    pathGenerator.x(d3.functor(0))
                        .y(d3.functor(0))
                        .height(function() { return barBottom - barTop; });

                    var barGroup = d3.select(this);

                    d3.transition(barGroup)
                        .attr('transform', 'translate(' + x + ', ' + barTop + ')')
                        .select('path')
                        .attr('d', pathGenerator([d]));
                });

                decorate(g);
            });
        };

{'fraction_non_alphanumeric': 0.1343976777939042, 'fraction_numerical': 0.012481857764876633, 'mean_word_length': 1.2405721716514955, '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': '304067', 'n_tokens_mistral': 1031, 'n_tokens_neox': 951, 'n_words': 184}