Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b911dfa9e2 | |||
| 2335a371b6 | |||
| b41d7ad944 | |||
| 4ffb2e1e0c | |||
| 9ae2adb81c | |||
| 185782daab | |||
| 51acae13a1 | |||
| 03217243d9 | |||
| 072e45902d | |||
| 326037ce93 | |||
| f447549666 | |||
| eba1d39ba3 |
+48
-30
@@ -9,11 +9,11 @@
|
||||
#import "JBBarChartView.h"
|
||||
|
||||
// Numerics
|
||||
CGFloat const kJBBarChartViewBarBasePaddingMutliplier = 50.0f;
|
||||
CGFloat const kJBBarChartViewUndefinedMaxHeight = -1.0f;
|
||||
CGFloat const kJBBarChartViewStateAnimationDuration = 0.05f;
|
||||
CGFloat const kJBBarChartViewPopOffset = 10.0f; // used to offset bars for 'pop' animations
|
||||
NSInteger const kJBBarChartViewUndefinedBarIndex = -1;
|
||||
CGFloat static const kJBBarChartViewBarBasePaddingMutliplier = 50.0f;
|
||||
CGFloat static const kJBBarChartViewUndefinedMaxHeight = -1.0f;
|
||||
CGFloat static const kJBBarChartViewStateAnimationDuration = 0.05f;
|
||||
CGFloat static const kJBBarChartViewPopOffset = 10.0f; // used to offset bars for 'pop' animations
|
||||
NSInteger static const kJBBarChartViewUndefinedBarIndex = -1;
|
||||
|
||||
// Colors (JBChartView)
|
||||
static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
@@ -33,10 +33,12 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
- (CGFloat)maxHeight;
|
||||
- (CGFloat)minHeight;
|
||||
- (CGFloat)barWidth;
|
||||
- (CGFloat)popOffset;
|
||||
|
||||
// Touch helpers
|
||||
- (NSInteger)barViewIndexForPoint:(CGPoint)point;
|
||||
- (UIView *)barViewForForPoint:(CGPoint)point;
|
||||
- (void)touchesEndedOrCancelledWithTouches:(NSSet *)touches;
|
||||
|
||||
// Setters
|
||||
- (void)setSelectionViewVisible:(BOOL)selectionViewVisible animated:(BOOL)animated;
|
||||
@@ -60,7 +62,7 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
self = [super initWithFrame:frame];
|
||||
if (self)
|
||||
{
|
||||
self.clipsToBounds = YES;
|
||||
self.clipsToBounds = NO;
|
||||
_showsSelection = YES;
|
||||
_cachedMaxHeight = kJBBarChartViewUndefinedMaxHeight;
|
||||
}
|
||||
@@ -80,7 +82,7 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
{
|
||||
// reset cached max height
|
||||
self.cachedMaxHeight = kJBBarChartViewUndefinedMaxHeight;
|
||||
|
||||
|
||||
/*
|
||||
* The data collection holds all position information:
|
||||
* constructed via datasource and delegate functions
|
||||
@@ -115,7 +117,7 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
self.barPadding = (1/(float)totalBars) * kJBBarChartViewBarBasePaddingMutliplier;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Creates a new bar graph view using the previously calculated data model
|
||||
*/
|
||||
@@ -141,9 +143,10 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
{
|
||||
barView = [[UIView alloc] init];
|
||||
barView.backgroundColor = kJBBarChartViewDefaultBarColor;
|
||||
}
|
||||
}
|
||||
CGFloat height = [self normalizedHeightForRawHeight:[self.chartDataDictionary objectForKey:key]];
|
||||
barView.frame = CGRectMake(xOffset, self.bounds.size.height - height - self.footerView.frame.size.height + self.headerPadding, [self barWidth], height + kJBBarChartViewPopOffset - self.headerPadding);
|
||||
CGFloat extensionHeight = height > 0.0 ? kJBBarChartViewPopOffset : 0.0;
|
||||
barView.frame = CGRectMake(xOffset, self.bounds.size.height - height - self.footerView.frame.size.height + self.headerPadding, [self barWidth], height + extensionHeight - self.headerPadding);
|
||||
[mutableBarViews addObject:barView];
|
||||
|
||||
// Add new bar
|
||||
@@ -174,7 +177,7 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
self.selectionView = nil;
|
||||
}
|
||||
|
||||
self.selectionView = [[JBChartSelectionView alloc] initWithFrame:CGRectMake(0, 0, [self barWidth], self.bounds.size.height)];
|
||||
self.selectionView = [[JBChartSelectionView alloc] initWithFrame:CGRectMake(0, 0, [self barWidth], self.bounds.size.height - self.footerView.frame.size.height)];
|
||||
self.selectionView.alpha = 0.0;
|
||||
if ([self.dataSource respondsToSelector:@selector(selectionBarColorForBarChartView:)])
|
||||
{
|
||||
@@ -197,7 +200,7 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
createBars();
|
||||
createSelectionView();
|
||||
|
||||
// Position header and footer
|
||||
// Position header and footer
|
||||
self.headerView.frame = CGRectMake(self.bounds.origin.x, self.bounds.origin.y, self.bounds.size.width, self.headerView.frame.size.height);
|
||||
self.footerView.frame = CGRectMake(self.bounds.origin.x, self.bounds.size.height - self.footerView.frame.size.height, self.bounds.size.width, self.footerView.frame.size.height);
|
||||
}
|
||||
@@ -220,7 +223,7 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ceil(((value - minHeight) / (maxHeight - minHeight)) * [self availableHeight]);
|
||||
return ((value - minHeight) / (maxHeight - minHeight)) * [self availableHeight];
|
||||
}
|
||||
|
||||
- (CGFloat)maxHeight
|
||||
@@ -251,6 +254,11 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (CGFloat)popOffset
|
||||
{
|
||||
return self.bounds.size.height - self.footerView.frame.size.height;
|
||||
}
|
||||
|
||||
#pragma mark - Setters
|
||||
|
||||
- (void)setState:(JBChartViewState)state animated:(BOOL)animated callback:(void (^)())callback
|
||||
@@ -261,9 +269,9 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
|
||||
if (animated)
|
||||
{
|
||||
CGFloat popOffset = self.bounds.size.height - self.footerView.frame.size.height;
|
||||
CGFloat popOffset = [self popOffset];
|
||||
|
||||
NSInteger index = 0;
|
||||
NSUInteger index = 0;
|
||||
for (UIView *barView in self.barViews)
|
||||
{
|
||||
[UIView animateWithDuration:kJBBarChartViewStateAnimationDuration delay:(kJBBarChartViewStateAnimationDuration * 0.5) * index options:UIViewAnimationOptionBeginFromCurrentState animations:^{
|
||||
@@ -278,7 +286,7 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
{
|
||||
barView.frame = CGRectMake(barView.frame.origin.x, self.bounds.size.height, barView.frame.size.width, barView.frame.size.height);
|
||||
}
|
||||
} completion:^(BOOL finished) {
|
||||
} completion:^(BOOL lastBarFinished) {
|
||||
if (index == [self.barViews count] - 1)
|
||||
{
|
||||
if (callbackCopy)
|
||||
@@ -349,6 +357,23 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
return barView;
|
||||
}
|
||||
|
||||
- (void)touchesEndedOrCancelledWithTouches:(NSSet *)touches
|
||||
{
|
||||
if (!self.showsSelection || self.state == JBChartViewStateCollapsed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
[self setSelectionViewVisible:NO animated:YES];
|
||||
|
||||
UITouch *touch = [touches anyObject];
|
||||
CGPoint touchPoint = [touch locationInView:self];
|
||||
NSInteger index = [self barViewIndexForPoint:touchPoint];
|
||||
if ([self.delegate respondsToSelector:@selector(barChartView:didUnselectBarAtIndex:)])
|
||||
{
|
||||
[self.delegate barChartView:self didUnselectBarAtIndex:index];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Setters
|
||||
|
||||
- (void)setSelectionViewVisible:(BOOL)selectionViewVisible animated:(BOOL)animated
|
||||
@@ -358,7 +383,7 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
if (animated)
|
||||
{
|
||||
[UIView animateWithDuration:kJBChartViewDefaultAnimationDuration delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
|
||||
self.selectionView.alpha = _selectionViewVisible ? 1.0 : 0.0;
|
||||
self.selectionView.alpha = self.selectionViewVisible ? 1.0 : 0.0;
|
||||
} completion:nil];
|
||||
}
|
||||
else
|
||||
@@ -428,19 +453,12 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
|
||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
|
||||
{
|
||||
if (!self.showsSelection || self.state == JBChartViewStateCollapsed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
[self setSelectionViewVisible:NO animated:YES];
|
||||
|
||||
UITouch *touch = [touches anyObject];
|
||||
CGPoint touchPoint = [touch locationInView:self];
|
||||
NSInteger index = [self barViewIndexForPoint:touchPoint];
|
||||
if ([self.delegate respondsToSelector:@selector(barChartView:didUnselectBarAtIndex:)])
|
||||
{
|
||||
[self.delegate barChartView:self didUnselectBarAtIndex:index];
|
||||
}
|
||||
[self touchesEndedOrCancelledWithTouches:touches];
|
||||
}
|
||||
|
||||
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
|
||||
{
|
||||
[self touchesEndedOrCancelledWithTouches:touches];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "JBChartView"
|
||||
s.version = "1.1.2"
|
||||
s.version = "1.1.5"
|
||||
s.summary = "Jawbone's iOS-based charting library for both line and bar graphs."
|
||||
s.homepage = "https://github.com/Jawbone/JBChartView"
|
||||
|
||||
@@ -8,7 +8,7 @@ Pod::Spec.new do |s|
|
||||
s.author = { "Terry Worona" => "tworona@jawbone.com" }
|
||||
s.source = {
|
||||
:git => "https://github.com/Jawbone/JBChartView.git",
|
||||
:tag => "v1.1.2"
|
||||
:tag => "v1.1.5"
|
||||
}
|
||||
|
||||
s.platform = :ios, '7.0'
|
||||
|
||||
+51
-36
@@ -18,16 +18,16 @@ typedef NS_ENUM(NSInteger, JBLineChartLineViewState){
|
||||
};
|
||||
|
||||
// Numerics (JBLineChartLineView)
|
||||
CGFloat const kJBLineChartLineViewEdgePadding = 10.0;
|
||||
CGFloat const kJBLineChartLineViewStrokeWidth = 5.0;
|
||||
CGFloat const kJBLineChartLineViewMiterLimit = -5.0;
|
||||
CGFloat const kJBLineChartLineViewStateAnimationDuration = 0.25f;
|
||||
CGFloat static const kJBLineChartLineViewEdgePadding = 10.0;
|
||||
CGFloat static const kJBLineChartLineViewStrokeWidth = 5.0;
|
||||
CGFloat static const kJBLineChartLineViewMiterLimit = -5.0;
|
||||
CGFloat static const kJBLineChartLineViewStateAnimationDuration = 0.25f;
|
||||
|
||||
// Numerics (JBLineSelectionView)
|
||||
CGFloat const kJBLineSelectionViewWidth = 20.0f;
|
||||
CGFloat static const kJBLineSelectionViewWidth = 20.0f;
|
||||
|
||||
// Numerics (JBLineChartView)
|
||||
CGFloat const kJBLineChartViewUndefinedMaxHeight = -1.0f;
|
||||
CGFloat static const kJBLineChartViewUndefinedMaxHeight = -1.0f;
|
||||
|
||||
// Colors (JBLineChartView)
|
||||
static UIColor *kJBLineChartViewDefaultLineColor = nil;
|
||||
@@ -83,6 +83,7 @@ static UIColor *kJBLineChartViewDefaultLineColor = nil;
|
||||
|
||||
// Touch helpers
|
||||
- (NSInteger)indexForPoint:(CGPoint)point;
|
||||
- (void)touchesEndedOrCancelledWithTouches:(NSSet *)touches;
|
||||
|
||||
// Setters
|
||||
- (void)setSelectionViewVisible:(BOOL)selectionViewVisible animated:(BOOL)animated;
|
||||
@@ -106,7 +107,7 @@ static UIColor *kJBLineChartViewDefaultLineColor = nil;
|
||||
self = [super initWithFrame:frame];
|
||||
if (self)
|
||||
{
|
||||
self.clipsToBounds = NO;
|
||||
self.clipsToBounds = NO;
|
||||
_showsSelection = YES;
|
||||
_cachedMaxHeight = kJBLineChartViewUndefinedMaxHeight;
|
||||
}
|
||||
@@ -119,12 +120,12 @@ static UIColor *kJBLineChartViewDefaultLineColor = nil;
|
||||
{
|
||||
// reset cached max height
|
||||
self.cachedMaxHeight = kJBLineChartViewUndefinedMaxHeight;
|
||||
|
||||
|
||||
/*
|
||||
* Subview rectangle calculations
|
||||
*/
|
||||
CGRect mainViewRect = CGRectMake(self.bounds.origin.x, self.bounds.origin.y, self.bounds.size.width, [self availableHeight]);
|
||||
|
||||
|
||||
/*
|
||||
* The data collection holds all position and marker information:
|
||||
* constructed via datasource and delegate functions
|
||||
@@ -134,7 +135,7 @@ static UIColor *kJBLineChartViewDefaultLineColor = nil;
|
||||
CGFloat pointSpace = (self.bounds.size.width - (kJBLineChartLineViewEdgePadding * 2)) / ([self dataCount] - 1); // Space in between points
|
||||
CGFloat xOffset = kJBLineChartLineViewEdgePadding;
|
||||
CGFloat yOffset = 0;
|
||||
|
||||
|
||||
// Build up the data collection
|
||||
NSAssert([self.delegate respondsToSelector:@selector(lineChartView:heightForIndex:)], @"JBLineChartView // delegate must implement - (NSInteger)lineChartView:(JBLineChartView *)lineChartView heightForIndex:(NSInteger)index");
|
||||
NSMutableArray *mutableChartData = [NSMutableArray array];
|
||||
@@ -144,7 +145,7 @@ static UIColor *kJBLineChartViewDefaultLineColor = nil;
|
||||
CGFloat rawHeight = [self.delegate lineChartView:self heightForIndex:index];
|
||||
CGFloat normalizedHeight = [self normalizedHeightForRawHeight:rawHeight];
|
||||
yOffset = mainViewRect.size.height - normalizedHeight;
|
||||
|
||||
|
||||
chartPoint.position = CGPointMake(xOffset, yOffset);
|
||||
|
||||
[mutableChartData addObject:chartPoint];
|
||||
@@ -197,7 +198,7 @@ static UIColor *kJBLineChartViewDefaultLineColor = nil;
|
||||
|
||||
// Reload views
|
||||
[self.lineView reloadData];
|
||||
|
||||
|
||||
// Position header and footer
|
||||
self.headerView.frame = CGRectMake(self.bounds.origin.x, self.bounds.origin.y, self.bounds.size.width, self.headerView.frame.size.height);
|
||||
self.footerView.frame = CGRectMake(self.bounds.origin.x, self.bounds.size.height - self.footerView.frame.size.height, self.bounds.size.width, self.footerView.frame.size.height);
|
||||
@@ -215,7 +216,7 @@ static UIColor *kJBLineChartViewDefaultLineColor = nil;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ceil(((rawHeight - minHeight) / (maxHeight - minHeight)) * [self availableHeight]);
|
||||
return ((rawHeight - minHeight) / (maxHeight - minHeight)) * [self availableHeight];
|
||||
}
|
||||
|
||||
- (CGFloat)availableHeight
|
||||
@@ -225,16 +226,20 @@ static UIColor *kJBLineChartViewDefaultLineColor = nil;
|
||||
|
||||
- (CGFloat)maxHeight
|
||||
{
|
||||
NSAssert([self.delegate respondsToSelector:@selector(lineChartView:heightForIndex:)], @"JBLineChartView // delegate must implement - (NSInteger)lineChartView:(JBLineChartView *)lineChartView heightForIndex:(NSInteger)index");
|
||||
NSInteger maxHeight = 0;
|
||||
for (NSInteger index=0; index<[self dataCount]; index++)
|
||||
if (self.cachedMaxHeight == kJBLineChartViewUndefinedMaxHeight)
|
||||
{
|
||||
if (([self.delegate lineChartView:self heightForIndex:index]) > maxHeight)
|
||||
NSAssert([self.delegate respondsToSelector:@selector(lineChartView:heightForIndex:)], @"JBLineChartView // delegate must implement - (NSInteger)lineChartView:(JBLineChartView *)lineChartView heightForIndex:(NSInteger)index");
|
||||
CGFloat maxHeight = 0;
|
||||
for (NSInteger index=0; index<[self dataCount]; index++)
|
||||
{
|
||||
maxHeight = [self.delegate lineChartView:self heightForIndex:index];
|
||||
if (([self.delegate lineChartView:self heightForIndex:index]) > maxHeight)
|
||||
{
|
||||
maxHeight = [self.delegate lineChartView:self heightForIndex:index];
|
||||
}
|
||||
}
|
||||
self.cachedMaxHeight = maxHeight;
|
||||
}
|
||||
return maxHeight;
|
||||
return self.cachedMaxHeight;
|
||||
}
|
||||
|
||||
- (CGFloat)minHeight
|
||||
@@ -299,6 +304,24 @@ static UIColor *kJBLineChartViewDefaultLineColor = nil;
|
||||
return selectedIndex;
|
||||
}
|
||||
|
||||
- (void)touchesEndedOrCancelledWithTouches:(NSSet *)touches
|
||||
{
|
||||
if (!self.showsSelection || self.state == JBChartViewStateCollapsed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[self setSelectionViewVisible:NO animated:YES];
|
||||
|
||||
UITouch *touch = [touches anyObject];
|
||||
CGPoint touchPoint = [touch locationInView:self];
|
||||
NSInteger index = [self indexForPoint:touchPoint];
|
||||
if ([self.delegate respondsToSelector:@selector(lineChartView:didUnselectChartAtIndex:)])
|
||||
{
|
||||
[self.delegate lineChartView:self didUnselectChartAtIndex:index];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Setters
|
||||
|
||||
- (void)setSelectionViewVisible:(BOOL)selectionViewVisible animated:(BOOL)animated
|
||||
@@ -308,7 +331,7 @@ static UIColor *kJBLineChartViewDefaultLineColor = nil;
|
||||
if (animated)
|
||||
{
|
||||
[UIView animateWithDuration:kJBChartViewDefaultAnimationDuration delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
|
||||
self.selectionView.alpha = _selectionViewVisible ? 1.0 : 0.0;
|
||||
self.selectionView.alpha = self.selectionViewVisible ? 1.0 : 0.0;
|
||||
} completion:nil];
|
||||
}
|
||||
else
|
||||
@@ -366,20 +389,12 @@ static UIColor *kJBLineChartViewDefaultLineColor = nil;
|
||||
|
||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
|
||||
{
|
||||
if (!self.showsSelection || self.state == JBChartViewStateCollapsed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[self setSelectionViewVisible:NO animated:YES];
|
||||
|
||||
UITouch *touch = [touches anyObject];
|
||||
CGPoint touchPoint = [touch locationInView:self];
|
||||
NSInteger index = [self indexForPoint:touchPoint];
|
||||
if ([self.delegate respondsToSelector:@selector(lineChartView:didUnselectChartAtIndex:)])
|
||||
{
|
||||
[self.delegate lineChartView:self didUnselectChartAtIndex:index];
|
||||
}
|
||||
[self touchesEndedOrCancelledWithTouches:touches];
|
||||
}
|
||||
|
||||
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
|
||||
{
|
||||
[self touchesEndedOrCancelledWithTouches:touches];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -439,7 +454,7 @@ static UIColor *kJBLineChartViewDefaultLineColor = nil;
|
||||
}
|
||||
|
||||
NSAssert([self.delegate respondsToSelector:@selector(lineColorForLineChartLineView:)], @"JBLineChartLineView // delegate must implement - (UIColor *)lineColorForLineChartLineView:(JBLineChartLineView*)lineChartLineView");
|
||||
|
||||
|
||||
if (self.shapeLayer == nil)
|
||||
{
|
||||
self.shapeLayer = [CAShapeLayer layer];
|
||||
@@ -539,7 +554,7 @@ static UIColor *kJBLineChartViewDefaultLineColor = nil;
|
||||
- (void)fireCallback:(void (^)())callback
|
||||
{
|
||||
dispatch_block_t callbackCopy = [callback copy];
|
||||
|
||||
|
||||
if (callbackCopy != nil)
|
||||
{
|
||||
callbackCopy();
|
||||
|
||||
@@ -14,13 +14,14 @@
|
||||
#import "JBLineChartFooterView.h"
|
||||
#import "JBChartInformationView.h"
|
||||
|
||||
#define ARC4RANDOM_MAX 0x100000000
|
||||
|
||||
// Numerics
|
||||
CGFloat const kJBLineChartViewControllerChartHeight = 250.0f;
|
||||
CGFloat const kJBLineChartViewControllerChartHeaderHeight = 75.0f;
|
||||
CGFloat const kJBLineChartViewControllerChartHeaderPadding = 20.0f;
|
||||
CGFloat const kJBLineChartViewControllerChartFooterHeight = 20.0f;
|
||||
NSInteger const kJBLineChartViewControllerNumChartPoints = 27;
|
||||
NSInteger const kJBLineChartViewControllerMaxPointValue = 100; // max random value
|
||||
|
||||
// Strings
|
||||
NSString * const kJBLineChartViewControllerNavButtonViewKey = @"view";
|
||||
@@ -60,7 +61,7 @@ NSString * const kJBLineChartViewControllerNavButtonViewKey = @"view";
|
||||
NSMutableArray *mutableChartData = [NSMutableArray array];
|
||||
for (int i=0; i<kJBLineChartViewControllerNumChartPoints; i++)
|
||||
{
|
||||
[mutableChartData addObject:[NSNumber numberWithFloat:arc4random() % kJBLineChartViewControllerMaxPointValue]];
|
||||
[mutableChartData addObject:[NSNumber numberWithFloat:((double)arc4random() / ARC4RANDOM_MAX)]]; // random number between 0 and 1
|
||||
}
|
||||
_chartData = [NSArray arrayWithArray:mutableChartData];
|
||||
}
|
||||
@@ -135,7 +136,7 @@ NSString * const kJBLineChartViewControllerNavButtonViewKey = @"view";
|
||||
- (void)lineChartView:(JBLineChartView *)lineChartView didSelectChartAtIndex:(NSInteger)index
|
||||
{
|
||||
NSNumber *valueNumber = [self.chartData objectAtIndex:index];
|
||||
[self.informationView setValueText:[NSString stringWithFormat:@"%d", [valueNumber intValue]] unitText:kJBStringLabelMm];
|
||||
[self.informationView setValueText:[NSString stringWithFormat:@"%.2f", [valueNumber floatValue]] unitText:kJBStringLabelMm];
|
||||
[self.informationView setTitleText:[NSString stringWithFormat:@"%d", [kJBStringLabel1987 intValue] + (int)index]];
|
||||
[self.informationView setHidden:NO animated:YES];
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ Simply add the following line to your <code>Podfile</code>:
|
||||
Your Podfile should look something like:
|
||||
|
||||
platform :ios, '7.0'
|
||||
pod 'JBChartView', '~> 1.1.2'
|
||||
pod 'JBChartView', '~> 1.1.5'
|
||||
|
||||
### The Old School Way
|
||||
|
||||
@@ -52,7 +52,7 @@ Both JBChartView implementations have a similiar data source and delgate pattern
|
||||
|
||||
#### JBBarChartView
|
||||
|
||||
To initialze a <i>JBBarChartView</i>, you only need a few lines of code:
|
||||
To initialize a <i>JBBarChartView</i>, you only need a few lines of code:
|
||||
|
||||
JBBarChartView *barChartView = [[JBBarChartView alloc] init];
|
||||
barChartView.delegate = self;
|
||||
@@ -75,7 +75,7 @@ Secondly, you need to inform the delegate the height of each bar (automatically
|
||||
|
||||
#### JBLineChartView
|
||||
|
||||
Similiarily, to initialze a JBLineChartView, you only need a few lines of code:
|
||||
Similiarily, to initialize a JBLineChartView, you only need a few lines of code:
|
||||
|
||||
JBLineChartView *lineChartView = [[JBLineChartView alloc] init];
|
||||
lineChartView.delegate = self;
|
||||
@@ -176,4 +176,4 @@ A JBLineChartView visuaul overview can be found <a href="https://raw.github.com/
|
||||
|
||||
## License
|
||||
|
||||
Usage is provided under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License</a> (v2.0). See <a href="https://github.com/Jawbone/JBChartView/blob/master/LICENSE">LICENSE</a> for full details.
|
||||
Usage is provided under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License</a> (v2.0). See <a href="https://github.com/Jawbone/JBChartView/blob/master/LICENSE">LICENSE</a> for full details.
|
||||
|
||||
Reference in New Issue
Block a user