More improvements in the infography

master
Laurent 6 years ago
parent f64ac3ed27
commit 3bf0aa4eb4
  1. 24
      TournamentStats.xcodeproj/project.pbxproj
  2. 29
      TournamentStats/AppDelegate.swift
  3. 176
      TournamentStats/Seed.swift
  4. 19
      TournamentStats/UI/Fonts.swift
  5. 51
      TournamentStats/UI/components/DataSourceWrapper.swift
  6. 24
      TournamentStats/UI/components/Label.swift
  7. 3
      TournamentStats/UI/components/PieChart.swift
  8. 30
      TournamentStats/UI/components/TableView.swift
  9. 217
      TournamentStats/UI/reports/InfographyView.swift
  10. 280
      TournamentStats/UI/reports/InfographyView.xib
  11. 192
      TournamentStats/UI/reports/InfographyViewController.swift
  12. 11
      TournamentStats/report/Queries.swift
  13. 22
      TournamentStats/report/ReportGenerator.swift
  14. 21
      TournamentStats/report/structures/CountryCounter.swift
  15. 4
      TournamentStats/report/structures/CumulatedResults.swift
  16. 8
      TournamentStats/report/structures/TournamentRepresentable.swift
  17. 85
      TournamentStats/report/structures/TournamentStats.swift
  18. 26
      TournamentStats/utils/ColumnRepresentable.swift

