<commit_before>/**
 * Created by grahamclapham on 04/12/2014.
 */
// create a global paperScope var

if(!_paper) var _paper =  new paper.PaperScope();

function PaperRenderer(target, opt_data, opt_config){

    if(opt_config){
        opt_config.createCanvas = false;
        opt_config.canvasId = target;
    }else{
        opt_config = {createCanvas:false, canvasId:target};
    }
    this.dotColor = "red"
    BaseChart.call(this, target, opt_data, opt_config); // call super constructor.

};

PaperRenderer.prototype = Object.create(BaseChart.prototype);
PaperRenderer.prototype.constructor = PaperRenderer;
PaperRenderer.prototype.postInit = function(){
    this.setPlaying(false)

    var _canv = document.getElementById(this.getCanvasId())
    if(!_canv){
        throw new Error(this.getCanvasId()+ " cannot be found.")
    }else{
        this.setCanvas(_canv)
    }

    _paper.setup(_canv);
    this._circle = new paper.Path.Circle(new paper.Point(80, 50), 10);

    this. pointArray = [];
    this._circleArray =[]
    // this.circleLayer = new _paper.Layer();

// Pass a color name to the fillColor property, which is internally
// converted to a Color.
    this._circle.fillColor = this.dotColor;
    this._path = new _paper.Path();
    this._start = new _paper.Point(100, 100);
    this._path.moveTo(this._start);
    this.myPath = new _paper.Path();
    this.myPath.add(new _paper.Point(0, 0));
    this.myPath.strokeColor = this.dotColor;

    var _this = this;

    _paper.view.onFrame = function(e){
        _onFrame.call(_this);
      //  _scribble.call(_this)
    }
}

PaperRenderer.prototype.activate = function(opt_layer){
    this._view =  _paper.View._viewsById[ this.getCanvasId() ];
    this._view._project.activate();
}

PaperRenderer.prototype.makeDot = function(x,y){
    this.activate();
    var _dot = new _paper.Shape.Circle(x,y, 6);
    _dot.fillColor = "rgba(100,200,89,1)";

    return _dot;
}

var _drawDots =function(){
    console.log("DRAW DOTS...")
    console.log("DRAW DOTS...",this._circleArray.length )
    console.log("DRAW DOTS...", this.getData().length)

    for(var dot in this._circleArray){
        console.log(this._circleArray[dot])
        this.activate();

        this._circleArray[dot].delete();
    }

    this._circleArray = []

    for(var i=0; i<this.getData().length; i++){
        // var _dot = this.makeDot( this.getData()[i].x, this.getData()[i].y );
        //console.log("DOT>>>>>>>>>>>>> ",_dot)
        this.activate();
        var _circle = new _paper.Path.Circle(new _paper.Point(this.getData()[i].x, this.getData()[i].y), 6);
        this._circleArray.push(_circle)
        _circle.fillColor = this.dotColor;
    }
    console.log(this._circleArray)
    /*

    var diff;
    if(this._circleArray.length != this.getData().length){
         diff =  this.getData().length - this._circleArray.length
        console.log("this._circleArray.length  diff ", diff)
    }
    ///////////////
    if(diff>0){
        for(var i=0; i<diff; i++){
            // var _dot = this.makeDot( this.getData()[i].x, this.getData()[i].y );
            //console.log("DOT>>>>>>>>>>>>> ",_dot)
            this.activate();
            var _circle = new _paper.Path.Circle(new _paper.Point(this.getData()[i].x, this.getData()[i].y), 6);
            this._circleArray.push(_circle)
            _circle.fillColor = this.dotColor;
        }
        console.log(this._circleArray)

    }
    ////////////<commit_msg>The romove function now working on the dots in the array.<commit_after>/**
 * Created by grahamclapham on 04/12/2014.
 */
// create a global paperScope var

if(!_paper) var _paper =  new paper.PaperScope();

function PaperRenderer(target, opt_data, opt_config){

    if(opt_config){
        opt_config.createCanvas = false;
        opt_config.canvasId = target;
    }else{
        opt_config = {createCanvas:false, canvasId:target};
    }
    this.dotColor = "red"
    BaseChart.call(this, target, opt_data, opt_config); // call super constructor.

};

PaperRenderer.prototype = Object.create(BaseChart.prototype);
PaperRenderer.prototype.constructor = PaperRenderer;
PaperRenderer.prototype.postInit = function(){
    this.setPlaying(false)

    var _canv = document.getElementById(this.getCanvasId())
    if(!_canv){
        throw new Error(this.getCanvasId()+ " cannot be found.")
    }else{
        this.setCanvas(_canv)
    }

    _paper.setup(_canv);
    this._circle = new paper.Path.Circle(new paper.Point(80, 50), 10);

    this. pointArray = [];
    this._circleArray =[]
    // this.circleLayer = new _paper.Layer();

// Pass a color name to the fillColor property, which is internally
// converted to a Color.
    this._circle.fillColor = this.dotColor;
    this._path = new _paper.Path();
    this._start = new _paper.Point(100, 100);
    this._path.moveTo(this._start);
    this.myPath = new _paper.Path();
    this.myPath.add(new _paper.Point(0, 0));
    this.myPath.strokeColor = this.dotColor;

    var _this = this;

    _paper.view.onFrame = function(e){
        _onFrame.call(_this);
      //  _scribble.call(_this)
    }
}

PaperRenderer.prototype.activate = function(opt_layer){
    this._view =  _paper.View._viewsById[ this.getCanvasId() ];
    this._view._project.activate();
}

PaperRenderer.prototype.makeDot = function(x,y){
    this.activate();
    var _dot = new _paper.Shape.Circle(x,y, 6);
    _dot.fillColor = "rgba(100,200,89,1)";
    console.log("_dot ",_dot);
    return _dot;
}

var _drawDots =function(){
    console.log("DRAW DOTS...")
    console.log("DRAW DOTS...",this._circleArray.length )
    console.log("DRAW DOTS...", this.getData().length)

    for(var dot in this._circleArray){
        this._circleArray[dot].remove()
        delete this._circleArray[dot]
    }


    this._circleArray = []

    for(var i=0; i<this.getData().length; i++){
        // var _dot = this.makeDot( this.getData()[i].x, this.getData()[i].y );
        //console.log("DOT>>>>>>>>>>>>> ",_dot)
        this.activate();
        var _circle = new _paper.Path.Circle(new _paper.Point(this.getData()[i].x, this.getData()[i].y), 6);
        this._circleArray.push(_circle)
        _circle.fillColor = this.dotColor;
    }
   // console.log(this._circleArray)
    /*

    var diff;
    if(this._circleArray.length != this.getData().length){
         diff =  this.getData().length - this._circleArray.length
        console.log("this._circleArray.length  diff ", diff)
    }
    ///////////////
    if(diff>0){
        for(var i=0; i<diff; i++){
            // var _dot = this.makeDot( this.getData()[i].x, this.getData()[i].y );
            //console.log("DOT>>>>>>>>>>>>> ",_dot)
            this.activate();
            var _circle = new _paper.Path.Circle(new _paper.Point(this.getData()[i].x, this.getData()[i].y), 6);
            this._circleArray.push(_circle)
            _circle.fillColor = this.dotColor;
        }
        console.log(this._circleArray)

    }
    ////////////
{'fraction_non_alphanumeric': 0.16484778862722574, 'fraction_numerical': 0.010626076967260195, 'mean_word_length': 2.7446236559139785, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 57, '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': '4476000', 'n_tokens_mistral': 2338, 'n_tokens_neox': 2259, 'n_words': 420}