<commit_before>//
//  MCScatterChartDataSet.swift
//  ChartsMC
//
//  Created by <NAME> on 6/2/16.
//  Copyright © 2016 SROST. All rights reserved.
//

import Foundation
import Charts

enum DataSetType {
    case BloodPressureTop
    case BloodPressureBottom
    case HartRate
}

class MCScatterChartDataSet: ScatterChartDataSet {
    
    required init() {
        super.init()
    }
    
    override init(yVals: [ChartDataEntry]?, label: String?) {
        super.init(yVals: yVals, label: label)
        self.scatterShapeHoleColor = UIColor(colorLiteralRed: 51.0/255.0, green: 138.0/255.0, blue: 255.0/255.0, alpha: 1.0)
        self.colors = [UIColor.whiteColor()]
    }

    var dataSetType: DataSetType = .HartRate {
        didSet {
            switch self.dataSetType {
                case .BloodPressureTop:
                    self.scatterShape = .Custom
                    self.customScatterShape = topBloodPressurePath()
                case .BloodPressureBottom:
                    self.scatterShape = .Custom
                    self.customScatterShape = bottomBloodPressurePath()
                default:
                    self.scatterShape = .Circle
                    self.scatterShapeSize = 6.0
                    self.scatterShapeHoleRadius = self.scatterShapeSize/4.0
                }
        }<commit_msg>override of yMin and yMax values for ScatterChart<commit_after>//
//  MCScatterChartDataSet.swift
//  ChartsMC
//
//  Created by <NAME> on 6/2/16.
//  Copyright © 2016 SROST. All rights reserved.
//

import Foundation
import Charts

enum DataSetType {
    case BloodPressureTop
    case BloodPressureBottom
    case HartRate
}

class MCScatterChartDataSet: ScatterChartDataSet {
    
    required init() {
        super.init()
    }
    
    override internal var yMin: Double {
        get {
            var entryValues: [Double] = []
            for dataEntry in self.yVals {
                let entry = dataEntry as? BarChartDataEntry
                if let values = entry?.values where values.count > 0 {
                    entryValues += values
                } else {
                    entryValues.append(dataEntry.value)
                }
            }
            if entryValues.count > 0 {
                return entryValues.reduce(entryValues[0], combine: { min($0, $1) })
            }
            return 0
        }
    }
    
    override internal var yMax: Double {
        get {
            var entryValues: [Double] = []
            for dataEntry in self.yVals {
                let entry = dataEntry as? BarChartDataEntry
                if let values = entry?.values where values.count > 0 {
                    entryValues += values
                } else {
                    entryValues.append(dataEntry.value)
                }
            }
            if entryValues.count > 0 {
                return entryValues.reduce(entryValues[0], combine: { max($0, $1) })
            }
            return 0.0
        }
    }
    
    override init(yVals: [ChartDataEntry]?, label: String?) {
        super.init(yVals: yVals, label: label)
        self.scatterShapeHoleColor = UIColor(colorLiteralRed: 51.0/255.0, green: 138.0/255.0, blue: 255.0/255.0, alpha: 1.0)
        self.colors = [UIColor.whiteColor()]
    }
    
    var dataSetType: DataSetType = .HartRate {
        didSet {
            switch self.dataSetType {
                case .BloodPressureTop:
                    self.scatterShape = .Custom
                    self.customScatterShape = topBloodPressurePath()
                case .BloodPressureBottom:
                    self.scatterShape = .Custom
                    self.customScatterShape = bottomBloodPressurePath()
                default:
                    self.scatterShape = .Circle
                    self.scatterShapeSize = 6.0
                    self.scatterShapeHoleRadius = self.scatterShapeSize/4.0
                }
        }
{'fraction_non_alphanumeric': 0.08698979591836735, 'fraction_numerical': 0.022193877551020407, 'mean_word_length': 1.5543973941368079, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4625323', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1078, 'n_words': 243}