Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9292655de8 |
@@ -1,22 +1,5 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
## [v3.0.13](https://github.com/Jawbone/JBChartView/tree/v3.0.13) (2017-02-08)
|
|
||||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v3.0.12...v3.0.13)
|
|
||||||
|
|
||||||
**Fixed bugs:**
|
|
||||||
|
|
||||||
- selectionColorForDotAtHorizontalIndex doesn't change color [\#221](https://github.com/Jawbone/JBChartView/issues/221)
|
|
||||||
- 内存泄露(leak!) [\#219](https://github.com/Jawbone/JBChartView/issues/219)
|
|
||||||
- wrong dot color with NAN after click graph [\#216](https://github.com/Jawbone/JBChartView/issues/216)
|
|
||||||
|
|
||||||
**Closed issues:**
|
|
||||||
|
|
||||||
- Amazing issue with width of JBLineChartView [\#220](https://github.com/Jawbone/JBChartView/issues/220)
|
|
||||||
- Bar chart doesn't paint inside selected UITableViewCell [\#214](https://github.com/Jawbone/JBChartView/issues/214)
|
|
||||||
- Does not conform with protocol [\#212](https://github.com/Jawbone/JBChartView/issues/212)
|
|
||||||
- \[question\] Does JBChartView support logarithmic scale? [\#211](https://github.com/Jawbone/JBChartView/issues/211)
|
|
||||||
- Fixed tool tip in Bar chart [\#210](https://github.com/Jawbone/JBChartView/issues/210)
|
|
||||||
|
|
||||||
## [v3.0.12](https://github.com/Jawbone/JBChartView/tree/v3.0.12) (2016-06-22)
|
## [v3.0.12](https://github.com/Jawbone/JBChartView/tree/v3.0.12) (2016-06-22)
|
||||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v3.0.11...v3.0.12)
|
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v3.0.11...v3.0.12)
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,15 @@ typedef NS_ENUM(NSInteger, JBChartViewState){
|
|||||||
@property (nonatomic, weak) id<JBChartViewDataSource> dataSource;
|
@property (nonatomic, weak) id<JBChartViewDataSource> dataSource;
|
||||||
@property (nonatomic, weak) id<JBChartViewDelegate> delegate;
|
@property (nonatomic, weak) id<JBChartViewDelegate> delegate;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Since loading is such a common UIView requirement,
|
||||||
|
* setting to YES will snapshot the chart, blur it, and display a loading indicator.
|
||||||
|
*/
|
||||||
|
@property (nonatomic, assign) BOOL loading;
|
||||||
|
|
||||||
|
- (void)setLoading:(BOOL)loading animated:(BOOL)animated callback:(void (^)())callback;
|
||||||
|
- (void)setLoading:(BOOL)loading animated:(BOOL)animated;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Header and footer views are shown above and below the chart respectively.
|
* Header and footer views are shown above and below the chart respectively.
|
||||||
* Each view will be stretched horizontally to fill width of chart.
|
* Each view will be stretched horizontally to fill width of chart.
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ static UIColor *kJBChartVerticalSelectionViewDefaultBgColor = nil;
|
|||||||
|
|
||||||
@interface JBChartView ()
|
@interface JBChartView ()
|
||||||
|
|
||||||
|
@property (nonatomic, strong) UIImageView *loadingImageView;
|
||||||
|
|
||||||
@property (nonatomic, assign) BOOL hasMaximumValue;
|
@property (nonatomic, assign) BOOL hasMaximumValue;
|
||||||
@property (nonatomic, assign) BOOL hasMinimumValue;
|
@property (nonatomic, assign) BOOL hasMinimumValue;
|
||||||
|
|
||||||
@@ -77,8 +79,111 @@ static UIColor *kJBChartVerticalSelectionViewDefaultBgColor = nil;
|
|||||||
NSAssert((self.headerView.bounds.size.height + self.footerView.bounds.size.height) <= self.bounds.size.height, @"JBChartView // the combined height of the footer and header can not be greater than the total height of the chart.");
|
NSAssert((self.headerView.bounds.size.height + self.footerView.bounds.size.height) <= self.bounds.size.height, @"JBChartView // the combined height of the footer and header can not be greater than the total height of the chart.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Getters
|
||||||
|
|
||||||
|
+ (UIImage *)imageWithView:(UIView *)view
|
||||||
|
{
|
||||||
|
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0);
|
||||||
|
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
|
||||||
|
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
||||||
|
UIGraphicsEndImageContext();
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Setters
|
#pragma mark - Setters
|
||||||
|
|
||||||
|
- (void)setLoading:(BOOL)loading animated:(BOOL)animated callback:(void (^)())callback
|
||||||
|
{
|
||||||
|
if (_loading == loading)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_loading = loading;
|
||||||
|
|
||||||
|
if (loading) // show
|
||||||
|
{
|
||||||
|
UIImage *snapshotImage = [JBChartView imageWithView:self];
|
||||||
|
self.loadingImageView = [[UIImageView alloc] initWithImage:snapshotImage];
|
||||||
|
self.loadingImageView.frame = self.bounds;
|
||||||
|
|
||||||
|
UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
|
||||||
|
UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:blur];
|
||||||
|
effectView.frame = self.loadingImageView.frame;
|
||||||
|
[self.loadingImageView addSubview:effectView];
|
||||||
|
|
||||||
|
UIActivityIndicatorView *activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
|
||||||
|
[activityIndicatorView startAnimating];
|
||||||
|
activityIndicatorView.frame = CGRectMake(ceil(self.loadingImageView.frame.size.width * 0.5) - ceil(activityIndicatorView.frame.size.width * 0.5), ceil(self.loadingImageView.frame.size.height * 0.5) - ceil(activityIndicatorView.frame.size.height * 0.5), activityIndicatorView.frame.size.width, activityIndicatorView.frame.size.height);
|
||||||
|
[self.loadingImageView addSubview:activityIndicatorView];
|
||||||
|
|
||||||
|
if (animated)
|
||||||
|
{
|
||||||
|
self.loadingImageView.alpha = 0.0;
|
||||||
|
[self addSubview:self.loadingImageView];
|
||||||
|
[UIView animateWithDuration:0.25 animations:^{
|
||||||
|
self.loadingImageView.alpha = 1.0;
|
||||||
|
} completion:^(BOOL finished) {
|
||||||
|
if (callback)
|
||||||
|
{
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[self addSubview:self.loadingImageView];
|
||||||
|
if (callback)
|
||||||
|
{
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // hide
|
||||||
|
{
|
||||||
|
if (self.loadingImageView != nil)
|
||||||
|
{
|
||||||
|
if (animated)
|
||||||
|
{
|
||||||
|
[UIView animateWithDuration:0.25 animations:^{
|
||||||
|
self.loadingImageView.alpha = 0.0;
|
||||||
|
} completion:^(BOOL finished) {
|
||||||
|
[self.loadingImageView removeFromSuperview];
|
||||||
|
if (callback)
|
||||||
|
{
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[self.loadingImageView removeFromSuperview];
|
||||||
|
if (callback)
|
||||||
|
{
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (callback)
|
||||||
|
{
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setLoading:(BOOL)loading animated:(BOOL)animated
|
||||||
|
{
|
||||||
|
[self setLoading:loading animated:animated callback:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setLoading:(BOOL)loading
|
||||||
|
{
|
||||||
|
[self setLoading:loading animated:NO];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setHeaderView:(UIView *)headerView
|
- (void)setHeaderView:(UIView *)headerView
|
||||||
{
|
{
|
||||||
if (_headerView)
|
if (_headerView)
|
||||||
|
|||||||
@@ -112,13 +112,12 @@ NSInteger const kJBLineChartDotsViewUnselectedLineIndex = -1;
|
|||||||
JBLineChartPoint *lineChartPoint = [sortedLineChartPoints objectAtIndex:horizontalIndex];
|
JBLineChartPoint *lineChartPoint = [sortedLineChartPoints objectAtIndex:horizontalIndex];
|
||||||
if(lineChartPoint.hidden)
|
if(lineChartPoint.hidden)
|
||||||
{
|
{
|
||||||
[mutableDotViews addObject:[NSNull null]];
|
continue;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UIView *dotView = [self dotViewForHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
UIView *dotView = [self dotViewForHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
||||||
dotView.center = CGPointMake(lineChartPoint.position.x, lineChartPoint.position.y);
|
dotView.center = CGPointMake(lineChartPoint.position.x, lineChartPoint.position.y);
|
||||||
[mutableDotViews addObject:dotView];
|
[mutableDotViews addObject:dotView];
|
||||||
[self addSubview:dotView];
|
[self addSubview:dotView];
|
||||||
}
|
}
|
||||||
[mutableDotViewsDict setObject:[NSArray arrayWithArray:mutableDotViews] forKey:[NSNumber numberWithInteger:lineIndex]];
|
[mutableDotViewsDict setObject:[NSArray arrayWithArray:mutableDotViews] forKey:[NSNumber numberWithInteger:lineIndex]];
|
||||||
@@ -159,42 +158,39 @@ NSInteger const kJBLineChartDotsViewUnselectedLineIndex = -1;
|
|||||||
if ([key isKindOfClass:[NSNumber class]])
|
if ([key isKindOfClass:[NSNumber class]])
|
||||||
{
|
{
|
||||||
NSInteger lineIndex = [((NSNumber *)key) intValue];
|
NSInteger lineIndex = [((NSNumber *)key) intValue];
|
||||||
|
|
||||||
if (![dotView isKindOfClass:[NSNull class]])
|
// Internal dot
|
||||||
{
|
if ([dotView isKindOfClass:[JBLineChartDotView class]])
|
||||||
// Internal dot
|
{
|
||||||
if ([dotView isKindOfClass:[JBLineChartDotView class]])
|
if (weakSelf.selectedLineIndex == lineIndex)
|
||||||
{
|
{
|
||||||
if (weakSelf.selectedLineIndex == lineIndex)
|
NSAssert([self.dataSource respondsToSelector:@selector(lineChartDotsView:selectedColorForDotAtHorizontalIndex:atLineIndex:)], @"JBLineChartDotsView // dataSource must implement - (UIColor *)lineChartDotsView:(JBLineChartDotsView *)lineChartDotsView selectedColorForDotAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex");
|
||||||
{
|
dotView.backgroundColor = [self.dataSource lineChartDotsView:self selectedColorForDotAtHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
||||||
NSAssert([self.dataSource respondsToSelector:@selector(lineChartDotsView:selectedColorForDotAtHorizontalIndex:atLineIndex:)], @"JBLineChartDotsView // dataSource must implement - (UIColor *)lineChartDotsView:(JBLineChartDotsView *)lineChartDotsView selectedColorForDotAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex");
|
}
|
||||||
dotView.backgroundColor = [self.dataSource lineChartDotsView:self selectedColorForDotAtHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
else
|
||||||
}
|
{
|
||||||
else
|
NSAssert([self.dataSource respondsToSelector:@selector(lineChartDotsView:colorForDotAtHorizontalIndex:atLineIndex:)], @"JBLineChartDotsView // dataSource must implement - (UIColor *)lineChartDotsView:(JBLineChartDotsView *)lineChartDotsView colorForDotAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex");
|
||||||
{
|
dotView.backgroundColor = [self.dataSource lineChartDotsView:self colorForDotAtHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
||||||
NSAssert([self.dataSource respondsToSelector:@selector(lineChartDotsView:colorForDotAtHorizontalIndex:atLineIndex:)], @"JBLineChartDotsView // dataSource must implement - (UIColor *)lineChartDotsView:(JBLineChartDotsView *)lineChartDotsView colorForDotAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex");
|
|
||||||
dotView.backgroundColor = [self.dataSource lineChartDotsView:self colorForDotAtHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
NSAssert([self.dataSource respondsToSelector:@selector(lineChartDotsView:dimmedSelectionDotOpacityAtLineIndex:)], @"JBLineChartLinesView // dataSource must implement - (CGFloat)lineChartDotsView:(JBLineChartLinesView *)lineChartLinesView dimmedSelectionDotOpacityAtLineIndex:(NSUInteger)lineIndex");
|
||||||
|
dotView.alpha = (weakSelf.selectedLineIndex == kJBLineChartDotsViewUnselectedLineIndex) ? 1.0f : [self.dataSource lineChartDotsView:self dimmedSelectionDotOpacityAtLineIndex:lineIndex];
|
||||||
NSAssert([self.dataSource respondsToSelector:@selector(lineChartDotsView:dimmedSelectionDotOpacityAtLineIndex:)], @"JBLineChartLinesView // dataSource must implement - (CGFloat)lineChartDotsView:(JBLineChartLinesView *)lineChartLinesView dimmedSelectionDotOpacityAtLineIndex:(NSUInteger)lineIndex");
|
}
|
||||||
dotView.alpha = (weakSelf.selectedLineIndex == kJBLineChartDotsViewUnselectedLineIndex) ? 1.0f : [self.dataSource lineChartDotsView:self dimmedSelectionDotOpacityAtLineIndex:lineIndex];
|
}
|
||||||
}
|
// Custom dot
|
||||||
}
|
else
|
||||||
// Custom dot
|
{
|
||||||
else
|
NSAssert([self.dataSource respondsToSelector:@selector(lineChartDotsView:shouldHideDotViewOnSelectionAtHorizontalIndex:atLineIndex:)], @"JBLineChartDotsView // dataSource must implement - (BOOL)lineChartDotsView:(JBLineChartDotsView *)lineChartDotsView shouldHideDotViewOnSelectionAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex");
|
||||||
{
|
BOOL hideDotView = [self.dataSource lineChartDotsView:self shouldHideDotViewOnSelectionAtHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
||||||
NSAssert([self.dataSource respondsToSelector:@selector(lineChartDotsView:shouldHideDotViewOnSelectionAtHorizontalIndex:atLineIndex:)], @"JBLineChartDotsView // dataSource must implement - (BOOL)lineChartDotsView:(JBLineChartDotsView *)lineChartDotsView shouldHideDotViewOnSelectionAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex");
|
if (weakSelf.selectedLineIndex == lineIndex)
|
||||||
BOOL hideDotView = [self.dataSource lineChartDotsView:self shouldHideDotViewOnSelectionAtHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
{
|
||||||
if (weakSelf.selectedLineIndex == lineIndex)
|
NSAssert([self.dataSource respondsToSelector:@selector(lineChartDotsView:dimmedSelectionDotOpacityAtLineIndex:)], @"JBLineChartLinesView // dataSource must implement - (CGFloat)lineChartDotsView:(JBLineChartLinesView *)lineChartLinesView dimmedSelectionDotOpacityAtLineIndex:(NSUInteger)lineIndex");
|
||||||
{
|
dotView.alpha = hideDotView ? [self.dataSource lineChartDotsView:self dimmedSelectionDotOpacityAtLineIndex:lineIndex] : 1.0f;
|
||||||
NSAssert([self.dataSource respondsToSelector:@selector(lineChartDotsView:dimmedSelectionDotOpacityAtLineIndex:)], @"JBLineChartLinesView // dataSource must implement - (CGFloat)lineChartDotsView:(JBLineChartLinesView *)lineChartLinesView dimmedSelectionDotOpacityAtLineIndex:(NSUInteger)lineIndex");
|
}
|
||||||
dotView.alpha = hideDotView ? [self.dataSource lineChartDotsView:self dimmedSelectionDotOpacityAtLineIndex:lineIndex] : 1.0f;
|
else
|
||||||
}
|
{
|
||||||
else
|
dotView.alpha = 1.0;
|
||||||
{
|
}
|
||||||
dotView.alpha = 1.0;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
horizontalIndex++;
|
horizontalIndex++;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = "JBChartView"
|
s.name = "JBChartView"
|
||||||
s.version = "3.0.13"
|
s.version = "3.0.12"
|
||||||
s.summary = "Jawbone's iOS-based charting library for both line and bar graphs."
|
s.summary = "Jawbone's iOS-based charting library for both line and bar graphs."
|
||||||
s.homepage = "https://github.com/Jawbone/JBChartView"
|
s.homepage = "https://github.com/Jawbone/JBChartView"
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
|
|||||||
s.author = { "Terry Worona" => "tworona@jawbone.com" }
|
s.author = { "Terry Worona" => "tworona@jawbone.com" }
|
||||||
s.source = {
|
s.source = {
|
||||||
:git => "https://github.com/Jawbone/JBChartView.git",
|
:git => "https://github.com/Jawbone/JBChartView.git",
|
||||||
:tag => "v3.0.13"
|
:tag => "v3.0.12"
|
||||||
}
|
}
|
||||||
|
|
||||||
s.platform = :ios, '6.0'
|
s.platform = :ios, '6.0'
|
||||||
|
|||||||
@@ -305,15 +305,7 @@ NSString * const kJBLineChartViewControllerNavButtonViewKey = @"view";
|
|||||||
|
|
||||||
- (void)chartToggleButtonPressed:(id)sender
|
- (void)chartToggleButtonPressed:(id)sender
|
||||||
{
|
{
|
||||||
UIView *buttonImageView = [self.navigationItem.rightBarButtonItem valueForKey:kJBLineChartViewControllerNavButtonViewKey];
|
[self.chartView setLoading:!self.chartView.loading animated:YES];
|
||||||
buttonImageView.userInteractionEnabled = NO;
|
|
||||||
|
|
||||||
CGAffineTransform transform = self.lineChartView.state == JBChartViewStateExpanded ? CGAffineTransformMakeRotation(M_PI) : CGAffineTransformMakeRotation(0);
|
|
||||||
buttonImageView.transform = transform;
|
|
||||||
|
|
||||||
[self.lineChartView setState:self.lineChartView.state == JBChartViewStateExpanded ? JBChartViewStateCollapsed : JBChartViewStateExpanded animated:YES callback:^{
|
|
||||||
buttonImageView.userInteractionEnabled = YES;
|
|
||||||
}];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Overrides
|
#pragma mark - Overrides
|
||||||
|
|||||||
Reference in New Issue
Block a user