You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
192 lines
7.5 KiB
192 lines
7.5 KiB
//
|
|
// InfographyView.swift
|
|
// TournamentStats
|
|
//
|
|
// Created by Laurent Morvillier on 05/08/2019.
|
|
// Copyright © 2019 Stax River. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
import Charts
|
|
|
|
class InfographyViewController : UIViewController {
|
|
|
|
var generator: ReportGenerator?
|
|
|
|
override func viewDidLayoutSubviews() {
|
|
|
|
super.viewDidLayoutSubviews()
|
|
|
|
let gradient: CAGradientLayer = CAGradientLayer()
|
|
|
|
let startColor = UIColor(red: 23/255, green: 72/255, blue: 61/255, alpha: 1)
|
|
let endColor = UIColor(red: 47/255, green: 149/255, blue: 126/255, alpha: 1)
|
|
|
|
gradient.colors = [startColor.cgColor, endColor.cgColor]
|
|
gradient.locations = [0.2 , 1.0]
|
|
gradient.startPoint = CGPoint(x: 0.0, y: 0.0)
|
|
gradient.endPoint = CGPoint(x: 1.0, y: 1.0)
|
|
gradient.frame = self.view.bounds
|
|
|
|
self.view.layer.insertSublayer(gradient, at: 0)
|
|
|
|
}
|
|
|
|
override func viewDidLoad() {
|
|
|
|
let totalWidth: CGFloat = 1500.0
|
|
let defaultSpacing: CGFloat = 8.0
|
|
|
|
guard let generator = self.generator else {
|
|
return
|
|
}
|
|
|
|
let mainTitle = UILabel()
|
|
mainTitle.textColor = UIColor.white
|
|
mainTitle.font = UIFont.boldSystemFont(ofSize: 64.0)
|
|
mainTitle.textAlignment = .center
|
|
mainTitle.text = "2019 WSOP"
|
|
|
|
// let table1 = TableView(data: generator.biggestWinners, frame: CGRect.zero, style: .grouped)
|
|
// table1.defineConstraints(width: 500 - defaultSpacing / 3, height: 500)
|
|
//
|
|
// let table2 = TableView(data: generator.mostWins, frame: CGRect.zero, style: .grouped)
|
|
// table2.defineConstraints(width: 500 - defaultSpacing / 3, height: 500)
|
|
//
|
|
// let table3 = TableView(data: generator.averageCash, frame: CGRect.zero, style: .grouped)
|
|
// table3.defineConstraints(width: 500 - defaultSpacing / 3, height: 500)
|
|
//
|
|
// let hstack1: UIStackView = UIStackView(arrangedSubviews: [table1, table2, table3])
|
|
// hstack1.defineConstraints(width: totalWidth, height: 300.0)
|
|
// hstack1.distribution = .equalSpacing
|
|
// hstack1.spacing = 8.0
|
|
// hstack1.axis = .horizontal
|
|
// hstack1.alignment = .top
|
|
//
|
|
// /////
|
|
//
|
|
// let title1 = TitleLabel(frame: CGRect.zero, text: "Buy-in distribution")
|
|
// let title2 = TitleLabel(frame: CGRect.zero, text: "First prizes distribution")
|
|
// let title3 = TitleLabel(frame: CGRect.zero, text: "Prizepool distribution")
|
|
//
|
|
// let hstack2a: UIStackView = UIStackView(arrangedSubviews: [title1, title2, title3])
|
|
// hstack2a.defineConstraints(width: totalWidth)
|
|
// hstack2a.distribution = .fillEqually
|
|
// hstack2a.axis = .horizontal
|
|
// hstack2a.alignment = .top
|
|
//
|
|
// /////
|
|
//
|
|
// let buyinDistribPie = PieChart(frame: CGRect.zero)
|
|
// buyinDistribPie.data = generator.tournamentBuyinDistribution.pieChartData
|
|
// buyinDistribPie.defineConstraints(height: 300)
|
|
// buyinDistribPie.notifyDataSetChanged()
|
|
//
|
|
// let firstPrizeDistributionPie = PieChart(frame: CGRect.zero)
|
|
// firstPrizeDistributionPie.data = generator.firstPrizeDistribution.pieChartData
|
|
// firstPrizeDistributionPie.defineConstraints(height: 300)
|
|
//
|
|
// let prizepoolDistribPie = PieChart(frame: CGRect.zero)
|
|
// prizepoolDistribPie.data = generator.tournamentPrizepoolDistribution.pieChartData
|
|
// prizepoolDistribPie.defineConstraints(height: 400)
|
|
//
|
|
// let hstack2: UIStackView = UIStackView(arrangedSubviews: [buyinDistribPie, firstPrizeDistributionPie, prizepoolDistribPie])
|
|
// hstack2.defineConstraints(width: totalWidth, height: 350.0)
|
|
// hstack2.distribution = .fillEqually
|
|
// hstack2.axis = .horizontal
|
|
// hstack2.alignment = .top
|
|
//
|
|
//
|
|
// /////
|
|
//
|
|
// let title31 = TitleLabel(frame: CGRect.zero, text: "Events by prizepool")
|
|
// let title32 = TitleLabel(frame: CGRect.zero, text: "Events by entries")
|
|
//
|
|
// let hstack3a: UIStackView = UIStackView(arrangedSubviews: [title31, title32])
|
|
// hstack3a.defineConstraints(width: totalWidth)
|
|
// hstack3a.distribution = .fillEqually
|
|
// hstack3a.axis = .horizontal
|
|
// hstack3a.alignment = .top
|
|
//
|
|
// /////
|
|
//
|
|
// let table31 = TableView(data: generator.tourniesByPrizepool, frame: CGRect.zero, style: .grouped)
|
|
// table31.defineConstraints(width: 750, height: 500)
|
|
//
|
|
// let table32 = TableView(data: generator.tourniesByEntries, frame: CGRect.zero, style: .grouped)
|
|
// table32.defineConstraints(width: 750, height: 500)
|
|
//
|
|
// let hstack3: UIStackView = UIStackView(arrangedSubviews: [table31, table32])
|
|
// hstack3.defineConstraints(width: totalWidth, height: 300.0)
|
|
// hstack3.distribution = .equalSpacing
|
|
// hstack3.spacing = 8.0
|
|
// hstack3.axis = .horizontal
|
|
// hstack3.alignment = .top
|
|
|
|
/////
|
|
|
|
let vstack: UIStackView = UIStackView(arrangedSubviews: [mainTitle])
|
|
// let vstack: UIStackView = UIStackView(arrangedSubviews: [mainTitle, hstack1, hstack2a, hstack2, hstack3a, hstack3])
|
|
vstack.axis = .vertical
|
|
vstack.distribution = .equalCentering
|
|
vstack.alignment = .center
|
|
vstack.spacing = 10.0
|
|
self.view.addSubview(vstack)
|
|
|
|
vstack.translatesAutoresizingMaskIntoConstraints = false
|
|
vstack.leadingAnchor.constraint(equalTo: self.view.leadingAnchor, constant: 16.0).isActive = true
|
|
vstack.trailingAnchor.constraint(equalTo: self.view.trailingAnchor, constant: -16.0).isActive = true
|
|
vstack.topAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.topAnchor, constant: 16.0).isActive = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//class InfographyView : UIView {
|
|
//
|
|
// var references: [UITableViewDataSource] = []
|
|
//
|
|
// init(frame: CGRect, generator: ReportGenerator) {
|
|
// super.init(frame: frame)
|
|
// self.backgroundColor = UIColor.lightGray
|
|
//
|
|
// let table1 = TableView(data: generator.biggestWinners, frame: CGRect.zero, style: .grouped)
|
|
// table1.defineConstraints(width: 500, height: 500)
|
|
//
|
|
// let table2 = TableView(data: generator.mostWins, frame: CGRect.zero, style: .grouped)
|
|
// table2.defineConstraints(width: 500, height: 500)
|
|
//
|
|
// let pieChart = PieChartView(frame: CGRect.zero)
|
|
// pieChart.data = generator.tournamentBuyinDistribution.pieChartData
|
|
// pieChart.defineConstraints(width: 300, height: 300)
|
|
//
|
|
// let hstack1: UIStackView = UIStackView(arrangedSubviews: [table1, table2])
|
|
// hstack1.defineConstraints(width: 1000, height: 500)
|
|
// hstack1.distribution = .fill
|
|
// hstack1.axis = .horizontal
|
|
// hstack1.alignment = .top
|
|
// hstack1.backgroundColor = UIColor.red
|
|
//
|
|
// let hstack2: UIStackView = UIStackView(arrangedSubviews: [pieChart])
|
|
// hstack2.defineConstraints(width: 1000, height: 300)
|
|
// hstack2.distribution = .fill
|
|
// hstack2.axis = .horizontal
|
|
// hstack2.alignment = .top
|
|
// hstack2.backgroundColor = UIColor.green
|
|
//
|
|
// let vstack: UIStackView = UIStackView(arrangedSubviews: [hstack1, hstack2])
|
|
// vstack.axis = .vertical
|
|
// vstack.distribution = .fill
|
|
// vstack.alignment = .leading
|
|
// vstack.backgroundColor = UIColor.blue
|
|
// self.addSubview(vstack)
|
|
// self.addMaxConstraints(view: vstack)
|
|
//
|
|
// }
|
|
//
|
|
// required init?(coder aDecoder: NSCoder) {
|
|
// fatalError("init(coder:) has not been implemented")
|
|
// }
|
|
//
|
|
//}
|
|
|