<commit_before>/*
 * biojs-vis-yugene-graph
 * https://github.com/rowlandm/biojs-vis-rohart-msc-test
 *
 * Copyright (c) 2014 rowlandm
 * Licensed under the Apache 2 license.
 */

/**
@class biojsvisyugenegraph
 */
/*
    Copyright 2015 <NAME>

    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.


    This is a standalone unit to call when you want to create a scatter plot graph.

*/
var biojsvisyugenegraph;

/*
    Unfortunately due to the way callbacks are available, I had
    to put brush and dots outside the main function for scoping
    purposes.

    This is because they are used in the brushmove function that
    also had to sit outside the main function for scoping 
    purposes.
*/
var brush;
var dots;
var svg_line;

// this is to make the dots selected change colour and to 
// show the values of the YuGene Graph that have been 
// selected on the line itself (not the dots)
brushmove = function (graph) {
    var s = brush.extent();

    // classed is a convenience function so that if the value is true
    // the element adds "selected" to the class
    dots.classed("selected", function(d) { 
        first = s[0];
        second = s[1];
        position = d.x_position;
        result = first <= position && position <= second; 
        return result;

    });

    first = Math.floor(s[0]);
    second = Math.floor(s[1]) + 1;
    console.log(first + ':' + second);


}



module.exports = biojsvisyugenegraph = function(init_options)
{

    /* this is just to define the options as defaults: added numberFormat*/
    this.default_options = function(){

        var options = {
            target: "#graph",
            unique_id: "Sample_ID",
            margin:{top: 80, right: 0, bottom: 30, left: 0},
            height: 600,<commit_msg>Task #2371 - More information on x_position of the brush<commit_after>/*
 * biojs-vis-yugene-graph
 * https://github.com/rowlandm/biojs-vis-rohart-msc-test
 *
 * Copyright (c) 2014 rowlandm
 * Licensed under the Apache 2 license.
 */

/**
@class biojsvisyugenegraph
 */
/*
    Copyright 2015 <NAME>

    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.


    This is a standalone unit to call when you want to create a scatter plot graph.

*/
var biojsvisyugenegraph;

/*
    Unfortunately due to the way callbacks are available, I had
    to put brush and dots outside the main function for scoping
    purposes.

    This is because they are used in the brushmove function that
    also had to sit outside the main function for scoping 
    purposes.
*/
var brush;
var dots;
var svg_line;

// this is to make the dots selected change colour and to 
// show the values of the YuGene Graph that have been 
// selected on the line itself (not the dots)
brushmove = function (graph) {
    var s = brush.extent();

    // classed is a convenience function so that if the value is true
    // the element adds "selected" to the class
    dots.classed("selected", function(d) { 
        first = s[0];
        second = s[1];
        position = d.x_position;
        result = first <= position && position <= second; 
        return result;

    });

    first = Math.floor(s[0]);
    second = Math.floor(s[1]) + 1;

    // Please note that options.data[x] should always
    // have the x_position of x + 1
    // eg. options.data[0] has an x_position of 1
    yugene_value_first = options.data[first-1].yugene_value

    // check that we don't go over the number of actual values
    // in the data store
    if (options.data.length < second){
        second = options.data.length;
    }
    yugene_value_second = options.data[second-1].yugene_value

}



module.exports = biojsvisyugenegraph = function(init_options)
{

    /* this is just to define the options as defaults: added numberFormat*/
    this.default_options = function(){

        var options = {
            target: "#graph",
            unique_id: "Sample_ID",
            margin:{top: 80, right: 0, bottom: 30, left: 0},
            height: 600,
{'fraction_non_alphanumeric': 0.08520449077786688, 'fraction_numerical': 0.012630312750601443, 'mean_word_length': 2.7148175725986596, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '2071144', 'n_tokens_mistral': 1484, 'n_tokens_neox': 1389, 'n_words': 592}