Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Commit d445135

Browse files
committed
Minor fixes
- Changed the padding on the graph to make sure the line doesn't gets drawn outside the view. - Updated README.md. - Fixed Warning in the Sample Project by deleting duplicate files in Build Phases (README and License).
1 parent 6659f9d commit d445135

File tree

5 files changed

+4
-9
lines changed

5 files changed

+4
-9
lines changed

Classes/BEMSimpleLineGraphView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ - (void)drawDots {
216216

217217
positionOnXAxis = (self.frame.size.width/(numberOfPoints - 1))*i;
218218
if (minValue == maxValue) positionOnYAxis = self.frame.size.height/2;
219-
else positionOnYAxis = (self.frame.size.height - padding) - ((dotValue - minValue) / ((maxValue - minValue) / (self.frame.size.height - padding))) + 20;
219+
else positionOnYAxis = (self.frame.size.height - padding) - ((dotValue - minValue) / ((maxValue - minValue) / (self.frame.size.height - padding))) + 30;
220220

221221
BEMCircle *circleDot = [[BEMCircle alloc] initWithFrame:CGRectMake(0, 0, circleSize, circleSize)];
222222
circleDot.center = CGPointMake(positionOnXAxis, positionOnYAxis);

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ Informs how much empty space is needed between each displayed label. Returning 0
149149
The text to be displayed for each UILabel on the X-Axis at a given index. It should return as many strings as the number of points on the graph.
150150

151151
- (NSString *)lineGraph:(BEMSimpleLineGraphView *)graph labelOnXAxisForIndex:(NSInteger)index {
152-
return X;
152+
return ;
153153
}
154154

155155
**X-Axis Label Color**
@@ -200,7 +200,7 @@ BEMSimpleLineGraphs are split into three parts - the top, the bottom, and the li
200200
* Line. The `colorLine` and `alphaLine` properties control the color (UIColor) and alpha (float) of the line of the graph. The `widthLine` property controls the width of the line of graph (float that defaults to 1.0).
201201

202202
### Graph Snapshots
203-
On iOS 7.0 and above you can take a snapshot of the line graph view and get a UIImage representation of the snapshot. To do so, simply call the method below at anytime in the graph's lifecycle. Note that the snapshot is not of the completed graph, but of the graph in its current state (whether it is in mid-animation or not). You can use the `lineGraphDidFinishLoading:` delegate method (coming soon) to find out when the graph has finished rendering and animating.
203+
On iOS 7.0 and above you can take a snapshot of the line graph view and get a UIImage representation of the snapshot. To do so, simply call the method below at anytime in the graph's lifecycle. Note that the snapshot is not of the completed graph, but of the graph in its current state (whether it is in mid-animation or not). You can use the `lineGraphDidFinishLoading:` delegate method to find out when the graph has finished rendering and animating.
204204

205205
// Method Definition
206206
- (UIImage *)graphSnapshotImage;

Sample Project/SimpleLineChart.xcodeproj/project.pbxproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
99B15643187B412400B24591 /* StatsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 99B15642187B412400B24591 /* StatsViewController.m */; };
1111
99B3FA3A1877898B00539A7B /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 99B3FA381877898B00539A7B /* LICENSE */; };
1212
99B3FA3B1877898B00539A7B /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 99B3FA391877898B00539A7B /* README.md */; };
13-
C310075C18A60C0800F60845 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = C310075B18A60C0800F60845 /* LICENSE */; };
1413
C3B90A5E187D15F7003E407D /* BEMAnimations.m in Sources */ = {isa = PBXBuildFile; fileRef = C3B90A57187D15F7003E407D /* BEMAnimations.m */; };
1514
C3B90A5F187D15F7003E407D /* BEMCircle.m in Sources */ = {isa = PBXBuildFile; fileRef = C3B90A59187D15F7003E407D /* BEMCircle.m */; };
1615
C3B90A60187D15F7003E407D /* BEMLine.m in Sources */ = {isa = PBXBuildFile; fileRef = C3B90A5B187D15F7003E407D /* BEMLine.m */; };
@@ -21,7 +20,6 @@
2120
C3FD8163186DFD9A00FD8ED3 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C3FD8161186DFD9A00FD8ED3 /* InfoPlist.strings */; };
2221
C3FD8165186DFD9A00FD8ED3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C3FD8164186DFD9A00FD8ED3 /* main.m */; };
2322
C3FD8169186DFD9A00FD8ED3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C3FD8168186DFD9A00FD8ED3 /* AppDelegate.m */; };
24-
C3FD816C186DFD9A00FD8ED3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C3FD816A186DFD9A00FD8ED3 /* Main.storyboard */; };
2523
C3FD816F186DFD9A00FD8ED3 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C3FD816E186DFD9A00FD8ED3 /* ViewController.m */; };
2624
C3FD8171186DFD9A00FD8ED3 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3FD8170186DFD9A00FD8ED3 /* Images.xcassets */; };
2725
C3FD8178186DFD9A00FD8ED3 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3FD8177186DFD9A00FD8ED3 /* XCTest.framework */; };
@@ -46,7 +44,6 @@
4644
99B15642187B412400B24591 /* StatsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatsViewController.m; sourceTree = "<group>"; };
4745
99B3FA381877898B00539A7B /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
4846
99B3FA391877898B00539A7B /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README.md; path = ../README.md; sourceTree = "<group>"; };
49-
C310075B18A60C0800F60845 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
5047
C3B90A56187D15F7003E407D /* BEMAnimations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BEMAnimations.h; sourceTree = "<group>"; };
5148
C3B90A57187D15F7003E407D /* BEMAnimations.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BEMAnimations.m; sourceTree = "<group>"; };
5249
C3B90A58187D15F7003E407D /* BEMCircle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BEMCircle.h; sourceTree = "<group>"; };
@@ -274,8 +271,6 @@
274271
C3FD8171186DFD9A00FD8ED3 /* Images.xcassets in Resources */,
275272
99B3FA3B1877898B00539A7B /* README.md in Resources */,
276273
C3FD8163186DFD9A00FD8ED3 /* InfoPlist.strings in Resources */,
277-
C3FD816C186DFD9A00FD8ED3 /* Main.storyboard in Resources */,
278-
C310075C18A60C0800F60845 /* LICENSE in Resources */,
279274
);
280275
runOnlyForDeploymentPostprocessing = 0;
281276
};

Sample Project/SimpleLineChart/ViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ - (void)viewDidLoad {
3131
previousStepperValue = self.graphObjectIncrement.value;
3232
totalNumber = 0;
3333

34-
for (int i = 0; i < 11; i++) {
34+
for (int i = 0; i < 9; i++) {
3535
[self.ArrayOfValues addObject:[NSNumber numberWithInteger:(arc4random() % 70000)]]; // Random values for the graph
3636
[self.ArrayOfDates addObject:[NSString stringWithFormat:@"%@",[NSNumber numberWithInt:2000 + i]]]; // Dates for the X-Axis of the graph
3737

0 commit comments

Comments
 (0)