<commit_before>var d3 = require('d3');
var _ = require('lodash');
var templateHTML = require('../../templates/viz/roi.jade');
var request = require('superagent');



var ROIViz = function(selector, data, images, options) {

    var $el = $(selector).first();
    $el.append(templateHTML());

    if(data.points) {
        data = data.points;
    }


    var ScatterPlot = require('../viz/scatter');
    var scatter = new ScatterPlot(selector + ' #scatter-plot', data, null, {width: $(selector).width(), height: Math.min(500, $(selector).width * 0.6)});
    var LineChart = require('../viz/line');
    var line = new LineChart(selector + ' #line-chart', Array.apply(null, new Array(1000)).map(Number.prototype.valueOf,0), null, {width: $(selector).width(), height: 300});


    var r;
    scatter.on('hover', function(d) {

        var url = $el.parent().find('.permalink').find('a').attr('href');

        if(r) {
            r.abort();
        }

        r = request.get(url + '/data/timeseries/' + d.i, function(res) {
            if((res.body.data || []).length) {
                line.updateData(res.body.data);
            }
        });
    });


};




module.exports = ROIViz;<commit_msg>Update roi.js<commit_after>var d3 = require('d3');
var _ = require('lodash');
var templateHTML = require('../../templates/viz/roi.jade');
var request = require('superagent');



var ROIViz = function(selector, data, images, options) {

    var $el = $(selector).first();
    $el.append(templateHTML());

    if(data.points) {
        data = data.points;
    }


    var ScatterPlot = require('viz/scatter');
    var scatter = new ScatterPlot(selector + ' #scatter-plot', data, null, {width: $(selector).width(), height: Math.min(500, $(selector).width * 0.6)});
    var LineChart = require('viz/line');
    var line = new LineChart(selector + ' #line-chart', Array.apply(null, new Array(1000)).map(Number.prototype.valueOf,0), null, {width: $(selector).width(), height: 300});


    var r;
    scatter.on('hover', function(d) {

        var url = $el.parent().find('.permalink').find('a').attr('href');

        if(r) {
            r.abort();
        }

        r = request.get(url + '/data/timeseries/' + d.i, function(res) {
            if((res.body.data || []).length) {
                line.updateData(res.body.data);
            }
        });
    });


};




module.exports = ROIViz;

{'fraction_non_alphanumeric': 0.19832285115303983, 'fraction_numerical': 0.012578616352201259, 'mean_word_length': 2.716510903426791, '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': '3037720', 'n_tokens_mistral': 815, 'n_tokens_neox': 762, 'n_words': 150}