<commit_before>//
//  graphchart.cpp
//  warpdriveoverloaded
//
//  Created by <NAME> on 8/28/14.
//  Copyright (c) 2014 TAP. All rights reserved.
//

#include "graphchart.h"
#include <stdlib.h>
#include <algorithm>

GraphChart::GraphChart(_SharedPtr<ncursesWindow> parent, int xpos, int ypos) : Widget(parent, xpos, ypos){
    
    m_showBars = true;
    m_showBorder = true;
    
    m_xSize = 3;
    m_ySize = 4;
    
    getmaxyx(getParent()->get(), m_height, m_width);
    
    generateChart();
    
}

void GraphChart::setSize(int xSize, int ySize){
    
    
    if(xSize < 2)
        m_xSize = 2;
    else
        m_xSize = xSize;
    
    if(xSize < 1)
        m_xSize = 1;
    else
        m_ySize = ySize;
    
}

void GraphChart::fill(){
    
    wattrset(m_parent->get(), m_parent->getNormalColor());
    
    for(int x = 0; x < m_width; x++){
        for(int y = 0; y < m_height; y++){
            if(!(x % m_xSize) && !(y % m_ySize)){
                if(m_showBars)
                    getParent()->drawAt(x + getXpos(), y + getYpos(), '+');
            }
            else if(!(x % m_xSize)){
                if(m_showBars)
                    getParent()->drawAt(x + getXpos(), y + getYpos(), '|');
            }
            else if(!(y % m_ySize)){
                if(m_showBars)
                    getParent()->drawAt(x + getXpos(), y + getYpos(), '=');
            }
        }
    }
    
    if(m_showBorder)
        getParent()->setborder('|', '|', '=', '=', '+', '+', '+', '+');
    
    wrefresh(getParent()->get());
    
}


void GraphChart::render(){
    
    generateChart();
    placeAllPoints();
    
}


void GraphChart::generateChart(){
    
    m_rows = m_height / m_ySize;
    m_cols = m_width / m_xSize;
    
}


void GraphChart::placeRawPoint(_SharedPtr<GraphChartPoint> point){
    
    if(!point->m_hidden){
        if( point->m_Y > 0 && point->m_Y < m_height){
            if(point->m_X > 0 && point->m_X < m_width){
                wattrset(m_parent->get(), COLOR_PAIR(point->m_color));
                getParent()->drawAt( point->m_X + getXpos(), point->m_Y + getYpos(), point->m_symbol);
                wattrset(m_parent->get(), m_parent->getNormalColor());
            }
        }
    }
    
    wrefresh(getParent()->get());
}



void GraphChart::placeAllPoints(){
    
    for(size_t chartX = 0; chartX < m_chartPoints.size(); chartX++){
        
        int pointX = m_chartPoints.at(chartX)->m_X;
        int pointY = m_chartPoints.at(chartX)->m_Y;<commit_msg>Colors 2<commit_after>//
//  graphchart.cpp
//  warpdriveoverloaded
//
//  Created by <NAME> on 8/28/14.
//  Copyright (c) 2014 TAP. All rights reserved.
//

#include "graphchart.h"
#include <stdlib.h>
#include <algorithm>

GraphChart::GraphChart(_SharedPtr<ncursesWindow> parent, int xpos, int ypos) : Widget(parent, xpos, ypos){
    
    m_showBars = true;
    m_showBorder = true;
    
    m_xSize = 3;
    m_ySize = 4;
    
    getmaxyx(getParent()->get(), m_height, m_width);
    
    generateChart();
    
}

void GraphChart::setSize(int xSize, int ySize){
    
    
    if(xSize < 2)
        m_xSize = 2;
    else
        m_xSize = xSize;
    
    if(xSize < 1)
        m_xSize = 1;
    else
        m_ySize = ySize;
    
}

void GraphChart::fill(){
    
    wattrset(m_parent->get(), m_parent->getNormalColor());
    
    for(int x = 0; x < m_width; x++){
        for(int y = 0; y < m_height; y++){
            if(!(x % m_xSize) && !(y % m_ySize)){
                if(m_showBars)
                    getParent()->drawAt(x + getXpos(), y + getYpos(), '+');
            }
            else if(!(x % m_xSize)){
                if(m_showBars)
                    getParent()->drawAt(x + getXpos(), y + getYpos(), '|');
            }
            else if(!(y % m_ySize)){
                if(m_showBars)
                    getParent()->drawAt(x + getXpos(), y + getYpos(), '=');
            }
        }
    }
    
    if(m_showBorder)
        getParent()->setborder('|', '|', '=', '=', '+', '+', '+', '+');
    
    wrefresh(getParent()->get());
    
}


void GraphChart::render(){
    
    generateChart();
    placeAllPoints();
    
}


void GraphChart::generateChart(){
    
    m_rows = m_height / m_ySize;
    m_cols = m_width / m_xSize;
    
}


void GraphChart::placeRawPoint(_SharedPtr<GraphChartPoint> point){
    
    if(!point->m_hidden){
        if( point->m_Y > 0 && point->m_Y < m_height){
            if(point->m_X > 0 && point->m_X < m_width){
                wattrset(m_parent->get(), COLOR_PAIR(point->m_color));
                wattrset(m_parent->get(), m_parent->getNormalColor());
                getParent()->drawAt( point->m_X + getXpos(), point->m_Y + getYpos(), point->m_symbol);
                wattrset(m_parent->get(), m_parent->getNormalColor());
            }
        }
    }
    
    wrefresh(getParent()->get());
}



void GraphChart::placeAllPoints(){
    
    for(size_t chartX = 0; chartX < m_chartPoints.size(); chartX++){
        
        int pointX = m_chartPoints.at(chartX)->m_X;
        int pointY = m_chartPoints.at(chartX)->m_Y;
{'fraction_non_alphanumeric': 0.16817644742024418, 'fraction_numerical': 0.008074044899566759, 'mean_word_length': 1.9841363102232668, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 67, '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': '1503533', 'n_tokens_mistral': 1874, 'n_tokens_neox': 1797, 'n_words': 312}