diff --git a/Classes/BEMSimpleLineGraphView.m b/Classes/BEMSimpleLineGraphView.m index a0f02c2..da0a620 100644 --- a/Classes/BEMSimpleLineGraphView.m +++ b/Classes/BEMSimpleLineGraphView.m @@ -59,6 +59,9 @@ @interface BEMSimpleLineGraphView () { /// All of the X-Axis Labels NSMutableArray *xAxisLabels; + + /// Checking flag that createLayoutTouchReport method was called + BOOL isCreateLayoutTouchReport; } /// The vertical line which appears when the user drags across the graph @@ -196,6 +199,7 @@ - (void)commonInit { dataPoints = [NSMutableArray array]; xAxisLabels = [NSMutableArray array]; yAxisValues = [NSMutableArray array]; + isCreateLayoutTouchReport = NO; // Initialize BEM Objects _averageLine = [[BEMAverageLine alloc] init]; @@ -226,8 +230,15 @@ - (void)drawGraph { // Draw the graph [self drawEntireGraph]; - // Setup the touch report - [self layoutTouchReport]; + if (!isCreateLayoutTouchReport) { + // Setup the touch report views only one time + [self createLayoutTouchReport]; + isCreateLayoutTouchReport = YES; + } else { + // resize the touch report views + [self resizeLayoutTouchReport]; + } + // Let the delegate know that the graph finished updates if ([self.delegate respondsToSelector:@selector(lineGraphDidFinishLoading:)]) @@ -318,7 +329,7 @@ - (void)layoutNumberOfPoints { } } -- (void)layoutTouchReport { +- (void)createLayoutTouchReport { // If the touch report is enabled, set it up if (self.enableTouchReport == YES || self.enablePopUpReport == YES) { // Initialize the vertical gray line that appears where the user touches the graph. @@ -390,6 +401,21 @@ - (void)layoutTouchReport { } } +- (void) resizeLayoutTouchReport { + // If the touch report is enabled, resize views + if (self.enableTouchReport == YES || self.enablePopUpReport == YES) { + if (self.touchInputLine) { + self.touchInputLine.frame = CGRectMake(0, 0, self.widthTouchInputLine, self.frame.size.height); + } + if (self.panView) { + self.panView.frame = CGRectMake(10, 10, self.viewForBaselineLayout.frame.size.width, self.viewForBaselineLayout.frame.size.height); + } + if (self.popUpView) { + self.popUpView.frame = CGRectMake(0, 0, self.popUpLabel.frame.size.width + 10, self.popUpLabel.frame.size.height + 2); + } + } +} + #pragma mark - Drawing - (void)didFinishDrawingIncludingYAxis:(BOOL)yAxisFinishedDrawing { diff --git a/Sample Project/SimpleLineChart.xcodeproj/project.xcworkspace/xcshareddata/SimpleLineChart.xcscmblueprint b/Sample Project/SimpleLineChart.xcodeproj/project.xcworkspace/xcshareddata/SimpleLineChart.xcscmblueprint new file mode 100644 index 0000000..e0440a2 --- /dev/null +++ b/Sample Project/SimpleLineChart.xcodeproj/project.xcworkspace/xcshareddata/SimpleLineChart.xcscmblueprint @@ -0,0 +1,30 @@ +{ + "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "1CA8AD815677B6FB0DD135F65EC4576AE68426CF", + "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { + + }, + "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { + "1CA8AD815677B6FB0DD135F65EC4576AE68426CF" : 0, + "3A216D26EB93D9EB79DE1E013DBEF75CF4509620" : 0 + }, + "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "F1F15B84-6620-4046-8D91-529CC20CD7C2", + "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { + "1CA8AD815677B6FB0DD135F65EC4576AE68426CF" : "BEMSimpleLineGraph", + "3A216D26EB93D9EB79DE1E013DBEF75CF4509620" : "" + }, + "DVTSourceControlWorkspaceBlueprintNameKey" : "SimpleLineChart", + "DVTSourceControlWorkspaceBlueprintVersion" : 204, + "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "Sample Project\/SimpleLineChart.xcodeproj", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/Boris-Em\/BEMSimpleLineGraph.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "1CA8AD815677B6FB0DD135F65EC4576AE68426CF" + }, + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.dowjones.net\/DJMobile\/ios-thesituation.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "3A216D26EB93D9EB79DE1E013DBEF75CF4509620" + } + ] +} \ No newline at end of file