Distribution Pie charts implemented
This commit is contained in:
parent
8576e956d6
commit
095e1a8fd1
@ -28,6 +28,8 @@
|
|||||||
E2218D5E1EF3DD6F004298F6 /* CollectionViewItemMonth.xib in Resources */ = {isa = PBXBuildFile; fileRef = E2218D5C1EF3DD6F004298F6 /* CollectionViewItemMonth.xib */; };
|
E2218D5E1EF3DD6F004298F6 /* CollectionViewItemMonth.xib in Resources */ = {isa = PBXBuildFile; fileRef = E2218D5C1EF3DD6F004298F6 /* CollectionViewItemMonth.xib */; };
|
||||||
E2218D601EF40E23004298F6 /* CollectionViewYear.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2218D5F1EF40E23004298F6 /* CollectionViewYear.swift */; };
|
E2218D601EF40E23004298F6 /* CollectionViewYear.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2218D5F1EF40E23004298F6 /* CollectionViewYear.swift */; };
|
||||||
E2218D621EF41415004298F6 /* CollectionViewMonth.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2218D611EF41415004298F6 /* CollectionViewMonth.swift */; };
|
E2218D621EF41415004298F6 /* CollectionViewMonth.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2218D611EF41415004298F6 /* CollectionViewMonth.swift */; };
|
||||||
|
E2218D641EF45F37004298F6 /* LossDistributionPie.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2218D631EF45F37004298F6 /* LossDistributionPie.swift */; };
|
||||||
|
E2218D671EF463B4004298F6 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2218D661EF463B4004298F6 /* QuartzCore.framework */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
@ -79,6 +81,8 @@
|
|||||||
E2218D5C1EF3DD6F004298F6 /* CollectionViewItemMonth.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CollectionViewItemMonth.xib; sourceTree = "<group>"; };
|
E2218D5C1EF3DD6F004298F6 /* CollectionViewItemMonth.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CollectionViewItemMonth.xib; sourceTree = "<group>"; };
|
||||||
E2218D5F1EF40E23004298F6 /* CollectionViewYear.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewYear.swift; sourceTree = "<group>"; };
|
E2218D5F1EF40E23004298F6 /* CollectionViewYear.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewYear.swift; sourceTree = "<group>"; };
|
||||||
E2218D611EF41415004298F6 /* CollectionViewMonth.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewMonth.swift; sourceTree = "<group>"; };
|
E2218D611EF41415004298F6 /* CollectionViewMonth.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewMonth.swift; sourceTree = "<group>"; };
|
||||||
|
E2218D631EF45F37004298F6 /* LossDistributionPie.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LossDistributionPie.swift; sourceTree = "<group>"; };
|
||||||
|
E2218D661EF463B4004298F6 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@ -93,6 +97,7 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
E2218D671EF463B4004298F6 /* QuartzCore.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -106,6 +111,7 @@
|
|||||||
E2218C991EF2D345004298F6 /* Logger4 */,
|
E2218C991EF2D345004298F6 /* Logger4 */,
|
||||||
E2218D2A1EF3271F004298F6 /* Graphic Analysis 2 */,
|
E2218D2A1EF3271F004298F6 /* Graphic Analysis 2 */,
|
||||||
E2218C831EF2D2B5004298F6 /* Products */,
|
E2218C831EF2D2B5004298F6 /* Products */,
|
||||||
|
E2218D651EF463B4004298F6 /* Frameworks */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
@ -277,16 +283,33 @@
|
|||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
E2218D501EF329D0004298F6 /* Views */ = {
|
E2218D501EF329D0004298F6 /* Views */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
E2218D681EF46ED3004298F6 /* Collection View */,
|
||||||
|
E2218D2F1EF3271F004298F6 /* Document.swift */,
|
||||||
|
E2218D511EF32AC6004298F6 /* GraphDetailsController.swift */,
|
||||||
|
E2218D631EF45F37004298F6 /* LossDistributionPie.swift */,
|
||||||
|
);
|
||||||
|
name = Views;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
E2218D651EF463B4004298F6 /* Frameworks */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
E2218D661EF463B4004298F6 /* QuartzCore.framework */,
|
||||||
|
);
|
||||||
|
name = Frameworks;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
E2218D681EF46ED3004298F6 /* Collection View */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
E2218D611EF41415004298F6 /* CollectionViewMonth.swift */,
|
E2218D611EF41415004298F6 /* CollectionViewMonth.swift */,
|
||||||
E2218D5F1EF40E23004298F6 /* CollectionViewYear.swift */,
|
E2218D5F1EF40E23004298F6 /* CollectionViewYear.swift */,
|
||||||
E2218D5B1EF3DD6F004298F6 /* CollectionViewItemMonth.swift */,
|
E2218D5B1EF3DD6F004298F6 /* CollectionViewItemMonth.swift */,
|
||||||
E2218D551EF335E6004298F6 /* CollectionViewItemYear.swift */,
|
E2218D551EF335E6004298F6 /* CollectionViewItemYear.swift */,
|
||||||
E2218D2F1EF3271F004298F6 /* Document.swift */,
|
|
||||||
E2218D511EF32AC6004298F6 /* GraphDetailsController.swift */,
|
|
||||||
);
|
);
|
||||||
name = Views;
|
name = "Collection View";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
@ -459,6 +482,7 @@
|
|||||||
E2218D2C1EF3271F004298F6 /* AppDelegate.swift in Sources */,
|
E2218D2C1EF3271F004298F6 /* AppDelegate.swift in Sources */,
|
||||||
E2218D621EF41415004298F6 /* CollectionViewMonth.swift in Sources */,
|
E2218D621EF41415004298F6 /* CollectionViewMonth.swift in Sources */,
|
||||||
E2218D601EF40E23004298F6 /* CollectionViewYear.swift in Sources */,
|
E2218D601EF40E23004298F6 /* CollectionViewYear.swift in Sources */,
|
||||||
|
E2218D641EF45F37004298F6 /* LossDistributionPie.swift in Sources */,
|
||||||
E2218D571EF335E6004298F6 /* CollectionViewItemYear.swift in Sources */,
|
E2218D571EF335E6004298F6 /* CollectionViewItemYear.swift in Sources */,
|
||||||
E2218D521EF32AC6004298F6 /* GraphDetailsController.swift in Sources */,
|
E2218D521EF32AC6004298F6 /* GraphDetailsController.swift in Sources */,
|
||||||
E2218D5D1EF3DD6F004298F6 /* CollectionViewItemMonth.swift in Sources */,
|
E2218D5D1EF3DD6F004298F6 /* CollectionViewItemMonth.swift in Sources */,
|
||||||
|
|||||||
@ -2,102 +2,4 @@
|
|||||||
<Bucket
|
<Bucket
|
||||||
type = "1"
|
type = "1"
|
||||||
version = "2.0">
|
version = "2.0">
|
||||||
<Breakpoints>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "Graphic Analysis 2/CollectionViewYear.swift"
|
|
||||||
timestampString = "519328313.206557"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "53"
|
|
||||||
endingLineNumber = "53"
|
|
||||||
landmarkName = "CollectionViewYear"
|
|
||||||
landmarkType = "4">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "Graphic Analysis 2/CollectionViewYear.swift"
|
|
||||||
timestampString = "519328313.206557"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "54"
|
|
||||||
endingLineNumber = "54"
|
|
||||||
landmarkName = "collectionView(_:didSelectItemsAt:)"
|
|
||||||
landmarkType = "7">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "Graphic Analysis 2/CollectionViewYear.swift"
|
|
||||||
timestampString = "519328313.206557"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "34"
|
|
||||||
endingLineNumber = "34"
|
|
||||||
landmarkName = "collectionView(_:itemForRepresentedObjectAt:)"
|
|
||||||
landmarkType = "7">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "Graphic Analysis 2/Document.swift"
|
|
||||||
timestampString = "519325692.813512"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "41"
|
|
||||||
endingLineNumber = "41"
|
|
||||||
landmarkName = "read(from:ofType:)"
|
|
||||||
landmarkType = "7">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "Graphic Analysis 2/Document.swift"
|
|
||||||
timestampString = "519325727.791633"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "46"
|
|
||||||
endingLineNumber = "46"
|
|
||||||
landmarkName = "read(from:ofType:)"
|
|
||||||
landmarkType = "7">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "Graphic Analysis 2/Document.swift"
|
|
||||||
timestampString = "519325744.014708"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "48"
|
|
||||||
endingLineNumber = "48"
|
|
||||||
landmarkName = "read(from:ofType:)"
|
|
||||||
landmarkType = "7">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
</Breakpoints>
|
|
||||||
</Bucket>
|
</Bucket>
|
||||||
|
|||||||
@ -12,6 +12,10 @@ class CollectionViewItemMonth: NSCollectionViewItem {
|
|||||||
|
|
||||||
@IBOutlet var day: NSTextField!
|
@IBOutlet var day: NSTextField!
|
||||||
@IBOutlet var loss: NSTextField!
|
@IBOutlet var loss: NSTextField!
|
||||||
|
@IBOutlet var distributionAM: LossDistributionPie!
|
||||||
|
@IBOutlet var distributionPM: LossDistributionPie!
|
||||||
|
|
||||||
|
var distribution: [String] = []
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
@ -21,4 +25,21 @@ class CollectionViewItemMonth: NSCollectionViewItem {
|
|||||||
view.layer?.borderWidth = 1.0
|
view.layer?.borderWidth = 1.0
|
||||||
view.layer?.borderColor = NSColor.clear.cgColor
|
view.layer?.borderColor = NSColor.clear.cgColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func redrawDistribution() {
|
||||||
|
var am: [Int] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
|
var pm: [Int] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
|
for entry in distribution {
|
||||||
|
let hour: Int = Int(entry.components(separatedBy: ":")[0])!
|
||||||
|
if hour < 12 {
|
||||||
|
am[hour] += 1
|
||||||
|
} else {
|
||||||
|
pm[hour - 12] += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
distributionAM.distribution = am
|
||||||
|
distributionPM.distribution = pm
|
||||||
|
distributionAM.needsDisplay = true
|
||||||
|
distributionPM.needsDisplay = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,10 @@
|
|||||||
<objects>
|
<objects>
|
||||||
<customObject id="-2" userLabel="File's Owner" customClass="CollectionViewItemMonth" customModule="Graphic_Analysis_2" customModuleProvider="target">
|
<customObject id="-2" userLabel="File's Owner" customClass="CollectionViewItemMonth" customModule="Graphic_Analysis_2" customModuleProvider="target">
|
||||||
<connections>
|
<connections>
|
||||||
|
<outlet property="day" destination="3aE-Wf-9eZ" id="T7k-f7-IBu"/>
|
||||||
|
<outlet property="distributionAM" destination="B0U-sm-QBD" id="jN5-fA-i8W"/>
|
||||||
|
<outlet property="distributionPM" destination="ftO-kx-Le5" id="Fjl-OH-3tS"/>
|
||||||
|
<outlet property="loss" destination="Ios-8D-sSB" id="RS0-0q-8Bt"/>
|
||||||
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
|
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
@ -18,25 +22,16 @@
|
|||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3aE-Wf-9eZ">
|
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3aE-Wf-9eZ">
|
||||||
<rect key="frame" x="18" y="92" width="24" height="20"/>
|
<rect key="frame" x="18" y="90" width="26" height="22"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="01" id="hZ1-E9-nbm">
|
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="01" id="hZ1-E9-nbm">
|
||||||
<font key="font" metaFont="system" size="16"/>
|
<font key="font" metaFont="system" size="17"/>
|
||||||
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
</textField>
|
</textField>
|
||||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bOH-fN-p3a">
|
|
||||||
<rect key="frame" x="18" y="67" width="36" height="17"/>
|
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
|
||||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Loss:" id="6Hu-ZO-t9e">
|
|
||||||
<font key="font" metaFont="system"/>
|
|
||||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
</textFieldCell>
|
|
||||||
</textField>
|
|
||||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ios-8D-sSB">
|
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ios-8D-sSB">
|
||||||
<rect key="frame" x="58" y="67" width="59" height="17"/>
|
<rect key="frame" x="58" y="65" width="59" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="axa-F2-XeS">
|
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="axa-F2-XeS">
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
@ -44,12 +39,31 @@
|
|||||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
</textField>
|
</textField>
|
||||||
|
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bOH-fN-p3a">
|
||||||
|
<rect key="frame" x="18" y="65" width="36" height="17"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
|
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Loss:" id="6Hu-ZO-t9e">
|
||||||
|
<font key="font" metaFont="system"/>
|
||||||
|
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
</textFieldCell>
|
||||||
|
</textField>
|
||||||
|
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="B0U-sm-QBD" customClass="LossDistributionPie" customModule="Graphic_Analysis_2" customModuleProvider="target">
|
||||||
|
<rect key="frame" x="20" y="20" width="37" height="37"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
|
</customView>
|
||||||
|
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ftO-kx-Le5" customClass="LossDistributionPie" customModule="Graphic_Analysis_2" customModuleProvider="target">
|
||||||
|
<rect key="frame" x="78" y="20" width="37" height="37"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
|
</customView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<point key="canvasLocation" x="138.5" y="169"/>
|
<point key="canvasLocation" x="138.5" y="169"/>
|
||||||
</customView>
|
</customView>
|
||||||
<collectionViewItem id="0ws-De-Ut2" customClass="CollectionViewItemMonth" customModule="Graphic_Analysis_2" customModuleProvider="target">
|
<collectionViewItem id="0ws-De-Ut2" customClass="CollectionViewItemMonth" customModule="Graphic_Analysis_2" customModuleProvider="target">
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="day" destination="3aE-Wf-9eZ" id="dB1-dQ-VPe"/>
|
<outlet property="day" destination="3aE-Wf-9eZ" id="dB1-dQ-VPe"/>
|
||||||
|
<outlet property="distributionAM" destination="B0U-sm-QBD" id="PYF-qG-EVI"/>
|
||||||
|
<outlet property="distributionPM" destination="ftO-kx-Le5" id="qra-Kr-uWo"/>
|
||||||
<outlet property="loss" destination="Ios-8D-sSB" id="Pkz-fU-9Hd"/>
|
<outlet property="loss" destination="Ios-8D-sSB" id="Pkz-fU-9Hd"/>
|
||||||
<outlet property="view" destination="Hz6-mo-xeY" id="pe3-pf-cYV"/>
|
<outlet property="view" destination="Hz6-mo-xeY" id="pe3-pf-cYV"/>
|
||||||
</connections>
|
</connections>
|
||||||
|
|||||||
@ -30,6 +30,8 @@ extension CollectionViewMonth: NSCollectionViewDataSource {
|
|||||||
func collectionView(_ itemForRepresentedObjectAtcollectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
|
func collectionView(_ itemForRepresentedObjectAtcollectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
|
||||||
let item = itemForRepresentedObjectAtcollectionView.makeItem(withIdentifier: "CollectionViewItemMonth", for: indexPath)
|
let item = itemForRepresentedObjectAtcollectionView.makeItem(withIdentifier: "CollectionViewItemMonth", for: indexPath)
|
||||||
guard let item2 = item as? CollectionViewItemMonth else { return item }
|
guard let item2 = item as? CollectionViewItemMonth else { return item }
|
||||||
|
item2.distribution = []
|
||||||
|
item2.redrawDistribution()
|
||||||
item2.loss.stringValue = ""
|
item2.loss.stringValue = ""
|
||||||
item2.day.textColor = NSColor.controlShadowColor
|
item2.day.textColor = NSColor.controlShadowColor
|
||||||
item2.day.stringValue = "\(indexPath.item + 1)"
|
item2.day.stringValue = "\(indexPath.item + 1)"
|
||||||
@ -37,8 +39,11 @@ extension CollectionViewMonth: NSCollectionViewDataSource {
|
|||||||
guard let day = days[month!][indexPath.item] else { return item2 }
|
guard let day = days[month!][indexPath.item] else { return item2 }
|
||||||
item2.day.textColor = NSColor.black
|
item2.day.textColor = NSColor.black
|
||||||
guard let log = day.fileWrappers?["KDLog.txt"] else { return item2 }
|
guard let log = day.fileWrappers?["KDLog.txt"] else { return item2 }
|
||||||
guard let loss = (String(data: log.regularFileContents!, encoding: .utf8)?.components(separatedBy: "\n").count) else { return item2 }
|
guard var logA = String(data: log.regularFileContents!, encoding: .utf8)?.components(separatedBy: "\n") else { return item2 }
|
||||||
item2.loss.stringValue = "\(loss)"
|
logA.removeLast()
|
||||||
|
item2.loss.stringValue = "\(logA.count)"
|
||||||
|
item2.distribution = logA
|
||||||
|
item2.redrawDistribution()
|
||||||
return item2
|
return item2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,7 @@
|
|||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>2.0</string>
|
<string>2.0</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>157</string>
|
<string>208</string>
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
<string>public.app-category.utilities</string>
|
<string>public.app-category.utilities</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
|||||||
39
Graphic Analysis 2/LossDistributionPie.swift
Normal file
39
Graphic Analysis 2/LossDistributionPie.swift
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
//
|
||||||
|
// LossDistributionPie.swift
|
||||||
|
// Graphic Analysis 2
|
||||||
|
//
|
||||||
|
// Created by Kilian Hofmann on 16.06.17.
|
||||||
|
// Copyright © 2017 Kilian Hofmann. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Cocoa
|
||||||
|
|
||||||
|
class LossDistributionPie: NSView {
|
||||||
|
|
||||||
|
var distribution: [Int] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
|
|
||||||
|
override func draw(_ dirtyRect: NSRect) {
|
||||||
|
super.draw(dirtyRect)
|
||||||
|
let center: CGPoint = CGPoint(x: 18.5, y: 18.5)
|
||||||
|
let startAngle: CGFloat = (1/2) * CGFloat.pi
|
||||||
|
let increment: CGFloat = CGFloat.pi / 6
|
||||||
|
|
||||||
|
for i in 0..<12 {
|
||||||
|
let layer: CAShapeLayer = CAShapeLayer()
|
||||||
|
layer.fillColor = CGColor(red: 1, green: 0, blue: 0, alpha: CGFloat(distribution[i]) / 60)
|
||||||
|
layer.strokeColor = NSColor.controlShadowColor.cgColor
|
||||||
|
layer.lineWidth = 0.5
|
||||||
|
layer.frame = dirtyRect
|
||||||
|
let arc: CGMutablePath = CGMutablePath()
|
||||||
|
arc.move(to: center)
|
||||||
|
arc.addArc(center: center, radius: 18, startAngle: startAngle - CGFloat(i)*increment, endAngle: startAngle - CGFloat(i+1)*increment, clockwise: true)
|
||||||
|
arc.closeSubpath()
|
||||||
|
layer.path = arc
|
||||||
|
if self.layer?.sublayers?.count == 12 {
|
||||||
|
self.layer?.replaceSublayer((self.layer?.sublayers?[i])!, with: layer)
|
||||||
|
} else{
|
||||||
|
self.layer?.addSublayer(layer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,2 +1,2 @@
|
|||||||
version 2.0
|
version 2.0
|
||||||
build 157
|
build 208
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user