Skip to content

Commit

Permalink
Adding property to control dot diameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Shi committed Mar 17, 2014
1 parent d3af5f2 commit fff7c0b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Classes/BEMSimpleLineGraphView.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@
// Defaults to YES.
@property (nonatomic) BOOL shouldHideDots;

@property (nonatomic) CGFloat dotDiameter;



@end
Expand Down
5 changes: 3 additions & 2 deletions Classes/BEMSimpleLineGraphView.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ - (void)commonInit {
_enableTouchReport = NO;
_enableBezierCurve = NO;
_shouldHideDots = YES;
_dotDiameter = circleSize;

// Initialize the arrays
xAxisValues = [NSMutableArray array];
Expand Down Expand Up @@ -164,7 +165,7 @@ - (void)layoutSubviews {

- (void)drawGraph {
if (numberOfPoints <= 1) { // Exception if there is only one point.
BEMCircle *circleDot = [[BEMCircle alloc] initWithFrame:CGRectMake(0, 0, circleSize, circleSize)];
BEMCircle *circleDot = [[BEMCircle alloc] initWithFrame:CGRectMake(0, 0, self.dotDiameter, self.dotDiameter)];
circleDot.center = CGPointMake(self.frame.size.width/2, self.frame.size.height/2);
circleDot.alpha = 0.7;
[self addSubview:circleDot];
Expand Down Expand Up @@ -219,7 +220,7 @@ - (void)drawDots {
if (minValue == maxValue) positionOnYAxis = self.frame.size.height/2;
else positionOnYAxis = (self.frame.size.height - padding) - ((dotValue - minValue) / ((maxValue - minValue) / (self.frame.size.height - padding))) + 30;

BEMCircle *circleDot = [[BEMCircle alloc] initWithFrame:CGRectMake(0, 0, circleSize, circleSize)];
BEMCircle *circleDot = [[BEMCircle alloc] initWithFrame:CGRectMake(0, 0, self.dotDiameter, self.dotDiameter)];
circleDot.dotColor = self.colorDot;
circleDot.center = CGPointMake(positionOnXAxis, positionOnYAxis);
circleDot.tag = i+100;
Expand Down

0 comments on commit fff7c0b

Please sign in to comment.