<commit_before>/* Copyright 2015 Bloomberg Finance L.P.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

define(["widgets/js/manager", "d3", "./Mark"], function(WidgetManager, d3, mark) {
    var Mark = mark[0];
    var Label = Mark.extend({
        render: function() {
            var base_render_promise = Label.__super__.render.apply(this);
            var self = this;

            //TODO: create_listeners is put inside the promise success handler
            //because some of the functions depend on child scales being
            //created. Make sure none of the event handler functions make that
            //assumption.
            this.rotate_angle = this.model.get("rotate_angle");
            this.x_offset = this.model.get("x_offset");
            this.y_offset = this.model.get("y_offset");
            this.color = this.model.get("color");
            this.text = this.model.get("text");

            return base_render_promise.then(function() {
                self.create_listeners();
                self.draw();
            }, null);
        },
        create_listeners: function() {
            Label.__super__.create_listeners.apply(this);
            this.model.on("change:text", this.update_text, this);
            this.model.on_some_change(["font_weight", "font_size", "color", "align"], this.update_style, this);
            this.model.on("change:rotate_angle", function(model, value) { this.rotate_angle = value; this.apply_net_transform();}, this);
            this.model.on("change:y_offset", function(model, value) { this.y_offset = value; this.apply_net_transform();}, this);
            this.model.on("change:x_offset", function(model, value) { this.x_offset = value; this.apply_net_transform();}, this);
        },
        rescale: function() {
            Label.__super__.rescale.apply(this);
            this.set_ranges();
            this.apply_net_transform();
        },
        draw: function() {
            var self = this;
            this.set_ranges();
            this.el.selectAll(".label")
                .remove();

            this.el.append("text")
                .text(this.text)
                .classed("label", true);<commit_msg>missed on change for x and y<commit_after>/* Copyright 2015 Bloomberg Finance L.P.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

define(["widgets/js/manager", "d3", "./Mark"], function(WidgetManager, d3, mark) {
    var Mark = mark[0];
    var Label = Mark.extend({
        render: function() {
            var base_render_promise = Label.__super__.render.apply(this);
            var self = this;

            //TODO: create_listeners is put inside the promise success handler
            //because some of the functions depend on child scales being
            //created. Make sure none of the event handler functions make that
            //assumption.
            this.rotate_angle = this.model.get("rotate_angle");
            this.x_offset = this.model.get("x_offset");
            this.y_offset = this.model.get("y_offset");
            this.color = this.model.get("color");
            this.text = this.model.get("text");

            return base_render_promise.then(function() {
                self.create_listeners();
                self.draw();
            }, null);
        },
        create_listeners: function() {
            Label.__super__.create_listeners.apply(this);
            this.model.on("change:text", this.update_text, this);
            this.model.on_some_change(["font_weight", "font_size", "color", "align"], this.update_style, this);
            this.model.on("change:rotate_angle", function(model, value) { this.rotate_angle = value; this.apply_net_transform();}, this);
            this.model.on("change:y_offset", function(model, value) { this.y_offset = value; this.apply_net_transform();}, this);
            this.model.on("change:x_offset", function(model, value) { this.x_offset = value; this.apply_net_transform();}, this);
            this.model.on_some_change(["x", "y"], this.apply_net_transform, this);
        },
        rescale: function() {
            Label.__super__.rescale.apply(this);
            this.set_ranges();
            this.apply_net_transform();
        },
        draw: function() {
            var self = this;
            this.set_ranges();
            this.el.selectAll(".label")
                .remove();

            this.el.append("text")
                .text(this.text)
                .classed("label", true);
{'fraction_non_alphanumeric': 0.12272727272727273, 'fraction_numerical': 0.004, 'mean_word_length': 2.3707107843137254, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3291303', 'n_tokens_mistral': 1502, 'n_tokens_neox': 1469, 'n_words': 409}