Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
604 changes: 604 additions & 0 deletions Pie Charts/Pie Charts.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "19DF208C-98F0-4412-AB2E-F991F5AE884C"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "3E218C75-0EC1-4E20-8AC1-D597EDCF1C0F"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Pie Charts/PieChartV2.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "33"
endingLineNumber = "33"
landmarkName = "path(in:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Pie Charts.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
29 changes: 29 additions & 0 deletions Pie Charts/Pie Charts/5sTimer.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Foundation

class TimerExample {
var timer: Timer?

init() {
startTimer()
}

func startTimer() {
timer = Timer.scheduledTimer(withTimeInterval: 5.0, repeats: false) { timer in
// This closure will be executed after 5 seconds
print("Timer fired after 5 seconds!")

// You can perform any action you want here

// Don't forget to invalidate the timer to release resources
timer.invalidate()
}
}

// Make sure to invalidate the timer when it's no longer needed
deinit {
timer?.invalidate()
}
}

// Create an instance of TimerExample
let example = TimerExample()
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "The_Weeknd_-_After_Hours.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions Pie Charts/Pie Charts/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "test.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions Pie Charts/Pie Charts/GenreCalc.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import SwiftUI

struct GenreDataMod: View {
var body: some View {
let data = [
Genre(name: "Pop", count: 6, color: Color(.green)),
Genre(name: "Rock", count: 2, color: Color(.yellow)),
Genre(name: "Indie", count: 3, color: Color(.orange)),
Genre(name: "Jazz", count: 4, color: Color(.red)),
Genre(name: "Hip-Hop", count: 5, color: Color(.purple)),
Genre(name: "R&B", count: 7, color: Color(.blue))
]
GenreCalc(data:data)
}
}
struct Genre {
var name: String
var count: Int
var color: Color
}

struct GenreCalc: View {
@State var data:Array<Genre>=[]

var body: some View {
ZStack{
Circle()
.foregroundColor(.white)
VStack(alignment: .leading) {
let data = data.sorted {
$0.count > $1.count
}

ForEach(data, id: \.name) { item in
HStack {
Image(systemName: "circle.fill")
.foregroundStyle(item.color)
Text("\(item.name)").bold()
.foregroundColor(.black)
Spacer()
Text("\(item.count)%")
}
}
}
.padding(.horizontal, 40)
}
.frame(width: 234, height: 234)
}
}
struct GenreCalc_Previews: PreviewProvider {
static var previews: some View {
GenreDataMod()
}
}
//#Preview {
// GenreDataMod()
//}
125 changes: 125 additions & 0 deletions Pie Charts/Pie Charts/PieChartBeta.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
////
//// PieChartBeta.swift
//// Pie Charts
////
//// Created by I3LT-040 on 6/9/23.
////
//
//import SwiftUI
//import Charts
//

//
//
//
//#Preview {
// PieChartBeta()
//}


import SwiftUI
import Charts



@available(macOS 14.0, *)

struct PlottableValue: Identifiable {
var id = UUID()
var name: String
var value: Double
var color: Color
}

struct PieChartExampleView: View {
let colors: [Color] = [.gray, .red, .orange, .yellow,
.green, .blue, .purple, .pink]


@State private var fgColor: Color = .gray
@State private var imageString: String = "CirclePicture"

@State private var counter:Int=0

let data = [
(name: "Pop", count: 70, color: Color(.green)),
(name: "Rock", count: 2, color: Color(.yellow)),
(name: "Indie", count: 3, color: Color(.orange)),
(name: "Jazz", count: 4, color: Color(.red)),
(name: "Hip-Hop", count: 5, color: Color(.purple)),
(name: "R&B", count: 7, color: Color(.blue)),
]
var body: some View {
VStack{
Text("Steve Jobs")
.font(
.title2
)
.bold()// FOR CHANGING NAME

ZStack{
Chart(data, id: \.name) { name, count, color in
SectorMark(angle: .value("Value", count),
innerRadius: .ratio(0.8),
angularInset: 1.5)
.cornerRadius(5)
.foregroundStyle(color)
}

// .foregroundStyle( // Gradient shading
// LinearGradient(
// colors: [ .orange,.yellow],
// startPoint: .leading,
// endPoint: .trailing
// )
// )
.frame(height: 300)

GenreDataMod()

Image(imageString) // Replace with your image asset name
.resizable()
.frame(width: 234, height: 234)
.clipShape(Circle())
.overlay(Circle().stroke(Color.white, lineWidth: 0))
.foregroundColor(fgColor)
.contentShape(Circle()) // Set the content shape to Circle
.onTapGesture(count: 1) {
// fgColor = colors.randomElement()!
if counter==0{
imageString = ""
counter+=1
}else{
imageString = "CirclePicture"
counter-=1

}



}
}
Spacer()
// Image(systemName: "pencil.circle.fill")
// .resizable()
// .frame(width: 200, height: 200)
// .foregroundColor(fgColor)
// .contentShape(Circle()) // Set the content shape to Circle
// .onTapGesture(count: 1) {
// fgColor = colors.randomElement()!
// }
}
}
}

@available(macOS 14.0, *)
#Preview {
PieChartExampleView()
}


struct ContentView_Previews: PreviewProvider {
static var previews: some View {
PieChartExampleView()
}
}
26 changes: 26 additions & 0 deletions Pie Charts/Pie Charts/PieChartContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// ContentView.swift
// Pie Charts
//
// Created by I3LT-040 on 6/9/23.
//

import SwiftUI


struct ContentView: View {

var body: some View {
ZStack {
Text("test")
}
}
}



//struct ContentView_Previews: PreviewProvider {
// static var previews: some View {
// ContentView()
// }
//}
Loading