<commit_before>// ==========================================================================
// Project:   Flot.GraphView
// Copyright: ©2010 <NAME> <<EMAIL>>, Inc.
// ==========================================================================
/*globals Flot */

/** @class

        (Document Your View Here)

 @extends SC.View
 */

sc_require('core.js');

Flot.GraphView = SC.View.extend(
    /** @scope Flot.GraphView.prototype */
{
    series: null,
    data: null,
    options: null,
    debugInConsole: false,
    previousPoint: null,
    showTooltip: false,

    render: function(context, firstTime) {
        sc_super();
        if (!this.get('layer') || !this.get('isVisibleInWindow')) return;

        if ((this.get('frame').width <= 0) || (this.get('frame').height <= 0)) return;

        if (($(this.get('layer')).width() <= 0) || ($(this.get('layer')).height() <= 0)) return;

        var dataObject = this.get('data'),
                data = null,
                seriesObject = this.get('series'),
                series = null;

        var options = {
            "xaxis": {
                "mode": "time",
                "timeformat": "%d/%m/%y %h:%M",
                "twelveHourClock": false
            },
            "yaxis": {
                "min": 0,
                tickFormatter: this.yaxisConverter
            },
            "series": {
                "lines": {
                    "show": true
                },
                "points": {
                    "show": true
                }
            },
            /*"lines": {
                fill: true
            },*/
            "grid": {
                "hoverable": true,
                "clickable": true
            },
            "crosshair": {
                "mode": "x"
            }
        };


        SC.Logger.log('Graph Render: ' + dataObject);

        if (!SC.empty(dataObject) && (dataObject.get('status') & SC.Record.READY)) {
            data = dataObject.get('data');
            if (this.debugInConsole) console.log(this.get('layer'));
            Flot.plot(this.get('layer'), dataObject, options);
            if (this.debugInConsole) console.log('render data');
        } else if (!SC.empty(seriesObject) && (seriesObject.get('status') & SC.Record.READY)) {
            SC.Logger.log('seriesObject.chart: ' + seriesObject.get('chart'));
            var seriesArray = seriesObject.get('chart');
            Flot.plot(this.get('layer'), seriesArray, options);
            if (this.debugInConsole) console.log('render series');
        } else {
            if (this.debugInConsole) console.warn('data was empty');
        }
        if (this.showTooltip) {
            var chartId = "#" + this.get('layer').id;
            $(chartId).bind("plothover",
                    function(event, pos, item) {
                        $("#x").text(pos.x.toFixed(2));
                        $("#y").text(pos.y.toFixed(2));<commit_msg>Moved Legend to the bottom left. <commit_after>// ==========================================================================
// Project:   Flot.GraphView
// Copyright: ©2010 <NAME> <<EMAIL>>, Inc.
// ==========================================================================
/*globals Flot */

/** @class

        (Document Your View Here)

 @extends SC.View
 */

sc_require('core.js');

Flot.GraphView = SC.View.extend(
    /** @scope Flot.GraphView.prototype */
{
    series: null,
    data: null,
    options: null,
    debugInConsole: false,
    previousPoint: null,
    showTooltip: false,

    render: function(context, firstTime) {
        sc_super();
        if (!this.get('layer') || !this.get('isVisibleInWindow')) return;

        if ((this.get('frame').width <= 0) || (this.get('frame').height <= 0)) return;

        if (($(this.get('layer')).width() <= 0) || ($(this.get('layer')).height() <= 0)) return;

        var dataObject = this.get('data'),
                data = null,
                seriesObject = this.get('series'),
                series = null;

        var options = {
            "xaxis": {
                "mode": "time",
                "timeformat": "%d/%m/%y %h:%M",
                "twelveHourClock": false
            },
            "yaxis": {
                "min": 0,
                tickFormatter: this.yaxisConverter
            },
            "series": {
                "lines": {
                    "show": true
                },
                "points": {
                    "show": true
                }
            },
            /*"lines": {
                fill: true
            },*/
            "grid": {
                "hoverable": true,
                "clickable": true
            },
            "crosshair": {
                "mode": "x"
            },
            "legend" : {
                "show": true,
                "position": "sw"
            }
        };


        SC.Logger.log('Graph Render: ' + dataObject);

        if (!SC.empty(dataObject) && (dataObject.get('status') & SC.Record.READY)) {
            data = dataObject.get('data');
            if (this.debugInConsole) console.log(this.get('layer'));
            Flot.plot(this.get('layer'), dataObject, options);
            if (this.debugInConsole) console.log('render data');
        } else if (!SC.empty(seriesObject) && (seriesObject.get('status') & SC.Record.READY)) {
            SC.Logger.log('seriesObject.chart: ' + seriesObject.get('chart'));
            var seriesArray = seriesObject.get('chart');
            Flot.plot(this.get('layer'), seriesArray, options);
            if (this.debugInConsole) console.log('render series');
        } else {
            if (this.debugInConsole) console.warn('data was empty');
        }
        if (this.showTooltip) {
            var chartId = "#" + this.get('layer').id;
            $(chartId).bind("plothover",
                    function(event, pos, item) {
                        $("#x").text(pos.x.toFixed(2));
                        $("#y").text(pos.y.toFixed(2));
{'fraction_non_alphanumeric': 0.20971781599599265, 'fraction_numerical': 0.0036734012355985972, 'mean_word_length': 1.6551418439716312, 'pattern_counts': {'":': 36, '<': 17, '<?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': '4658423', 'n_tokens_mistral': 1706, 'n_tokens_neox': 1612, 'n_words': 308}