<commit_before>/// <reference path="../typings/jquery/jquery.d.ts"/>
/// <reference path="../typings/d3/d3.d.ts"/>
/// <reference path="../typings/jquery/jquery.d.ts"/>
//######################################################################
//########    Date slider (more complex than it looks)
//######################################################################
var startDate = new Date("2007");
var endDate = new Date("2016");
var selectedDate = new Date("2011");

//------------------------------------------
var diffY = endDate.getFullYear() - startDate.getFullYear() + 1;
var tickvals = [];
var ticknames = [];
var canvasWidth = $('#chart').width();
var canvasHeight = $('#chart').height();

for (var i = 0; i < diffY; i++) {
    tickvals[i] = i * 12;
    ticknames[i] = "" + (startDate.getFullYear() + i);
}

$('#ex1').slider({
    formatter: function (value) {
        return 'Current value: ' + value;
    }
});

function slided() {
    Update();
}

var dateSlider = $("#ex13").slider({
    ticks: tickvals,
    ticks_labels: ticknames,
    ticks_snap_bounds: 0,
    min: 0,
    max: diffY * 12,
    step: 1,
    value: 2,
    formatter: function (value) {
        var dd = new Date(startDate.toUTCString());
        dd.setMonth(dd.getMonth() + value);
        return dd.toDateString().slice(4);
    },
}).on('slide', slided).data('slider');
dateSlider.setValue(48);

//######################################################################
//########    Main Update functions
//######################################################################

function Update() {
    //Do we have data?
    if (graphdata === undefined) {
        return;
    }

    selectedDate = new Date(startDate.toUTCString());
    selectedDate.setMonth(selectedDate.getMonth() + dateSlider.getValue());
    selected_method.SetData(graphdata);
    selected_method.SetDate(selectedDate);

    selected_method.Update();
}

$(window).resize(resize);

function resize() {
    canvasWidth = $('#chart').width();
    canvasHeight = $('#chart').height();
    selected_method.Redraw(canvasWidth, canvasHeight);
}

//######################################################################
//########    Data Picking, Validating, Loading
//######################################################################
var graphdata;
var stockData = [{ name: "Les Miserables", url: "/data/miserables.json" }, 
    { name: "Napier Publications", url: "/data/napierPublications.json" },
        { name: "freeScaleTime-300-1.4", url: "/data/freeScaleTime-300-1.4.json" }, 
            { name: "freeScaleTime-300-1.9", url: "/data/freeScaleTime-300-1.9.json" }, 
    ];
var loadedData = [];<commit_msg>Fixing data link path for live demo<commit_after>/// <reference path="../typings/jquery/jquery.d.ts"/>
/// <reference path="../typings/d3/d3.d.ts"/>
/// <reference path="../typings/jquery/jquery.d.ts"/>
//######################################################################
//########    Date slider (more complex than it looks)
//######################################################################
var startDate = new Date("2007");
var endDate = new Date("2016");
var selectedDate = new Date("2011");

//------------------------------------------
var diffY = endDate.getFullYear() - startDate.getFullYear() + 1;
var tickvals = [];
var ticknames = [];
var canvasWidth = $('#chart').width();
var canvasHeight = $('#chart').height();

for (var i = 0; i < diffY; i++) {
    tickvals[i] = i * 12;
    ticknames[i] = "" + (startDate.getFullYear() + i);
}

$('#ex1').slider({
    formatter: function (value) {
        return 'Current value: ' + value;
    }
});

function slided() {
    Update();
}

var dateSlider = $("#ex13").slider({
    ticks: tickvals,
    ticks_labels: ticknames,
    ticks_snap_bounds: 0,
    min: 0,
    max: diffY * 12,
    step: 1,
    value: 2,
    formatter: function (value) {
        var dd = new Date(startDate.toUTCString());
        dd.setMonth(dd.getMonth() + value);
        return dd.toDateString().slice(4);
    },
}).on('slide', slided).data('slider');
dateSlider.setValue(48);

//######################################################################
//########    Main Update functions
//######################################################################

function Update() {
    //Do we have data?
    if (graphdata === undefined) {
        return;
    }

    selectedDate = new Date(startDate.toUTCString());
    selectedDate.setMonth(selectedDate.getMonth() + dateSlider.getValue());
    selected_method.SetData(graphdata);
    selected_method.SetDate(selectedDate);

    selected_method.Update();
}

$(window).resize(resize);

function resize() {
    canvasWidth = $('#chart').width();
    canvasHeight = $('#chart').height();
    selected_method.Redraw(canvasWidth, canvasHeight);
}

//######################################################################
//########    Data Picking, Validating, Loading
//######################################################################
var graphdata;
var stockData = [{ name: "Les Miserables", url: "data/miserables.json" }, 
    { name: "Napier Publications", url: "data/napierPublications.json" },
        { name: "freeScaleTime-300-1.4", url: "data/freeScaleTime-300-1.4.json" }, 
            { name: "freeScaleTime-300-1.9", url: "sata/freeScaleTime-300-1.9.json" }, 
    ];
var loadedData = [];
{'fraction_non_alphanumeric': 0.3360686311077956, 'fraction_numerical': 0.01864975755315181, 'mean_word_length': 3.741821396993811, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '6289142', 'n_tokens_mistral': 1611, 'n_tokens_neox': 1496, 'n_words': 316}