@ -36,7 +36,7 @@
4D2F1C5B22CC92D1007C639E /* event84 in Resources */ = {isa = PBXBuildFile; fileRef = 4D2F1C4322CC92D1007C639E /* event84 */; }; 4D2F1C5B22CC92D1007C639E /* event84 in Resources */ = {isa = PBXBuildFile; fileRef = 4D2F1C4322CC92D1007C639E /* event84 */; };
4D30463322F4232600DA86C4 /* event57 in Resources */ = {isa = PBXBuildFile; fileRef = 4D30463122F4232600DA86C4 /* event57 */; }; 4D30463322F4232600DA86C4 /* event57 in Resources */ = {isa = PBXBuildFile; fileRef = 4D30463122F4232600DA86C4 /* event57 */; };
4D30463422F4232600DA86C4 /* event78 in Resources */ = {isa = PBXBuildFile; fileRef = 4D30463222F4232600DA86C4 /* event78 */; }; 4D30463422F4232600DA86C4 /* event78 in Resources */ = {isa = PBXBuildFile; fileRef = 4D30463222F4232600DA86C4 /* event78 */; };
4D39B6F122F829A500625E31 /* InfographyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D39B6F022F829A500625E31 /* InfographyView.swift */; }; 4D39B6F122F829A500625E31 /* InfographyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D39B6F022F829A500625E31 /* InfographyViewController.swift */; };
4D39B6F322F8549100625E31 /* DataSourceWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D39B6F222F8549100625E31 /* DataSourceWrapper.swift */; }; 4D39B6F322F8549100625E31 /* DataSourceWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D39B6F222F8549100625E31 /* DataSourceWrapper.swift */; };
4D39B6F522F856EF00625E31 /* StackTableCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4D39B6F422F856EF00625E31 /* StackTableCell.xib */; }; 4D39B6F522F856EF00625E31 /* StackTableCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4D39B6F422F856EF00625E31 /* StackTableCell.xib */; };
4D39B6F722F8573900625E31 /* StackTableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D39B6F622F8573900625E31 /* StackTableCell.swift */; }; 4D39B6F722F8573900625E31 /* StackTableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D39B6F622F8573900625E31 /* StackTableCell.swift */; };
@ -44,6 +44,10 @@
4D39B6FC22F8686300625E31 /* CumulatedWins.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D39B6FB22F8686300625E31 /* CumulatedWins.swift */; }; 4D39B6FC22F8686300625E31 /* CumulatedWins.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D39B6FB22F8686300625E31 /* CumulatedWins.swift */; };
4D39B6FE22F87C3700625E31 /* Charts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D39B6FD22F87C3700625E31 /* Charts.framework */; }; 4D39B6FE22F87C3700625E31 /* Charts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D39B6FD22F87C3700625E31 /* Charts.framework */; };
4DA5CA1E22AD078A00AC628E /* CountryCounter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DA5CA1D22AD078A00AC628E /* CountryCounter.swift */; }; 4DA5CA1E22AD078A00AC628E /* CountryCounter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DA5CA1D22AD078A00AC628E /* CountryCounter.swift */; };
4DB113D72305480600D0C671 /* InfographyView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4DB113D62305480600D0C671 /* InfographyView.xib */; };
4DB113D923054A4100D0C671 /* InfographyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DB113D823054A4100D0C671 /* InfographyView.swift */; };
4DB113DB230559F600D0C671 /* Label.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DB113DA230559F600D0C671 /* Label.swift */; };
4DB113DD2305882A00D0C671 /* Fonts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DB113DC2305882A00D0C671 /* Fonts.swift */; };
4DDEF11422AE4FB900F4D7C1 /* TournamentStats.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DDEF11322AE4FB900F4D7C1 /* TournamentStats.swift */; }; 4DDEF11422AE4FB900F4D7C1 /* TournamentStats.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DDEF11322AE4FB900F4D7C1 /* TournamentStats.swift */; };
4DF7608422A3FB96004B0EF1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DF7608322A3FB96004B0EF1 /* AppDelegate.swift */; }; 4DF7608422A3FB96004B0EF1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DF7608322A3FB96004B0EF1 /* AppDelegate.swift */; };
4DF7608622A3FB96004B0EF1 /* MasterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DF7608522A3FB96004B0EF1 /* MasterViewController.swift */; }; 4DF7608622A3FB96004B0EF1 /* MasterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DF7608522A3FB96004B0EF1 /* MasterViewController.swift */; };
@ -178,7 +182,7 @@
4D2F1C4322CC92D1007C639E /* event84 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = event84; sourceTree = "<group>"; }; 4D2F1C4322CC92D1007C639E /* event84 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = event84; sourceTree = "<group>"; };
4D30463122F4232600DA86C4 /* event57 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = event57; sourceTree = "<group>"; }; 4D30463122F4232600DA86C4 /* event57 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = event57; sourceTree = "<group>"; };
4D30463222F4232600DA86C4 /* event78 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = event78; sourceTree = "<group>"; }; 4D30463222F4232600DA86C4 /* event78 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = event78; sourceTree = "<group>"; };
4D39B6F022F829A500625E31 /* InfographyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfographyView.swift; sourceTree = "<group>"; }; 4D39B6F022F829A500625E31 /* InfographyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfographyViewController.swift; sourceTree = "<group>"; };
4D39B6F222F8549100625E31 /* DataSourceWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataSourceWrapper.swift; sourceTree = "<group>"; }; 4D39B6F222F8549100625E31 /* DataSourceWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataSourceWrapper.swift; sourceTree = "<group>"; };
4D39B6F422F856EF00625E31 /* StackTableCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = StackTableCell.xib; sourceTree = "<group>"; }; 4D39B6F422F856EF00625E31 /* StackTableCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = StackTableCell.xib; sourceTree = "<group>"; };
4D39B6F622F8573900625E31 /* StackTableCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StackTableCell.swift; sourceTree = "<group>"; }; 4D39B6F622F8573900625E31 /* StackTableCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StackTableCell.swift; sourceTree = "<group>"; };
@ -186,6 +190,10 @@
4D39B6FB22F8686300625E31 /* CumulatedWins.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CumulatedWins.swift; sourceTree = "<group>"; }; 4D39B6FB22F8686300625E31 /* CumulatedWins.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CumulatedWins.swift; sourceTree = "<group>"; };
4D39B6FD22F87C3700625E31 /* Charts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Charts.framework; path = Carthage/Build/iOS/Charts.framework; sourceTree = "<group>"; }; 4D39B6FD22F87C3700625E31 /* Charts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Charts.framework; path = Carthage/Build/iOS/Charts.framework; sourceTree = "<group>"; };
4DA5CA1D22AD078A00AC628E /* CountryCounter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountryCounter.swift; sourceTree = "<group>"; }; 4DA5CA1D22AD078A00AC628E /* CountryCounter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountryCounter.swift; sourceTree = "<group>"; };
4DB113D62305480600D0C671 /* InfographyView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = InfographyView.xib; sourceTree = "<group>"; };
4DB113D823054A4100D0C671 /* InfographyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfographyView.swift; sourceTree = "<group>"; };
4DB113DA230559F600D0C671 /* Label.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Label.swift; sourceTree = "<group>"; };
4DB113DC2305882A00D0C671 /* Fonts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Fonts.swift; sourceTree = "<group>"; };
4DDEF11322AE4FB900F4D7C1 /* TournamentStats.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TournamentStats.swift; sourceTree = "<group>"; }; 4DDEF11322AE4FB900F4D7C1 /* TournamentStats.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TournamentStats.swift; sourceTree = "<group>"; };
4DF7608022A3FB96004B0EF1 /* TournamentStats.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TournamentStats.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4DF7608022A3FB96004B0EF1 /* TournamentStats.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TournamentStats.app; sourceTree = BUILT_PRODUCTS_DIR; };
4DF7608322A3FB96004B0EF1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 4DF7608322A3FB96004B0EF1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@ -308,7 +316,9 @@
4D97941222F827A5004A2D7F /* reports */ = { 4D97941222F827A5004A2D7F /* reports */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
4D39B6F022F829A500625E31 /* InfographyView.swift */, 4D39B6F022F829A500625E31 /* InfographyViewController.swift */,
4DB113D62305480600D0C671 /* InfographyView.xib */,
4DB113D823054A4100D0C671 /* InfographyView.swift */,
); );
path = reports; path = reports;
sourceTree = "<group>"; sourceTree = "<group>";
@ -498,6 +508,7 @@
4D39B6F622F8573900625E31 /* StackTableCell.swift */, 4D39B6F622F8573900625E31 /* StackTableCell.swift */,
4D39B6F922F85C3400625E31 /* UIView+Extensions.swift */, 4D39B6F922F85C3400625E31 /* UIView+Extensions.swift */,
4DF78DD322F9C85C00C02F73 /* UIColor+Extensions.swift */, 4DF78DD322F9C85C00C02F73 /* UIColor+Extensions.swift */,
4DB113DC2305882A00D0C671 /* Fonts.swift */,
); );
path = UI; path = UI;
sourceTree = "<group>"; sourceTree = "<group>";
@ -544,6 +555,7 @@
4DF78DD022F9AADF00C02F73 /* TableView.swift */, 4DF78DD022F9AADF00C02F73 /* TableView.swift */,
4D39B6F222F8549100625E31 /* DataSourceWrapper.swift */, 4D39B6F222F8549100625E31 /* DataSourceWrapper.swift */,
4DF78DD522F9CE7E00C02F73 /* TitleLabel.swift */, 4DF78DD522F9CE7E00C02F73 /* TitleLabel.swift */,
4DB113DA230559F600D0C671 /* Label.swift */,
); );
path = components; path = components;
sourceTree = "<group>"; sourceTree = "<group>";
@ -643,6 +655,7 @@
4DF7609022A3FB98004B0EF1 /* LaunchScreen.storyboard in Resources */, 4DF7609022A3FB98004B0EF1 /* LaunchScreen.storyboard in Resources */,
4DF7612B22A56797004B0EF1 /* event15 in Resources */, 4DF7612B22A56797004B0EF1 /* event15 in Resources */,
4DF7608D22A3FB98004B0EF1 /* Assets.xcassets in Resources */, 4DF7608D22A3FB98004B0EF1 /* Assets.xcassets in Resources */,
4DB113D72305480600D0C671 /* InfographyView.xib in Resources */,
4D2F1C5722CC92D1007C639E /* event72 in Resources */, 4D2F1C5722CC92D1007C639E /* event72 in Resources */,
4DF7613722A56797004B0EF1 /* event68 in Resources */, 4DF7613722A56797004B0EF1 /* event68 in Resources */,
4DF7611922A56797004B0EF1 /* event18 in Resources */, 4DF7611922A56797004B0EF1 /* event18 in Resources */,
@ -765,12 +778,13 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
4DF7614822A59660004B0EF1 /* ReportGenerator.swift in Sources */, 4DF7614822A59660004B0EF1 /* ReportGenerator.swift in Sources */,
4DB113D923054A4100D0C671 /* InfographyView.swift in Sources */,
4DF78DD422F9C85C00C02F73 /* UIColor+Extensions.swift in Sources */, 4DF78DD422F9C85C00C02F73 /* UIColor+Extensions.swift in Sources */,
4DF760C222A561FF004B0EF1 /* ColumnRepresentable.swift in Sources */, 4DF760C222A561FF004B0EF1 /* ColumnRepresentable.swift in Sources */,
4DF760B022A47C74004B0EF1 /* RowImporter.swift in Sources */, 4DF760B022A47C74004B0EF1 /* RowImporter.swift in Sources */,
4DF7614A22A66675004B0EF1 /* TournamentWinner.swift in Sources */, 4DF7614A22A66675004B0EF1 /* TournamentWinner.swift in Sources */,
4D0F103722C4C08F005F797A /* ChipCount.swift in Sources */, 4D0F103722C4C08F005F797A /* ChipCount.swift in Sources */,
4D39B6F122F829A500625E31 /* InfographyView.swift in Sources */, 4D39B6F122F829A500625E31 /* InfographyViewController.swift in Sources */,
4DF760B322A47CAE004B0EF1 /* Realm+Extensions.swift in Sources */, 4DF760B322A47CAE004B0EF1 /* Realm+Extensions.swift in Sources */,
4DF7608822A3FB96004B0EF1 /* DetailViewController.swift in Sources */, 4DF7608822A3FB96004B0EF1 /* DetailViewController.swift in Sources */,
4DF78DD122F9AADF00C02F73 /* TableView.swift in Sources */, 4DF78DD122F9AADF00C02F73 /* TableView.swift in Sources */,
@ -787,6 +801,7 @@
4DF78DCE22F9AA3F00C02F73 /* PieChart.swift in Sources */, 4DF78DCE22F9AA3F00C02F73 /* PieChart.swift in Sources */,
4DF7614622A59407004B0EF1 /* CumulatedResults.swift in Sources */, 4DF7614622A59407004B0EF1 /* CumulatedResults.swift in Sources */,
4D0F103922C4C1C4005F797A /* ChipCountParser.swift in Sources */, 4D0F103922C4C1C4005F797A /* ChipCountParser.swift in Sources */,
4DB113DD2305882A00D0C671 /* Fonts.swift in Sources */,
4D39B6FA22F85C3400625E31 /* UIView+Extensions.swift in Sources */, 4D39B6FA22F85C3400625E31 /* UIView+Extensions.swift in Sources */,
4DF760BF22A560AA004B0EF1 /* FileWriter.swift in Sources */, 4DF760BF22A560AA004B0EF1 /* FileWriter.swift in Sources */,
4DA5CA1E22AD078A00AC628E /* CountryCounter.swift in Sources */, 4DA5CA1E22AD078A00AC628E /* CountryCounter.swift in Sources */,
@ -794,6 +809,7 @@
4DF760BC22A5270E004B0EF1 /* Queries.swift in Sources */, 4DF760BC22A5270E004B0EF1 /* Queries.swift in Sources */,
4DF760BA22A524F4004B0EF1 /* Formatters.swift in Sources */, 4DF760BA22A524F4004B0EF1 /* Formatters.swift in Sources */,
4DF7614D22A6CC0D004B0EF1 /* NotablePlayers.swift in Sources */, 4DF7614D22A6CC0D004B0EF1 /* NotablePlayers.swift in Sources */,
4DB113DB230559F600D0C671 /* Label.swift in Sources */,
4DF760C922A56497004B0EF1 /* Seed.swift in Sources */, 4DF760C922A56497004B0EF1 /* Seed.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;

@ -36,15 +36,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
print("start report generation...") print("start report generation...")
let s = Date() let s = Date()
let generator = ReportGenerator() let generator = ReportGenerator()
generator.go() generator.go(importData: false)
let d = Date().timeIntervalSince(s) let d = Date().timeIntervalSince(s)
print("reports created in \(d)s") print("reports created in \(d)s")
if let ivc = UIStoryboard(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "container") as? InfographyViewController { if let infographyView = Bundle.main.loadNibNamed("InfographyView", owner: self, options: nil)?.first as? InfographyView {
ivc.generator = generator infographyView.generator = generator
ivc.view.frame = CGRect(x: 0, y: 0, width: 1000, height: 1000)
if let imageData = ivc.view.toImage()?.pngData() { if let imageData = infographyView.toImage()?.pngData() {
guard let directory = try? FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false) as NSURL else { guard let directory = try? FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false) as NSURL else {
return false return false
@ -60,6 +59,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
} }
// if let ivc = UIStoryboard(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "container") as? InfographyViewController {
// ivc.generator = generator
// ivc.view.frame = CGRect(x: 0, y: 0, width: 1500, height: 1500)
//
// if let imageData = ivc.view.toImage()?.pngData() {
//
// guard let directory = try? FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false) as NSURL else {
// return false
// }
//
// do {
// try imageData.write(to: directory.appendingPathComponent("infography.png")!)
// } catch {
// print(error.localizedDescription)
// }
//
// }
//
// }
return true return true
} }

@ -25,94 +25,94 @@ class Seed {
static let tournamentsDescriptions: [TD] = [ static let tournamentsDescriptions: [TD] = [
TD(date: "31/05/2019", name: "Casino Employees Event", number: 1, buyin: 500, entries: 685, prizePool: 297975), TD(date: "31/05/2019", name: "Casino Employees Event", number: 1, buyin: 500, entries: 685, prizePool: 297975),
TD(date: "30/05/2019", name: "Super Turbo Bounty", number: 2, buyin: 10000, entries: 204, prizePool: 1917600), TD(date: "30/05/2019", name: "Super Turbo Bounty", number: 2, buyin: 10000, entries: 204, prizePool: 1917600),
// TD(date: "08/06/2019", name: "BIG 50 No-Limit Hold'em", number: 3, buyin: 500, entries: 28371, prizePool: 13509435), TD(date: "08/06/2019", name: "BIG 50 No-Limit Hold'em", number: 3, buyin: 500, entries: 28371, prizePool: 13509435),
// TD(date: "02/06/2019", name: "Omaha Hi/Lo 8 or Better", number: 4, buyin: 1500, entries: 853, prizePool: 1151550), TD(date: "02/06/2019", name: "Omaha Hi/Lo 8 or Better", number: 4, buyin: 1500, entries: 853, prizePool: 1151550),
// TD(date: "03/06/2019", name: "High Roller No-Limit Hold'em for the 50th Annual", number: 5, buyin: 50000, entries: 110, prizePool: 5280000), TD(date: "03/06/2019", name: "High Roller No-Limit Hold'em for the 50th Annual", number: 5, buyin: 50000, entries: 110, prizePool: 5280000),
// TD(date: "03/06/2019", name: "Limit Mixed Triple Draw", number: 6, buyin: 2500, entries: 296, prizePool: 666000), TD(date: "03/06/2019", name: "Limit Mixed Triple Draw", number: 6, buyin: 2500, entries: 296, prizePool: 666000),
// TD(date: "03/06/2019", name: "WSOP.com ONLINE No-Limit Hold'em", number: 7, buyin: 400, entries: 2825, prizePool: 1017000), TD(date: "03/06/2019", name: "WSOP.com ONLINE No-Limit Hold'em", number: 7, buyin: 400, entries: 2825, prizePool: 1017000),
// TD(date: "05/06/2019", name: "Short Deck No-Limit Hold'em", number: 8, buyin: 10000, entries: 114, prizePool: 1071600), TD(date: "05/06/2019", name: "Short Deck No-Limit Hold'em", number: 8, buyin: 10000, entries: 114, prizePool: 1071600),
// TD(date: "06/06/2019", name: "No-Limit Hold'em Deepstack", number: 9, buyin: 600, entries: 6150, prizePool: 3229275), TD(date: "06/06/2019", name: "No-Limit Hold'em Deepstack", number: 9, buyin: 600, entries: 6150, prizePool: 3229275),
// TD(date: "06/06/2019", name: "Dealers Choice", number: 10, buyin: 150, entries: 470, prizePool: 634500), TD(date: "06/06/2019", name: "Dealers Choice", number: 10, buyin: 150, entries: 470, prizePool: 634500),
// TD(date: "07/06/2019", name: "No-Limit Hold'em", number: 11, buyin: 5000, entries: 400, prizePool: 1860000), TD(date: "07/06/2019", name: "No-Limit Hold'em", number: 11, buyin: 5000, entries: 400, prizePool: 1860000),
// TD(date: "06/06/2019", name: "No-Limit Hold'em Super Turbo Bounty", number: 12, buyin: 1000, entries: 2452, prizePool: 1471200), TD(date: "06/06/2019", name: "No-Limit Hold'em Super Turbo Bounty", number: 12, buyin: 1000, entries: 2452, prizePool: 1471200),
// TD(date: "07/06/2019", name: "No-Limit 2-7 Lowball Draw", number: 13, buyin: 1500, entries: 296, prizePool: 399600), TD(date: "07/06/2019", name: "No-Limit 2-7 Lowball Draw", number: 13, buyin: 1500, entries: 296, prizePool: 399600),
// TD(date: "09/06/2019", name: "HORSE", number: 14, buyin: 1500, entries: 751, prizePool: 1013850), TD(date: "09/06/2019", name: "HORSE", number: 14, buyin: 1500, entries: 751, prizePool: 1013850),
// TD(date: "09/06/2019", name: "Heads-Up No-Limit Hold'em", number: 15, buyin: 10000, entries: 112, prizePool: 1052800), TD(date: "09/06/2019", name: "Heads-Up No-Limit Hold'em", number: 15, buyin: 10000, entries: 112, prizePool: 1052800),
// TD(date: "09/06/2019", name: "No-Limit Hold'em 6-Handed", number: 16, buyin: 1500, entries: 1832, prizePool: 2473200), TD(date: "09/06/2019", name: "No-Limit Hold'em 6-Handed", number: 16, buyin: 1500, entries: 1832, prizePool: 2473200),
// TD(date: "09/06/2019", name: "No-Limit Hold'em Shootout", number: 17, buyin: 1500, entries: 917, prizePool: 1237950), TD(date: "09/06/2019", name: "No-Limit Hold'em Shootout", number: 17, buyin: 1500, entries: 917, prizePool: 1237950),
// TD(date: "10/06/2019", name: "Omaha Hi-Lo 8 or Better", number: 18, buyin: 10000, entries: 183, prizePool: 1720200), TD(date: "10/06/2019", name: "Omaha Hi-Lo 8 or Better", number: 18, buyin: 10000, entries: 183, prizePool: 1720200),
// TD(date: "13/06/2019", name: "Millionaire Maker - No-Limit Hold'em", number: 19, buyin: 1500, entries: 8809, prizePool: 11892150), TD(date: "13/06/2019", name: "Millionaire Maker - No-Limit Hold'em", number: 19, buyin: 1500, entries: 8809, prizePool: 11892150),
// TD(date: "11/06/2019", name: "Seven-Card Stud", number: 20, buyin: 1500, entries: 285, prizePool: 384750), TD(date: "11/06/2019", name: "Seven-Card Stud", number: 20, buyin: 1500, entries: 285, prizePool: 384750),
// TD(date: "12/06/2019", name: "No-Limit 2-7 Lowball Draw", number: 21, buyin: 10000, entries: 91, prizePool: 855400), TD(date: "12/06/2019", name: "No-Limit 2-7 Lowball Draw", number: 21, buyin: 10000, entries: 91, prizePool: 855400),
// TD(date: "12/06/2019", name: "Double Stack No-Limit Hold'em", number: 22, buyin: 1000, entries: 3253, prizePool: 2927700), TD(date: "12/06/2019", name: "Double Stack No-Limit Hold'em", number: 22, buyin: 1000, entries: 3253, prizePool: 2927700),
// TD(date: "13/06/2019", name: "Eight Game Mix", number: 23, buyin: 1500, entries: 612, prizePool: 826200), TD(date: "13/06/2019", name: "Eight Game Mix", number: 23, buyin: 1500, entries: 612, prizePool: 826200),
// TD(date: "11/06/2019", name: "WSOP.com ONLINE Pot-Limit Omaha 6-Handed", number: 24, buyin: 600, entries: 1216, prizePool: 656640), TD(date: "11/06/2019", name: "WSOP.com ONLINE Pot-Limit Omaha 6-Handed", number: 24, buyin: 600, entries: 1216, prizePool: 656640),
// TD(date: "13/06/2019", name: "Pot-Limit Omaha Deepstack", number: 25, buyin: 600, entries: 2577, prizePool: 1352925), TD(date: "13/06/2019", name: "Pot-Limit Omaha Deepstack", number: 25, buyin: 600, entries: 2577, prizePool: 1352925),
// TD(date: "16/06/2019", name: "No-Limit Hold'em Marathon", number: 26, buyin: 2620, entries: 1083, prizePool: 2553714), TD(date: "16/06/2019", name: "No-Limit Hold'em Marathon", number: 26, buyin: 2620, entries: 1083, prizePool: 2553714),
// TD(date: "14/06/2019", name: "Seven-Card Stud Hi/Lo 8 or Better", number: 27, buyin: 1500, entries: 460, prizePool: 621000), TD(date: "14/06/2019", name: "Seven-Card Stud Hi/Lo 8 or Better", number: 27, buyin: 1500, entries: 460, prizePool: 621000),
// TD(date: "14/06/2019", name: "No-Limit Hold'em", number: 28, buyin: 1000, entries: 2477, prizePool: 2229300), TD(date: "14/06/2019", name: "No-Limit Hold'em", number: 28, buyin: 1000, entries: 2477, prizePool: 2229300),
// TD(date: "15/06/2019", name: "HORSE", number: 29, buyin: 10000, entries: 172, prizePool: 1616800), TD(date: "15/06/2019", name: "HORSE", number: 29, buyin: 10000, entries: 172, prizePool: 1616800),
// TD(date: "16/06/2019", name: "Pot-Limit Omaha", number: 30, buyin: 1000, entries: 1526, prizePool: 1374300), TD(date: "16/06/2019", name: "Pot-Limit Omaha", number: 30, buyin: 1000, entries: 1526, prizePool: 1374300),
// TD(date: "15/06/2019", name: "No-Limit Hold'em 6-Handed", number: 31, buyin: 3000, entries: 754, prizePool: 2035800), TD(date: "15/06/2019", name: "No-Limit Hold'em 6-Handed", number: 31, buyin: 3000, entries: 754, prizePool: 2035800),
// TD(date: "17/06/2019", name: "Seniors No-Limit Hold'em", number: 32, buyin: 1000, entries: 5916 , prizePool: 5324400), TD(date: "17/06/2019", name: "Seniors No-Limit Hold'em", number: 32, buyin: 1000, entries: 5916 , prizePool: 5324400),
// TD(date: "16/06/2019", name: "Limit 2-7 Lowball Triple Draw", number: 33, buyin: 1500, entries: 467, prizePool: 630450), TD(date: "16/06/2019", name: "Limit 2-7 Lowball Triple Draw", number: 33, buyin: 1500, entries: 467, prizePool: 630450),
// TD(date: "17/06/2019", name: "WSOP.com ONLINE No-Limit Hold'em Knockout Bounty", number: 38, buyin: 600, entries: 1224, prizePool: 550800), TD(date: "17/06/2019", name: "WSOP.com ONLINE No-Limit Hold'em Knockout Bounty", number: 38, buyin: 600, entries: 1224, prizePool: 550800),
// TD(date: "18/06/2019", name: "Dealers Choice 6-Handed", number: 35, buyin: 10000, entries: 122, prizePool: 1146800), TD(date: "18/06/2019", name: "Dealers Choice 6-Handed", number: 35, buyin: 10000, entries: 122, prizePool: 1146800),
// TD(date: "18/06/2019", name: "No-Limit Hold'em Shootout", number: 36, buyin: 3000, entries: 313, prizePool: 845100), TD(date: "18/06/2019", name: "No-Limit Hold'em Shootout", number: 36, buyin: 3000, entries: 313, prizePool: 845100),
// TD(date: "19/06/2019", name: "No-Limit Hold'em Deepstack", number: 37, buyin: 800, entries: 2808, prizePool: 1999296), TD(date: "19/06/2019", name: "No-Limit Hold'em Deepstack", number: 37, buyin: 800, entries: 2808, prizePool: 1999296),
// TD(date: "20/06/2019", name: "Double Stack No-Limit Hold'em", number: 34, buyin: 1000, entries: 6241, prizePool: 5592600), TD(date: "20/06/2019", name: "Double Stack No-Limit Hold'em", number: 34, buyin: 1000, entries: 6241, prizePool: 5592600),
// TD(date: "20/06/2019", name: "Pot-Limit Omaha", number: 40, buyin: 1500, entries: 1216, prizePool: 1641600), TD(date: "20/06/2019", name: "Pot-Limit Omaha", number: 40, buyin: 1500, entries: 1216, prizePool: 1641600),
// TD(date: "20/06/2019", name: "Seven Card Stud", number: 41, buyin: 10000, entries: 88, prizePool: 827200), TD(date: "20/06/2019", name: "Seven Card Stud", number: 41, buyin: 10000, entries: 88, prizePool: 827200),
// TD(date: "21/06/2019", name: "Super Seniors No-Limit Hold'em", number: 39, buyin: 1000, entries: 2650, prizePool: 2385000), TD(date: "21/06/2019", name: "Super Seniors No-Limit Hold'em", number: 39, buyin: 1000, entries: 2650, prizePool: 2385000),
// TD(date: "20/06/2019", name: "WSOP.com ONLINE No-Limit Hold'em Turbo Deepstack", number: 46, buyin: 500, entries: 1181, prizePool: 795180), TD(date: "20/06/2019", name: "WSOP.com ONLINE No-Limit Hold'em Turbo Deepstack", number: 46, buyin: 500, entries: 1181, prizePool: 795180),
// TD(date: "21/06/2019", name: "Mixed No-Limit Hold'em / Pot-Limit Omaha Deepstack 8-Handed", number: 42, buyin: 600, entries: 2403, prizePool: 1261575), TD(date: "21/06/2019", name: "Mixed No-Limit Hold'em / Pot-Limit Omaha Deepstack 8-Handed", number: 42, buyin: 600, entries: 2403, prizePool: 1261575),
// TD(date: "21/06/2019", name: "Mixed Big Bet", number: 43, buyin: 2500, entries: 218, prizePool: 490500), TD(date: "21/06/2019", name: "Mixed Big Bet", number: 43, buyin: 2500, entries: 218, prizePool: 490500),
// TD(date: "22/06/2019", name: "No-Limit Hold'em Bounty", number: 44, buyin: 1500, entries: 1807, prizePool: 2439450), TD(date: "22/06/2019", name: "No-Limit Hold'em Bounty", number: 44, buyin: 1500, entries: 1807, prizePool: 2439450),
// TD(date: "23/06/2019", name: "Pot-Limit Omaha High Roller", number: 45, buyin: 25000, entries: 278, prizePool: 6602500), TD(date: "23/06/2019", name: "Pot-Limit Omaha High Roller", number: 45, buyin: 25000, entries: 278, prizePool: 6602500),
// TD(date: "23/06/2019", name: "No-Limit Hold'em", number: 48, buyin: 2500, entries: 996, prizePool: 2241000), TD(date: "23/06/2019", name: "No-Limit Hold'em", number: 48, buyin: 2500, entries: 996, prizePool: 2241000),
// TD(date: "23/06/2019", name: "Limit 2-7 Lowball Triple Draw", number: 49, buyin: 10000, entries: 100, prizePool: 940000), TD(date: "23/06/2019", name: "Limit 2-7 Lowball Triple Draw", number: 49, buyin: 10000, entries: 100, prizePool: 940000),
// TD(date: "24/06/2019", name: "$1,000/$10,000 Ladies No-Limit Hold'em", number: 47, buyin: 10000, entries: 968, prizePool: 871200), TD(date: "24/06/2019", name: "$1,000/$10,000 Ladies No-Limit Hold'em", number: 47, buyin: 10000, entries: 968, prizePool: 871200),
// TD(date: "24/06/2019", name: "Mixed Omaha Hi/Lo 8 or Better, Seven Card Stud Hi/Lo 8 or Better", number: 51, buyin: 2500, entries: 401, prizePool: 902250), TD(date: "24/06/2019", name: "Mixed Omaha Hi/Lo 8 or Better, Seven Card Stud Hi/Lo 8 or Better", number: 51, buyin: 2500, entries: 401, prizePool: 902250),
// TD(date: "25/06/2019", name: "WSOP.com ONLINE No-Limit Hold'em Double Stack", number: 55, buyin: 1000, entries: 1333, prizePool: 1266350), TD(date: "25/06/2019", name: "WSOP.com ONLINE No-Limit Hold'em Double Stack", number: 55, buyin: 1000, entries: 1333, prizePool: 1266350),
// TD(date: "26/06/2019", name: "Pot-Limit Omaha 8-Handed", number: 52, buyin: 10000, entries: 518, prizePool: 4869200), TD(date: "26/06/2019", name: "Pot-Limit Omaha 8-Handed", number: 52, buyin: 10000, entries: 518, prizePool: 4869200),
// TD(date: "26/06/2019", name: "No-Limit Hold'em Deepstack 8-Handed", number: 53, buyin: 800, entries: 3759, prizePool: 2676408), TD(date: "26/06/2019", name: "No-Limit Hold'em Deepstack 8-Handed", number: 53, buyin: 800, entries: 3759, prizePool: 2676408),
// TD(date: "26/06/2019", name: "Razz", number: 54, buyin: 1500, entries: 363, prizePool: 490050), TD(date: "26/06/2019", name: "Razz", number: 54, buyin: 1500, entries: 363, prizePool: 490050),
// TD(date: "26/06/2019", name: "No-Limit Hold'em Super Turbo Bounty", number: 56, buyin: 1500, entries: 1867, prizePool: 2520450), TD(date: "26/06/2019", name: "No-Limit Hold'em Super Turbo Bounty", number: 56, buyin: 1500, entries: 1867, prizePool: 2520450),
// TD(date: "27/06/2019", name: "Monster Stack No-Limit Hold'em", number: 50, buyin: 1500, entries: 6035, prizePool: 8147250), TD(date: "27/06/2019", name: "Monster Stack No-Limit Hold'em", number: 50, buyin: 1500, entries: 6035, prizePool: 8147250),
// TD(date: "27/06/2019", name: "Tag Team No-Limit Hold'em", number: 57, buyin: 1000, entries: 976, prizePool: 878400), TD(date: "27/06/2019", name: "Tag Team No-Limit Hold'em", number: 57, buyin: 1000, entries: 976, prizePool: 878400),
// TD(date: "29/06/2019", name: "Poker Players Championship", number: 58, buyin: 50000, entries: 74, prizePool: 3552000), TD(date: "29/06/2019", name: "Poker Players Championship", number: 58, buyin: 50000, entries: 74, prizePool: 3552000),
// TD(date: "29/06/2019", name: "No-Limit Hold'em DEEPSTACK CHAMPIONSHIP", number: 59, buyin: 600, entries: 6140, prizePool: 3223500), TD(date: "29/06/2019", name: "No-Limit Hold'em DEEPSTACK CHAMPIONSHIP", number: 59, buyin: 600, entries: 6140, prizePool: 3223500),
// TD(date: "29/06/2019", name: "Pot-Limit Omaha Hi/Lo 8 or Better", number: 60, buyin: 1500, entries: 1117, prizePool: 1507950), TD(date: "29/06/2019", name: "Pot-Limit Omaha Hi/Lo 8 or Better", number: 60, buyin: 1500, entries: 1117, prizePool: 1507950),
// TD(date: "30/06/2019", name: "Razz", number: 62, buyin: 10000, entries: 116, prizePool: 1090400), TD(date: "30/06/2019", name: "Razz", number: 62, buyin: 10000, entries: 116, prizePool: 1090400),
// TD(date: "01/07/2019", name: "COLOSSUS", number: 61, buyin: 400, entries: 13109, prizePool: 4382515), TD(date: "01/07/2019", name: "COLOSSUS", number: 61, buyin: 400, entries: 13109, prizePool: 4382515),
// TD(date: "01/07/2019", name: "Omaha Mix", number: 63, buyin: 1500, entries: 717, prizePool: 967950), TD(date: "01/07/2019", name: "Omaha Mix", number: 63, buyin: 1500, entries: 717, prizePool: 967950),
// TD(date: "02/07/2019", name: "Pot-Limit Omaha Hi-Lo 8 or Better ", number: 65, buyin: 10000, entries: 193, prizePool: 1814200), TD(date: "02/07/2019", name: "Pot-Limit Omaha Hi-Lo 8 or Better ", number: 65, buyin: 10000, entries: 193, prizePool: 1814200),
// TD(date: "02/07/2019", name: "WSOP.com ONLINE No-Limit Hold'em Championship", number: 68, buyin: 1000, entries: 1750, prizePool: 1662500), TD(date: "02/07/2019", name: "WSOP.com ONLINE No-Limit Hold'em Championship", number: 68, buyin: 1000, entries: 1750, prizePool: 1662500),
// TD(date: "03/07/2019", name: "Seven Card Stud Hi-Lo 8 or Better", number: 67, buyin: 10000, entries: 151, prizePool: 1419400), TD(date: "03/07/2019", name: "Seven Card Stud Hi-Lo 8 or Better", number: 67, buyin: 10000, entries: 151, prizePool: 1419400),
// TD(date: "04/07/2019", name: "Crazy Eights No-Limit Hold'em", number: 64, buyin: 888, entries: 10185, prizePool: 8139852), TD(date: "04/07/2019", name: "Crazy Eights No-Limit Hold'em", number: 64, buyin: 888, entries: 10185, prizePool: 8139852),
// TD(date: "04/07/2019", name: "Limit Hold'em", number: 66, buyin: 1500, entries: 541, prizePool: 730350), TD(date: "04/07/2019", name: "Limit Hold'em", number: 66, buyin: 1500, entries: 541, prizePool: 730350),
// TD(date: "04/07/2019", name: "Mini Main Event", number: 69, buyin: 1000, entries: 5521, prizePool: 4968900), TD(date: "04/07/2019", name: "Mini Main Event", number: 69, buyin: 1000, entries: 5521, prizePool: 4968900),
// TD(date: "05/07/2019", name: "No-Limit Hold'em 6-Handed", number: 70, buyin: 5000, entries: 815, prizePool: 3789750), TD(date: "05/07/2019", name: "No-Limit Hold'em 6-Handed", number: 70, buyin: 5000, entries: 815, prizePool: 3789750),
// TD(date: "05/07/2019", name: "Limit Hold'em Championship", number: 72, buyin: 10000, entries: 118, prizePool: 1109200), TD(date: "05/07/2019", name: "Limit Hold'em Championship", number: 72, buyin: 10000, entries: 118, prizePool: 1109200),
// TD(date: "05/07/2019", name: "WSOP.com ONLINE No-Limit Hold'em High Roller", number: 74, buyin: 3200, entries: 593, prizePool: 1802720), TD(date: "05/07/2019", name: "WSOP.com ONLINE No-Limit Hold'em High Roller", number: 74, buyin: 3200, entries: 593, prizePool: 1802720),
// TD(date: "06/07/2019", name: "SALUTE TO WARRIORS - $500 No-Limit Hold'em", number: 71, buyin: 500, entries: 1723, prizePool: 723660), TD(date: "06/07/2019", name: "SALUTE TO WARRIORS - $500 No-Limit Hold'em", number: 71, buyin: 500, entries: 1723, prizePool: 723660),
// TD(date: "08/07/2019", name: "WSOP.com ONLINE No-Limit Hold'em 6-Handed", number: 76, buyin: 800, entries: 1560, prizePool: 1170000), TD(date: "08/07/2019", name: "WSOP.com ONLINE No-Limit Hold'em 6-Handed", number: 76, buyin: 800, entries: 1560, prizePool: 1170000),
// TD(date: "11/07/2019", name: "Final Fifty No-Limit Hold'em", number: 90, buyin: 50000, entries: 123, prizePool: 5904000), TD(date: "11/07/2019", name: "Final Fifty No-Limit Hold'em", number: 90, buyin: 50000, entries: 123, prizePool: 5904000),
// TD(date: "12/07/2019", name: "Limit Hold'em 6-Handed", number: 77, buyin: 3000, entries: 193, prizePool: 521100), TD(date: "12/07/2019", name: "Limit Hold'em 6-Handed", number: 77, buyin: 3000, entries: 193, prizePool: 521100),
// TD(date: "13/07/2019", name: "Pot-Limit Omaha Bounty", number: 78, buyin: 1500, entries: 1130 , prizePool: 1525500), TD(date: "13/07/2019", name: "Pot-Limit Omaha Bounty", number: 78, buyin: 1500, entries: 1130 , prizePool: 1525500),
// TD(date: "13/07/2019", name: "Little One for One Drop", number: 75, buyin: 1111, entries: 6248, prizePool: 5623200), TD(date: "13/07/2019", name: "Little One for One Drop", number: 75, buyin: 1111, entries: 6248, prizePool: 5623200),
// TD(date: "13/07/2019", name: "No-Limit Hold'em", number: 79, buyin: 3000, entries: 671, prizePool: 1811700), TD(date: "13/07/2019", name: "No-Limit Hold'em", number: 79, buyin: 3000, entries: 671, prizePool: 1811700),
// TD(date: "13/07/2019", name: "50th Annual Bracelet Winners Only No-Limit Hold'em", number: 81, buyin: 1500, entries: 185, prizePool: 277500), TD(date: "13/07/2019", name: "50th Annual Bracelet Winners Only No-Limit Hold'em", number: 81, buyin: 1500, entries: 185, prizePool: 277500),
// TD(date: "14/07/2019", name: "Mixed No-Limit Hold'em Pot-Limit Omaha", number: 80, buyin: 1500, entries: 1250, prizePool: 1687500), TD(date: "14/07/2019", name: "Mixed No-Limit Hold'em Pot-Limit Omaha", number: 80, buyin: 1500, entries: 1250, prizePool: 1687500),
// TD(date: "14/07/2019", name: "No-Limit Hold'em High Roller", number: 83, buyin: 100000, entries: 88, prizePool: 9603000), TD(date: "14/07/2019", name: "No-Limit Hold'em High Roller", number: 83, buyin: 100000, entries: 88, prizePool: 9603000),
// TD(date: "15/07/2019", name: "No-Limit Hold'em Double Stack", number: 82, buyin: 1500, entries: 2589, prizePool: 3495150), TD(date: "15/07/2019", name: "No-Limit Hold'em Double Stack", number: 82, buyin: 1500, entries: 2589, prizePool: 3495150),
// TD(date: "15/07/2019", name: "WSOP.com ONLINE No-Limit Hold'em Summer Saver", number: 88, buyin: 500, entries: 1859, prizePool: 836550), TD(date: "15/07/2019", name: "WSOP.com ONLINE No-Limit Hold'em Summer Saver", number: 88, buyin: 500, entries: 1859, prizePool: 836550),
// TD(date: "16/07/2019", name: "The Closer - No-Limit Hold'em", number: 84, buyin: 1500, entries: 2800, prizePool: 3780000), TD(date: "16/07/2019", name: "The Closer - No-Limit Hold'em", number: 84, buyin: 1500, entries: 2800, prizePool: 3780000),
// TD(date: "16/07/2019", name: "Pot-Limit Omaha 6-Handed", number: 85, buyin: 3000, entries: 835, prizePool: 2254500), TD(date: "16/07/2019", name: "Pot-Limit Omaha 6-Handed", number: 85, buyin: 3000, entries: 835, prizePool: 2254500),
// TD(date: "17/07/2019", name: "No-Limit Hold'em 6-Handed", number: 86, buyin: 10000, entries: 272, prizePool: 2556800), TD(date: "17/07/2019", name: "No-Limit Hold'em 6-Handed", number: 86, buyin: 10000, entries: 272, prizePool: 2556800),
// TD(date: "17/07/2019", name: "HORSE", number: 87, buyin: 3000, entries: 301, prizePool: 812700), TD(date: "17/07/2019", name: "HORSE", number: 87, buyin: 3000, entries: 301, prizePool: 812700),
// TD(date: "17/07/2019", name: "No-Limit Hold'em", number: 89, buyin: 5000, entries: 608, prizePool: 2827200), TD(date: "17/07/2019", name: "No-Limit Hold'em", number: 89, buyin: 5000, entries: 608, prizePool: 2827200),
// TD(date: "17/07/2019", name: "No-Limit Hold'em MAIN EVENT - World Championship", number: 73, buyin: 10000, entries: 8569, prizePool: 80548600), TD(date: "17/07/2019", name: "No-Limit Hold'em MAIN EVENT - World Championship", number: 73, buyin: 10000, entries: 8569, prizePool: 80548600),
] ]

@ -0,0 +1,19 @@
//
// Fonts.swift
// TournamentStats
//
// Created by Laurent Morvillier on 15/08/2019.
// Copyright © 2019 Stax River. All rights reserved.
//
import Foundation
import UIKit
class Fonts {
static let mainTitle: UIFont = UIFont.systemFont(ofSize: 64.0)
static let subTitle: UIFont = UIFont.systemFont(ofSize: 24.0)
static let pieChartEntries: UIFont = UIFont.boldSystemFont(ofSize: 28)
static let chartLegend: UIFont = UIFont.systemFont(ofSize: 18.0)
}

@ -9,30 +9,38 @@
import Foundation import Foundation
import UIKit import UIKit
class DataSourceWrapper<T : ColumnRepresentable> : NSObject, UITableViewDataSource, UITableViewDelegate { class DataSourceWrapper<T : ColumnRepresentable> : NSObject, UITableViewDataSource, UITableViewDelegate {
var columnRepresentables: [T] var columnRepresentables: [T]
let columnDescriptors = T.columnDescriptors() let columnDescriptors = T.columnDescriptors()
var totalWidthWeigth: CGFloat = 0.0 var totalWidthWeigth: CGFloat = 0.0
fileprivate var _maxRows: Int?
init(array: [T]) { init(array: [T], maxRows: Int? = nil) {
self.columnRepresentables = array self.columnRepresentables = array
self.totalWidthWeigth = self.columnDescriptors.map { $0.widthWeight }.reduce(0, +) self.totalWidthWeigth = self.columnDescriptors.map { $0.widthWeight }.reduce(0, +)
if let max = maxRows, max > columnRepresentables.count {
self._maxRows = nil
} else {
self._maxRows = maxRows
}
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
print("numberOfRowsInSection = \(self.columnRepresentables.count)") print("numberOfRowsInSection = \(self.columnRepresentables.count)")
return self.columnRepresentables.count + 1 // + 1 for header if let max = self._maxRows {
return 1 + max
} else {
return self.columnRepresentables.count + 1 // + 1 for header
}
} }
fileprivate let FONTSIZE: CGFloat = 18.0 fileprivate let FONTSIZE: CGFloat = 18.0
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// let cell = tableView.dequeueReusableCell(withIdentifier: "Cell") as! StackTableCell // let cell = tableView.dequeueReusableCell(withIdentifier: "Cell") as! StackTableCell
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell")! let cell = UITableViewCell()
cell.backgroundColor = UIColor.clear
var cells: [String] var cells: [String]
switch indexPath.row { switch indexPath.row {
@ -52,24 +60,33 @@ class DataSourceWrapper<T : ColumnRepresentable> : NSObject, UITableViewDataSour
font = self.columnDescriptors[index].number ? UIFont.monospacedDigitSystemFont(ofSize: FONTSIZE, weight: UIFont.Weight.regular) : UIFont.systemFont(ofSize: FONTSIZE) font = self.columnDescriptors[index].number ? UIFont.monospacedDigitSystemFont(ofSize: FONTSIZE, weight: UIFont.Weight.regular) : UIFont.systemFont(ofSize: FONTSIZE)
} }
let label: UILabel = UILabel(frame: CGRect(x: 0, y: 0, width: 50, height: 30)) let labelContainer: UIView = UIView()
cell.contentView.addSubview(labelContainer)
labelContainer.translatesAutoresizingMaskIntoConstraints = false
labelContainer.topAnchor.constraint(equalTo: cell.contentView.topAnchor).isActive = true
labelContainer.bottomAnchor.constraint(equalTo: cell.contentView.bottomAnchor).isActive = true
let leftPadding: CGFloat = (index == 0) ? 0.0 : 0.0 //16.0
labelContainer.leftAnchor.constraint(equalTo: leftAnchor, constant: leftPadding).isActive = true
leftAnchor = labelContainer.rightAnchor
labelContainer.backgroundColor = index.isMultiple(of: 2) ? UIColor.clear : UIColor(white: 0.9, alpha: 0.1)
let multiplier: CGFloat = self.columnDescriptors[index].widthWeight / self.totalWidthWeigth
labelContainer.widthAnchor.constraint(equalTo: cell.contentView.widthAnchor, multiplier: multiplier).isActive = true
let label: UILabel = UILabel(frame: CGRect.zero)
label.textColor = UIColor.white label.textColor = UIColor.white
label.backgroundColor = UIColor.clear label.backgroundColor = UIColor.clear
label.text = value label.text = value
label.font = font label.font = font
label.textAlignment = self.columnDescriptors[index].number ? .right : .left label.textAlignment = self.columnDescriptors[index].number ? .right : .left
labelContainer.addSubview(label)
cell.contentView.addSubview(label)
label.translatesAutoresizingMaskIntoConstraints = false label.translatesAutoresizingMaskIntoConstraints = false
label.topAnchor.constraint(equalTo: cell.contentView.topAnchor).isActive = true label.topAnchor.constraint(equalTo: labelContainer.topAnchor).isActive = true
label.bottomAnchor.constraint(equalTo: cell.contentView.bottomAnchor).isActive = true label.bottomAnchor.constraint(equalTo: labelContainer.bottomAnchor).isActive = true
label.leftAnchor.constraint(equalTo: leftAnchor).isActive = true label.leftAnchor.constraint(equalTo: labelContainer.leftAnchor, constant: 8.0).isActive = true
leftAnchor = label.rightAnchor label.rightAnchor.constraint(equalTo: labelContainer.rightAnchor, constant: -8.0).isActive = true
label.backgroundColor = index.isMultiple(of: 2) ? UIColor.clear : UIColor(white: 0.9, alpha: 0.1)
let multiplier: CGFloat = self.columnDescriptors[index].widthWeight / self.totalWidthWeigth
label.widthAnchor.constraint(equalTo: cell.contentView.widthAnchor, multiplier: multiplier).isActive = true
} }
return cell return cell

@ -0,0 +1,24 @@
//
// File.swift
// TournamentStats
//
// Created by Laurent Morvillier on 15/08/2019.
// Copyright © 2019 Stax River. All rights reserved.
//
import Foundation
import UIKit
class Label: UILabel {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self._initialize()
}
fileprivate func _initialize() {
self.textColor = UIColor.white
self.font = Fonts.subTitle
}
}

@ -19,10 +19,9 @@ class PieChart : PieChartView {
self.minOffset = 16.0 self.minOffset = 16.0
self.holeRadiusPercent = 0 self.holeRadiusPercent = 0
self.drawEntryLabelsEnabled = false self.drawEntryLabelsEnabled = false
// self.
self.legend.textColor = UIColor.white self.legend.textColor = UIColor.white
self.legend.font = UIFont.systemFont(ofSize: 16.0) self.legend.font = Fonts.chartLegend
self.legend.orientation = .vertical self.legend.orientation = .vertical
self.legend.form = .circle self.legend.form = .circle
// self.legend.neededHeight = 203.0 // self.legend.neededHeight = 203.0

@ -9,26 +9,34 @@
import Foundation import Foundation
import UIKit import UIKit
class TableView<T : ColumnRepresentable> : UITableView { class TableView : UITableView {
var wrapper: DataSourceWrapper<T> fileprivate var reference: AnyObject?
init(data: [T], frame: CGRect, style: UITableView.Style) { func setData<T : ColumnRepresentable>(data: [T], maxRows: Int? = 10) {
let wrapper = DataSourceWrapper(array: data, maxRows: maxRows)
self.wrapper = DataSourceWrapper(array: data) self.dataSource = wrapper
self.delegate = wrapper
self.reference = wrapper
}
override init(frame: CGRect, style: UITableView.Style) {
super.init(frame: frame, style: style) super.init(frame: frame, style: style)
self._initialize()
}
self.register(UINib(nibName: "StackTableCell", bundle: Bundle.main), forCellReuseIdentifier: "Cell") required init?(coder aDecoder: NSCoder) {
self.backgroundColor = UIColor.clear super.init(coder: aDecoder)
self._initialize()
}
self.dataSource = self.wrapper fileprivate func _initialize() {
self.delegate = self.wrapper
} self.register(UINib(nibName: "StackTableCell", bundle: Bundle.main), forCellReuseIdentifier: "Cell")
self.backgroundColor = UIColor.clear
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
} }
} }

@ -2,21 +2,75 @@
// InfographyView.swift // InfographyView.swift
// TournamentStats // TournamentStats
// //
// Created by Laurent Morvillier on 05/08/2019. // Created by Laurent Morvillier on 15/08/2019.
// Copyright © 2019 Stax River. All rights reserved. // Copyright © 2019 Stax River. All rights reserved.
// //
import Foundation import Foundation
import UIKit import UIKit
import Charts
class InfographyViewController : UIViewController { class InfographyView: UIView {
var generator: ReportGenerator? var generator: ReportGenerator? {
didSet {
self._fillView()
}
}
@IBOutlet weak var infographyTitle: UILabel!
@IBOutlet weak var hStack1a: UIStackView!
@IBOutlet weak var label11: UILabel!
@IBOutlet weak var label12: UILabel!
@IBOutlet weak var label13: UILabel!
@IBOutlet weak var hStack1b: UIStackView!
@IBOutlet weak var tableView11: TableView!
@IBOutlet weak var tableView12: TableView!
@IBOutlet weak var tableView13: TableView!
@IBOutlet weak var hStack2a: UIStackView!
@IBOutlet weak var label21: UILabel!
@IBOutlet weak var label22: UILabel!
@IBOutlet weak var label23: UILabel!
@IBOutlet weak var hStack2b: UIStackView!
@IBOutlet weak var container21: UIView!
@IBOutlet weak var container22: UIView!
@IBOutlet weak var container23: UIView!
@IBOutlet weak var hStack3a: UIStackView!
@IBOutlet weak var label31: UILabel!
@IBOutlet weak var label32: UILabel!
@IBOutlet weak var label33: UILabel!
@IBOutlet weak var hStack3b: UIStackView!
@IBOutlet weak var tableView31: TableView!
@IBOutlet weak var tableView32: TableView!
@IBOutlet weak var tableView33: TableView!
@IBOutlet weak var hStack4a: UIStackView!
@IBOutlet weak var label41: UILabel!
@IBOutlet weak var label42: UILabel!
override func viewDidLayoutSubviews() { @IBOutlet weak var hStack4b: UIStackView!
@IBOutlet weak var container41: UIView!
@IBOutlet weak var container42: UIView!
super.viewDidLayoutSubviews() @IBOutlet weak var hStack5a: UIStackView!
@IBOutlet weak var label51: UILabel!
@IBOutlet weak var hStack5b: UIStackView!
@IBOutlet weak var tableView51: TableView!
override func awakeFromNib() {
super.awakeFromNib()
self._createBackground()
}
fileprivate func _createBackground() {
let gradient: CAGradientLayer = CAGradientLayer() let gradient: CAGradientLayer = CAGradientLayer()
@ -27,126 +81,77 @@ class InfographyViewController : UIViewController {
gradient.locations = [0.2 , 1.0] gradient.locations = [0.2 , 1.0]
gradient.startPoint = CGPoint(x: 0.0, y: 0.0) gradient.startPoint = CGPoint(x: 0.0, y: 0.0)
gradient.endPoint = CGPoint(x: 1.0, y: 1.0) gradient.endPoint = CGPoint(x: 1.0, y: 1.0)
gradient.frame = self.view.bounds gradient.frame = self.bounds
self.view.layer.insertSublayer(gradient, at: 0) self.layer.insertSublayer(gradient, at: 0)
} }
override func viewDidLoad() { fileprivate func _fillView() {
guard let generator = self.generator else { guard let generator = self.generator else {
return return
} }
let table1 = TableView(data: generator.biggestWinners, frame: CGRect.zero, style: .grouped) self.infographyTitle.text = "2019 WSOP"
table1.defineConstraints(width: 500, height: 500) self.infographyTitle.textColor = UIColor.white
self.infographyTitle.font = Fonts.mainTitle
/////
let table2 = TableView(data: generator.mostWins, frame: CGRect.zero, style: .grouped) self.label11.text = "Biggest Winners".uppercased()
table2.defineConstraints(width: 500, height: 500) self.label12.text = "Most Cashes".uppercased()
self.label13.text = "Best average cash (7+)".uppercased()
let hstack1: UIStackView = UIStackView(arrangedSubviews: [table1, table2]) self.tableView11.setData(data: generator.biggestWinners)
hstack1.defineConstraints(width: 1000, height: 300.0) self.tableView12.setData(data: generator.mostCashes)
hstack1.distribution = .equalSpacing self.tableView13.setData(data: generator.averageCash)
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]) self.label21.text = "Buy-in distribution".uppercased()
hstack2a.defineConstraints(width: 1000) self.label22.text = "First prizes distribution".uppercased()
hstack2a.distribution = .fillEqually self.label23.text = "Prizepool distribution".uppercased()
hstack2a.axis = .horizontal
hstack2a.alignment = .top
let buyinDistribPie = PieChart(frame: CGRect.zero) let pieChartFrame = CGRect(x: 0, y: 0, width: 500, height: 500)
let buyinDistribPie = PieChart(frame: pieChartFrame)
buyinDistribPie.data = generator.tournamentBuyinDistribution.pieChartData buyinDistribPie.data = generator.tournamentBuyinDistribution.pieChartData
buyinDistribPie.defineConstraints(height: 300) self.container21.addSubview(buyinDistribPie)
buyinDistribPie.notifyDataSetChanged()
let firstPrizeDistributionPie = PieChart(frame: CGRect.zero) let firstPrizeDistributionPie = PieChart(frame: pieChartFrame)
firstPrizeDistributionPie.data = generator.firstPrizeDistribution.pieChartData firstPrizeDistributionPie.data = generator.firstPrizeDistribution.pieChartData
firstPrizeDistributionPie.defineConstraints(height: 300) self.container22.addSubview(firstPrizeDistributionPie)
let prizepoolDistribPie = PieChart(frame: CGRect.zero) let prizepoolDistribPie = PieChart(frame: pieChartFrame)
prizepoolDistribPie.data = generator.tournamentPrizepoolDistribution.pieChartData prizepoolDistribPie.data = generator.tournamentPrizepoolDistribution.pieChartData
prizepoolDistribPie.defineConstraints(height: 400) self.container23.addSubview(prizepoolDistribPie)
let hstack2: UIStackView = UIStackView(arrangedSubviews: [buyinDistribPie, firstPrizeDistributionPie, prizepoolDistribPie]) /////
hstack2.defineConstraints(width: 1000, height: 350.0)
hstack2.distribution = .fillEqually self.label31.text = "Events by prizepool".uppercased()
hstack2.axis = .horizontal self.label32.text = "Events by entries".uppercased()
hstack2.alignment = .top
self.tableView31.setData(data: generator.tourniesByPrizepool)
let mainTitle = UILabel() self.tableView32.setData(data: generator.tourniesByEntries)
mainTitle.textColor = UIColor.white
mainTitle.font = UIFont.boldSystemFont(ofSize: 64.0) /////
mainTitle.textAlignment = .center
mainTitle.text = "2019 WSOP" self.label41.text = "USA vs World bracelets".uppercased()
self.label42.text = "Holdem vs exotic games".uppercased()
let vstack: UIStackView = UIStackView(arrangedSubviews: [mainTitle, hstack1, hstack2a, hstack2])
vstack.axis = .vertical let USABraceletsDistribPie = PieChart(frame: pieChartFrame)
vstack.distribution = .equalCentering USABraceletsDistribPie.data = generator.USAvsWorldWins.pieChartData
vstack.alignment = .center self.container41.addSubview(USABraceletsDistribPie)
vstack.spacing = 10.0
self.view.addSubview(vstack) let holdemDistributionPie = PieChart(frame: pieChartFrame)
holdemDistributionPie.data = generator.holdemTournamentsDistribution.pieChartData
vstack.translatesAutoresizingMaskIntoConstraints = false self.container42.addSubview(holdemDistributionPie)
vstack.leadingAnchor.constraint(equalTo: self.view.leadingAnchor, constant: 16.0).isActive = true
vstack.trailingAnchor.constraint(equalTo: self.view.trailingAnchor, constant: -16.0).isActive = true self.label51.text = "Average Event".uppercased()
vstack.topAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.topAnchor, constant: 16.0).isActive = true let ds = generator.averageEvent.first
self.tableView51.dataSource = ds
self.tableView51.delegate = ds
} }
} }
//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")
// }
//
//}

@ -0,0 +1,280 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="InfographyView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="1800" height="3500"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="w79-xx-Evx">
<rect key="frame" x="8" y="44" width="1784" height="2630"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2019 WSOP" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4Hu-Ou-nFd">
<rect key="frame" x="0.0" y="0.0" width="1784" height="100"/>
<constraints>
<constraint firstAttribute="height" constant="100" id="mMK-PI-eZm"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" translatesAutoresizingMaskIntoConstraints="NO" id="aDf-a7-TD5">
<rect key="frame" x="0.0" y="110" width="1784" height="50"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hf2-oh-1Oz" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="594.5" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="US0-bW-Fa3" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="594.5" y="0.0" width="595" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7a3-eu-I7F" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="1189.5" y="0.0" width="594.5" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="50" id="3re-Nx-rm3"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="ABP-ce-MDa">
<rect key="frame" x="0.0" y="170" width="1784" height="400"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="HbR-TC-HeD" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="584" height="400"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="AOY-yE-egI" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="600" y="0.0" width="584" height="400"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="D9l-DT-eiv" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="1200" y="0.0" width="584" height="400"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="400" id="LQg-JD-2Lr"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" translatesAutoresizingMaskIntoConstraints="NO" id="91U-hc-Oqn">
<rect key="frame" x="0.0" y="580" width="1784" height="40"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hcr-dr-rUz" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="594.5" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2yf-Z5-Tpy" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="594.5" y="0.0" width="595" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hcG-kJ-HS1" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="1189.5" y="0.0" width="594.5" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="40" id="RgL-e2-Q4s"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="4u9-3E-Qwu">
<rect key="frame" x="0.0" y="630" width="1784" height="500"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Zmk-PV-di2">
<rect key="frame" x="0.0" y="0.0" width="584" height="500"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iQu-2n-Y3T">
<rect key="frame" x="600" y="0.0" width="584" height="500"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="OZT-Lo-t7S">
<rect key="frame" x="1200" y="0.0" width="584" height="500"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="500" id="zmA-DP-mDx"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" translatesAutoresizingMaskIntoConstraints="NO" id="RgJ-XU-xav">
<rect key="frame" x="0.0" y="1140" width="1784" height="50"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zHz-52-q8s" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="892" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PFl-bw-SwB" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="892" y="0.0" width="892" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="50" id="0cN-fx-oRp"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="ucv-f0-P2r">
<rect key="frame" x="0.0" y="1200" width="1784" height="400"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="0h6-mp-rHD" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="884" height="400"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="WPJ-0S-klg" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="900" y="0.0" width="884" height="400"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="400" id="Qi4-FK-vXH"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" translatesAutoresizingMaskIntoConstraints="NO" id="WFa-d3-zcU">
<rect key="frame" x="0.0" y="1610" width="1784" height="40"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aSt-Fm-PHF" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="892" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wcd-nU-zRB" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="892" y="0.0" width="892" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="40" id="nBc-2w-1Ft"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="9WN-7G-oBN">
<rect key="frame" x="0.0" y="1660" width="1784" height="500"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YMb-PS-dFz">
<rect key="frame" x="0.0" y="0.0" width="884" height="500"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LJL-hy-odj">
<rect key="frame" x="900" y="0.0" width="884" height="500"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="500" id="TTR-HJ-gPu"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" translatesAutoresizingMaskIntoConstraints="NO" id="myS-g5-vsP">
<rect key="frame" x="0.0" y="2170" width="1784" height="50"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mDV-nN-W7V" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="892" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7xF-BM-RBb" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="892" y="0.0" width="892" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="50" id="d8p-7J-A5m"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="2iy-YX-agg">
<rect key="frame" x="0.0" y="2230" width="1784" height="400"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="vqG-Pt-IB2" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="884" height="400"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="bPn-x2-2H0" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="900" y="0.0" width="884" height="400"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="400" id="U4b-yO-LB0"/>
</constraints>
</stackView>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="w79-xx-Evx" secondAttribute="trailing" constant="8" id="4VD-EL-9RH"/>
<constraint firstItem="w79-xx-Evx" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="8" id="stc-gy-e36"/>
<constraint firstItem="w79-xx-Evx" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" id="usO-r7-R25"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
<connections>
<outlet property="container21" destination="Zmk-PV-di2" id="mv0-Sg-r5V"/>
<outlet property="container22" destination="iQu-2n-Y3T" id="Yhg-KD-vzU"/>
<outlet property="container23" destination="OZT-Lo-t7S" id="QcZ-kf-CTr"/>
<outlet property="container41" destination="YMb-PS-dFz" id="siA-pY-GZT"/>
<outlet property="container42" destination="LJL-hy-odj" id="7Bq-4v-uda"/>
<outlet property="hStack1a" destination="aDf-a7-TD5" id="8fs-h9-pfk"/>
<outlet property="hStack1b" destination="ABP-ce-MDa" id="44B-nQ-AOq"/>
<outlet property="hStack2a" destination="91U-hc-Oqn" id="5b4-H7-FU3"/>
<outlet property="hStack2b" destination="4u9-3E-Qwu" id="14V-Za-4Iz"/>
<outlet property="hStack3a" destination="RgJ-XU-xav" id="PLX-zh-AiD"/>
<outlet property="hStack3b" destination="ucv-f0-P2r" id="u9R-aG-IpP"/>
<outlet property="hStack4a" destination="WFa-d3-zcU" id="i8z-Cc-rbi"/>
<outlet property="hStack4b" destination="9WN-7G-oBN" id="eAg-zC-ojV"/>
<outlet property="hStack5a" destination="myS-g5-vsP" id="S4L-12-8qP"/>
<outlet property="hStack5b" destination="2iy-YX-agg" id="iqW-bN-4fc"/>
<outlet property="infographyTitle" destination="4Hu-Ou-nFd" id="0vL-nP-fjY"/>
<outlet property="label11" destination="Hf2-oh-1Oz" id="njE-6s-1Qr"/>
<outlet property="label12" destination="US0-bW-Fa3" id="XVf-Ak-Mi2"/>
<outlet property="label13" destination="7a3-eu-I7F" id="Zhy-aY-QPM"/>
<outlet property="label21" destination="Hcr-dr-rUz" id="Ggb-ck-2Y7"/>
<outlet property="label22" destination="2yf-Z5-Tpy" id="5yK-A5-sha"/>
<outlet property="label23" destination="hcG-kJ-HS1" id="iKw-Dy-B6C"/>
<outlet property="label31" destination="zHz-52-q8s" id="twI-GF-8Zj"/>
<outlet property="label32" destination="PFl-bw-SwB" id="OhY-3p-Bei"/>
<outlet property="label41" destination="aSt-Fm-PHF" id="43C-8N-8Xk"/>
<outlet property="label42" destination="wcd-nU-zRB" id="WAR-I1-Bej"/>
<outlet property="label51" destination="mDV-nN-W7V" id="QlS-da-9bL"/>
<outlet property="tableView11" destination="HbR-TC-HeD" id="P5k-OS-JgN"/>
<outlet property="tableView12" destination="AOY-yE-egI" id="XYu-ad-tdK"/>
<outlet property="tableView13" destination="D9l-DT-eiv" id="yUh-4y-qns"/>
<outlet property="tableView31" destination="0h6-mp-rHD" id="Huj-wS-RGv"/>
<outlet property="tableView32" destination="WPJ-0S-klg" id="PzI-hh-uer"/>
<outlet property="tableView51" destination="vqG-Pt-IB2" id="FrK-oS-xF8"/>
</connections>
<point key="canvasLocation" x="142" y="-180"/>
</view>
</objects>
</document>

@ -0,0 +1,192 @@
//
// 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")
// }
//
//}

@ -28,7 +28,7 @@ class Queries {
static func averageCash(realm: Realm) -> [CumulatedResults] { static func averageCash(realm: Realm) -> [CumulatedResults] {
let players = realm.objects(Player.self).filter(NSPredicate(format: "results.@count > 4")) let players = realm.objects(Player.self).filter(NSPredicate(format: "results.@count > 6"))
var crArray: [CumulatedResults] = [] var crArray: [CumulatedResults] = []
for player in players { for player in players {
@ -196,14 +196,17 @@ class Queries {
let tournaments: Results<Tournament> = realm.objects(Tournament.self) let tournaments: Results<Tournament> = realm.objects(Tournament.self)
let low = DistributionCounter(name: "Low (<$2,000)") let verylow = DistributionCounter(name: "Very Low (<$1,000)")
let low = DistributionCounter(name: "Low ($1,000 - $1,999)")
let medium = DistributionCounter(name: "Medium ($2,000 - $5,000)") let medium = DistributionCounter(name: "Medium ($2,000 - $5,000)")
let high = DistributionCounter(name: "High (> $5,000)") let high = DistributionCounter(name: "High (> $5,000)")
let counters: [DistributionCounter] = [low, medium, high] let counters: [DistributionCounter] = [verylow, low, medium, high]
tournaments.forEach { tournament in tournaments.forEach { tournament in
switch tournament.buyin { switch tournament.buyin {
case 0..<2000: case 0..<1000:
verylow.increment()
case 1000..<2000:
low.increment() low.increment()
case 2000...5000: case 2000...5000:
medium.increment() medium.increment()

@ -14,16 +14,20 @@ class ReportGenerator {
static private let winnersDirectoryName: String = "reports/winners" static private let winnersDirectoryName: String = "reports/winners"
func go() { func go(importData: Bool) {
let realm = try! Realm() if (importData) {
try! realm.write {
realm.deleteAll() let realm = try! Realm()
try! realm.write {
realm.deleteAll()
}
Seed.createTournaments()
RowImporter.start()
} }
Seed.createTournaments() self.generateReports()
RowImporter.start()
self.create()
self.writeHTML() self.writeHTML()
} }
@ -52,6 +56,7 @@ class ReportGenerator {
var tourniesByEntries: [TournamentRepresentable] = [] var tourniesByEntries: [TournamentRepresentable] = []
var tourniesByPrizepool: [TournamentRepresentable] = [] var tourniesByPrizepool: [TournamentRepresentable] = []
var winsByCountry: [CountryCounter] = [] var winsByCountry: [CountryCounter] = []
var USAvsWorldWins: [CountryCounter] = []
var cashesByCountry: [CountryCounter] = [] var cashesByCountry: [CountryCounter] = []
var averageEvent: [TournamentStats] = [] var averageEvent: [TournamentStats] = []
var notablesMostCashes: [CumulatedResults] = [] var notablesMostCashes: [CumulatedResults] = []
@ -61,7 +66,7 @@ class ReportGenerator {
var firstPrizeDistribution: [DistributionCounter] = [] var firstPrizeDistribution: [DistributionCounter] = []
var holdemTournamentsDistribution: [DistributionCounter] = [] var holdemTournamentsDistribution: [DistributionCounter] = []
func create() { func generateReports() {
self.createDirectories() self.createDirectories()
@ -74,6 +79,7 @@ class ReportGenerator {
self.tourniesByEntries = Queries.sortedEvents(realm: realm, fieldName: "entries", ascending: false) self.tourniesByEntries = Queries.sortedEvents(realm: realm, fieldName: "entries", ascending: false)
self.tourniesByPrizepool = Queries.sortedEvents(realm: realm, fieldName: "prizepool", ascending: false) self.tourniesByPrizepool = Queries.sortedEvents(realm: realm, fieldName: "prizepool", ascending: false)
self.winsByCountry = Queries.winsByCountry(realm: realm) self.winsByCountry = Queries.winsByCountry(realm: realm)
self.USAvsWorldWins = CountryCounter.aggregate(table: self.winsByCountry, param: "United States")
self.cashesByCountry = Queries.cashesByCountry(realm: realm) self.cashesByCountry = Queries.cashesByCountry(realm: realm)
self.averageEvent = Queries.averageEvent(realm: realm) self.averageEvent = Queries.averageEvent(realm: realm)
self.notablesMostCashes = Queries.mostCashes(realm: realm, notable: true) self.notablesMostCashes = Queries.mostCashes(realm: realm, notable: true)

@ -7,8 +7,23 @@
// //
import Foundation import Foundation
import Charts
class CountryCounter : HTMLRepresentable { final class CountryCounter : HTMLRepresentable, Aggregeable {
static func aggregate(table: [CountryCounter], param: String) -> [CountryCounter] {
if let indexOfParam = table.firstIndex(where: { $0.country == param }) {
let paramCounter = table[indexOfParam]
var copy = table
copy.remove(at: indexOfParam)
let count = copy.reduce(0) { $0 + $1.counter }
return [paramCounter, CountryCounter(country: "Others", counter: count)]
}
let count = table.reduce(0) { $0 + $1.counter }
return [CountryCounter(country: "All", counter: count)]
}
var country: String var country: String
var counter: Int var counter: Int
@ -41,6 +56,10 @@ class CountryCounter : HTMLRepresentable {
return strings return strings
} }
var pieChartDataEntry: PieChartDataEntry {
return PieChartDataEntry(value: Double(self.counter), label: self.country)
}
// static func htmlHeaders() -> String { // static func htmlHeaders() -> String {
// var strings: [String] = [] // var strings: [String] = []
// strings.append("Country") // strings.append("Country")

@ -38,8 +38,8 @@ class CumulatedResults : HTMLRepresentable, ColumnRepresentable {
static func columnDescriptors() -> [ColumnDescriptor] { static func columnDescriptors() -> [ColumnDescriptor] {
return [ColumnDescriptor(header: "Name", number: false, widthWeight: 2.0), return [ColumnDescriptor(header: "Name", number: false, widthWeight: 2.0),
ColumnDescriptor(header: "Total Earnings", number: true, widthWeight: 1.0), ColumnDescriptor(header: "Total Earnings", number: true, widthWeight: 1.2),
ColumnDescriptor(header: "Cashes", number: true, widthWeight: 1.0)] ColumnDescriptor(header: "Cashes", number: true, widthWeight: 0.8)]
} }
func cellValues() -> [String] { func cellValues() -> [String] {

@ -13,11 +13,11 @@ struct TournamentRepresentable : HTMLRepresentable {
var tournament: Tournament var tournament: Tournament
static func columnDescriptors() -> [ColumnDescriptor] { static func columnDescriptors() -> [ColumnDescriptor] {
return [ColumnDescriptor(header: "#", number: true, widthWeight: 0.2), return [ColumnDescriptor(header: "#", number: true, widthWeight: 0.3),
ColumnDescriptor(header: "Buy-in", number: true, widthWeight: 1.0), ColumnDescriptor(header: "Buy-in", number: true, widthWeight: 0.7),
ColumnDescriptor(header: "Event", number: false, widthWeight: 1.0), ColumnDescriptor(header: "Event", number: false, widthWeight: 2.6),
ColumnDescriptor(header: "Prizepool", number: true, widthWeight: 1.0), ColumnDescriptor(header: "Prizepool", number: true, widthWeight: 1.0),
ColumnDescriptor(header: "Entries", number: true, widthWeight: 1.0)] ColumnDescriptor(header: "Entries", number: true, widthWeight: 0.7)]
} }
func cellValues() -> [String] { func cellValues() -> [String] {

@ -7,31 +7,42 @@
// //
import Foundation import Foundation
import UIKit
struct TournamentStats : HTMLRepresentable { class TournamentStats : NSObject, HTMLRepresentable, UITableViewDelegate, UITableViewDataSource {
var entries: Double var entries: Double
var buyin: Double var buyin: Double
var prizepool: Double var prizepool: Double
var itmValue: Double var itmValue: Double
func cellValues() -> [String] { init(entries: Double, buyin: Double, prizepool: Double, itmValue: Double) {
return []
self.entries = entries
self.buyin = buyin
self.prizepool = prizepool
self.itmValue = itmValue
super.init()
} }
static func columnDescriptors() -> [ColumnDescriptor] { static func columnDescriptors() -> [ColumnDescriptor] {
return [] return []
} }
func cellValues() -> [String] {
return []
}
static func htmlHeaders() -> String { static func htmlHeaders() -> String {
return "" return ""
} }
func html() -> String { func html() -> String {
let formatter = NumberFormatter()
var strings: [(String, String)] = [] var strings: [(String, String)] = []
strings.append(("Entries", formatter.string(from: NSNumber(value: self.entries))!)) strings.append(("Entries", NumberFormatter().string(from: NSNumber(value: self.entries))!))
strings.append(("Buy-in", Formatter.currency.string(from: NSNumber(value: self.buyin))!)) strings.append(("Buy-in", Formatter.currency.string(from: NSNumber(value: self.buyin))!))
strings.append(("Prizepool", Formatter.currency.string(from: NSNumber(value: self.prizepool))!)) strings.append(("Prizepool", Formatter.currency.string(from: NSNumber(value: self.prizepool))!))
strings.append(("Earnings", Formatter.currency.string(from: NSNumber(value: self.itmValue))!)) strings.append(("Earnings", Formatter.currency.string(from: NSNumber(value: self.itmValue))!))
@ -47,4 +58,68 @@ struct TournamentStats : HTMLRepresentable {
return all return all
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 4
}
fileprivate let FONTSIZE: CGFloat = 18.0
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell()
cell.backgroundColor = UIColor.clear
var cells: (String, String)
switch indexPath.row {
case 0:
cells = ("Entries", NumberFormatter().string(from: NSNumber(value: self.entries))!)
case 1:
cells = ("Buy-in", Formatter.currency.string(from: NSNumber(value: self.buyin))!)
case 2:
cells = ("Prizepool", Formatter.currency.string(from: NSNumber(value: self.prizepool))!)
default:
cells = ("Earnings", Formatter.currency.string(from: NSNumber(value: self.itmValue))!)
}
var leftAnchor = cell.contentView.leftAnchor
for i in 0..<2 {
let labelContainer: UIView = UIView()
cell.contentView.addSubview(labelContainer)
labelContainer.translatesAutoresizingMaskIntoConstraints = false
labelContainer.topAnchor.constraint(equalTo: cell.contentView.topAnchor).isActive = true
labelContainer.bottomAnchor.constraint(equalTo: cell.contentView.bottomAnchor).isActive = true
let leftPadding: CGFloat = (i == 0) ? 0.0 : 0.0 //16.0
labelContainer.leftAnchor.constraint(equalTo: leftAnchor, constant: leftPadding).isActive = true
leftAnchor = labelContainer.rightAnchor
labelContainer.widthAnchor.constraint(equalTo: cell.contentView.widthAnchor, multiplier: 0.5).isActive = true
let label: UILabel = UILabel(frame: CGRect.zero)
label.textColor = UIColor.white
label.backgroundColor = UIColor.clear
label.text = (i == 0) ? cells.0 : cells.1
label.font = (i == 0) ? UIFont.boldSystemFont(ofSize: FONTSIZE) : UIFont.systemFont(ofSize: FONTSIZE)
label.textAlignment = (i == 1) ? .right : .left
labelContainer.addSubview(label)
label.translatesAutoresizingMaskIntoConstraints = false
label.topAnchor.constraint(equalTo: labelContainer.topAnchor).isActive = true
label.bottomAnchor.constraint(equalTo: labelContainer.bottomAnchor).isActive = true
label.leftAnchor.constraint(equalTo: labelContainer.leftAnchor, constant: 8.0).isActive = true
label.rightAnchor.constraint(equalTo: labelContainer.rightAnchor, constant: -8.0).isActive = true
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 36.0
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0.1
}
} }

@ -23,6 +23,8 @@ extension UIColor {
return UIColor(red: 255/255, green: 125/255, blue: 196/255, alpha: 1) return UIColor(red: 255/255, green: 125/255, blue: 196/255, alpha: 1)
} }
static let paColor3: UIColor = UIColor(red: 255/255, green: 155/255, blue: 50/255, alpha: 1)
} }
struct ColumnDescriptor { struct ColumnDescriptor {
@ -56,7 +58,12 @@ class PercentageFormatter : IValueFormatter {
} }
func stringForValue(_ value: Double, entry: ChartDataEntry, dataSetIndex: Int, viewPortHandler: ViewPortHandler?) -> String { func stringForValue(_ value: Double, entry: ChartDataEntry, dataSetIndex: Int, viewPortHandler: ViewPortHandler?) -> String {
return self.numberFormatter.string(from: NSNumber(value: value)) ?? ""
if let formatted = self.numberFormatter.string(from: NSNumber(value: value)) {
return formatted + "%"
} else {
return ""
}
} }
} }
@ -69,8 +76,9 @@ extension Array where Element : ColumnRepresentable {
dataEntries.append(representable.pieChartDataEntry) dataEntries.append(representable.pieChartDataEntry)
} }
let dataSet = PieChartDataSet(entries: dataEntries, label: "") let dataSet = PieChartDataSet(entries: dataEntries, label: "")
dataSet.entryLabelFont = UIFont.boldSystemFont(ofSize: 18.0) dataSet.entryLabelFont = Fonts.pieChartEntries
dataSet.colors = [UIColor.paGreen, UIColor.paColor1, UIColor.paColor2] dataSet.valueFont = Fonts.pieChartEntries
dataSet.colors = [UIColor.paGreen, UIColor.paColor1, UIColor.paColor2, UIColor.paColor3]
dataSet.valueFormatter = PercentageFormatter() dataSet.valueFormatter = PercentageFormatter()
return PieChartData(dataSet: dataSet) return PieChartData(dataSet: dataSet)
} }
@ -86,6 +94,18 @@ extension Array where Element : ColumnRepresentable {
} }
//extension Array where Element : Aggregeable {
//
// func aggregate(param: String) -> [Element] {
// return []
// }
//
//}
protocol Aggregeable {
static func aggregate(table: [Self], param: String) -> [Self]
}
protocol HTMLRepresentable : ColumnRepresentable { protocol HTMLRepresentable : ColumnRepresentable {
static func htmlHeaders() -> String static func htmlHeaders() -> String
func html() -> String func html() -> String

Loading…
Cancel
Save