Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 112b72d35f | |||
| f436a12413 | |||
| 8f1159fda6 | |||
| 5468952b53 | |||
| af508bb50c | |||
| 988c8c9ab9 | |||
| 7944c03962 | |||
| e28a0113f8 | |||
| 40ae91de47 | |||
| 251b6e888f | |||
| c2558f9975 | |||
| 2d1450340b | |||
| 706dbc1859 | |||
| 6cce1ae272 | |||
| 0b603cde1f | |||
| eacc211dbd | |||
| 641fb7f5fa | |||
| 28a660c57f |
@@ -1,5 +1,76 @@
|
||||
# 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)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v3.0.11...v3.0.12)
|
||||
|
||||
## [v3.0.11](https://github.com/Jawbone/JBChartView/tree/v3.0.11) (2016-06-22)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v3.0.10...v3.0.11)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- barChartView:barViewAtIndex: not called when reloading bar chart animated [\#207](https://github.com/Jawbone/JBChartView/issues/207)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Not able to change the color of linechart with custom color [\#208](https://github.com/Jawbone/JBChartView/issues/208)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Handle NaN line slope in line chart selection code. [\#209](https://github.com/Jawbone/JBChartView/pull/209) ([loumoore](https://github.com/loumoore))
|
||||
|
||||
## [v3.0.10](https://github.com/Jawbone/JBChartView/tree/v3.0.10) (2016-05-31)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v3.0.9...v3.0.10)
|
||||
|
||||
## [v3.0.9](https://github.com/Jawbone/JBChartView/tree/v3.0.9) (2016-04-28)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v3.0.8...v3.0.9)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- ability to set line chart view padding [\#205](https://github.com/Jawbone/JBChartView/issues/205)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- old gradient fill shows if chart is scrolled offscreen [\#204](https://github.com/Jawbone/JBChartView/issues/204)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- example of using gradient for fills [\#202](https://github.com/Jawbone/JBChartView/issues/202)
|
||||
|
||||
## [v3.0.8](https://github.com/Jawbone/JBChartView/tree/v3.0.8) (2016-02-29)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v3.0.7...v3.0.8)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Cannot change bar colors after initial load [\#201](https://github.com/Jawbone/JBChartView/issues/201)
|
||||
|
||||
## [v3.0.7](https://github.com/Jawbone/JBChartView/tree/v3.0.7) (2016-02-26)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v3.0.6...v3.0.7)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Directions not set in UIViewController [\#199](https://github.com/Jawbone/JBChartView/issues/199)
|
||||
- Many Line Charts in Table View [\#198](https://github.com/Jawbone/JBChartView/issues/198)
|
||||
|
||||
## [v3.0.6](https://github.com/Jawbone/JBChartView/tree/v3.0.6) (2016-01-21)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v3.0.5...v3.0.6)
|
||||
|
||||
## [v3.0.5](https://github.com/Jawbone/JBChartView/tree/v3.0.5) (2016-01-20)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v3.0.4...v3.0.5)
|
||||
|
||||
|
||||
@@ -111,6 +111,10 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
|
||||
- (void)construct
|
||||
{
|
||||
_chartData = [NSArray array];
|
||||
_barViews = [NSArray array];
|
||||
_cachedBarViewHeights = [NSArray array];
|
||||
|
||||
_showsVerticalSelection = YES;
|
||||
_cachedMinHeight = kJBBarChartViewUndefinedCachedHeight;
|
||||
_cachedMaxHeight = kJBBarChartViewUndefinedCachedHeight;
|
||||
@@ -145,6 +149,28 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
* Final block to refresh state and turn off reloading bit
|
||||
*/
|
||||
dispatch_block_t completionBlock = ^{
|
||||
|
||||
if (animated)
|
||||
{
|
||||
[self.chartData enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger index, BOOL * _Nonnull stop) {
|
||||
// Grab old bar
|
||||
UIView *oldBarView = [self.barViews objectAtIndex:index];
|
||||
|
||||
// Update bar instance
|
||||
UIView *barView = [self createBarViewForIndex:index];
|
||||
barView.frame = oldBarView.frame;
|
||||
|
||||
// Swap subviews
|
||||
[oldBarView removeFromSuperview];
|
||||
[self insertBarView:barView];
|
||||
|
||||
// Update bar colection
|
||||
NSMutableArray *mutableBarViews = [NSMutableArray arrayWithArray:self.barViews];
|
||||
[mutableBarViews replaceObjectAtIndex:index withObject:barView];
|
||||
self.barViews = [NSArray arrayWithArray:mutableBarViews];
|
||||
}];
|
||||
}
|
||||
|
||||
self.reloading = NO;
|
||||
[self setState:self.state animated:NO force:YES callback:nil];
|
||||
};
|
||||
@@ -580,7 +606,7 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
|
||||
dispatch_block_t callbackCopy = [callback copy];
|
||||
|
||||
if ([self.barViews count] > 0)
|
||||
if ([self.barViews count] > 0 && [self.cachedBarViewHeights count] == [self.barViews count])
|
||||
{
|
||||
if (animated)
|
||||
{
|
||||
|
||||
@@ -330,7 +330,7 @@ typedef NS_ENUM(NSInteger, JBLineChartViewColorStyle) {
|
||||
/**
|
||||
* Returns the selection color of a line within the chart during touch events.
|
||||
* The property showsLineSelection must be YES for the color to apply.
|
||||
* As well, lineChartView:selectionColorStyleForLineAtLineIndex: must return JBLineChartViewColorStyleSolid (default).
|
||||
* As well, lineChartView:colorStyleForLineAtLineIndex: must return JBLineChartViewColorStyleSolid (default)
|
||||
*
|
||||
* Default: matches lineChartView:colorForLineAtLineIndex:.
|
||||
*
|
||||
@@ -344,7 +344,7 @@ typedef NS_ENUM(NSInteger, JBLineChartViewColorStyle) {
|
||||
/**
|
||||
* Returns the selection gradient layer of a line within the chart during touch events.
|
||||
* The property showsLineSelection must be YES for the color to apply.
|
||||
* As well, lineChartView:selectionColorStyleForLineAtLineIndex: must return JBLineChartViewColorStyleGradient.
|
||||
* As well, lineChartView:colorStyleForLineAtLineIndex: must return JBLineChartViewColorStyleGradient.
|
||||
*
|
||||
* Note: gradients do not support multiple alphas. The alpha of gradient's first color be used throughout.
|
||||
*
|
||||
@@ -360,7 +360,7 @@ typedef NS_ENUM(NSInteger, JBLineChartViewColorStyle) {
|
||||
/**
|
||||
* Returns the selection fill color under a line within the chart during touch events.
|
||||
* The property showsLineSelection must be YES for the color to apply.
|
||||
* As well, lineChartView:selectionFillColorStyleForLineAtLineIndex: must return JBLineChartViewColorStyleSolid (default).
|
||||
* As well, lineChartView:fillColorStyleForLineAtLineIndex: must return JBLineChartViewColorStyleSolid (default).
|
||||
*
|
||||
* Default: matches lineChartView:fillColorForLineAtLineIndex:.
|
||||
*
|
||||
@@ -374,7 +374,7 @@ typedef NS_ENUM(NSInteger, JBLineChartViewColorStyle) {
|
||||
/**
|
||||
* Returns the selection fill gradient layer under a line within the chart during touch events.
|
||||
* The property showsLineSelection must be YES for the color to apply.
|
||||
* As well, lineChartView:selectionFillColorStyleForLineAtLineIndex: must return JBLineChartViewColorStyleGrdient.
|
||||
* As well, lineChartView:fillColorStyleForLineAtLineIndex: must return JBLineChartViewColorStyleGrdient.
|
||||
*
|
||||
* Note: gradients do not support multiple alphas. The alpha of gradient's first color be used throughout.
|
||||
*
|
||||
|
||||
@@ -1035,8 +1035,8 @@ static NSInteger const kJBLineChartUnselectedLineIndex = -1;
|
||||
// Touch point
|
||||
CGPoint normalizedTouchPoint = CGPointMake(point.x, self.linesView.bounds.size.height - point.y);
|
||||
|
||||
// Slope
|
||||
CGFloat lineSlope = (CGFloat)(rightPoint.y - leftPoint.y) / (CGFloat)(rightPoint.x - leftPoint.x);
|
||||
// Slope - set to zero if x coordinates are the same and would result in a NaN value
|
||||
CGFloat lineSlope = rightPoint.x != leftPoint.x ? (CGFloat)(rightPoint.y - leftPoint.y) / (CGFloat)(rightPoint.x - leftPoint.x) : 0.0f;
|
||||
|
||||
// Insersection point
|
||||
CGPoint interesectionPoint = CGPointMake(normalizedTouchPoint.x, (lineSlope * (normalizedTouchPoint.x - leftPoint.x)) + leftPoint.y);
|
||||
|
||||
@@ -112,12 +112,13 @@ NSInteger const kJBLineChartDotsViewUnselectedLineIndex = -1;
|
||||
JBLineChartPoint *lineChartPoint = [sortedLineChartPoints objectAtIndex:horizontalIndex];
|
||||
if(lineChartPoint.hidden)
|
||||
{
|
||||
continue;
|
||||
[mutableDotViews addObject:[NSNull null]];
|
||||
continue;
|
||||
}
|
||||
|
||||
UIView *dotView = [self dotViewForHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
||||
dotView.center = CGPointMake(lineChartPoint.position.x, lineChartPoint.position.y);
|
||||
[mutableDotViews addObject:dotView];
|
||||
[mutableDotViews addObject:dotView];
|
||||
[self addSubview:dotView];
|
||||
}
|
||||
[mutableDotViewsDict setObject:[NSArray arrayWithArray:mutableDotViews] forKey:[NSNumber numberWithInteger:lineIndex]];
|
||||
@@ -158,39 +159,42 @@ NSInteger const kJBLineChartDotsViewUnselectedLineIndex = -1;
|
||||
if ([key isKindOfClass:[NSNumber class]])
|
||||
{
|
||||
NSInteger lineIndex = [((NSNumber *)key) intValue];
|
||||
|
||||
// Internal dot
|
||||
if ([dotView isKindOfClass:[JBLineChartDotView class]])
|
||||
{
|
||||
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];
|
||||
}
|
||||
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: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
|
||||
{
|
||||
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];
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
dotView.alpha = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (![dotView isKindOfClass:[NSNull class]])
|
||||
{
|
||||
// Internal dot
|
||||
if ([dotView isKindOfClass:[JBLineChartDotView class]])
|
||||
{
|
||||
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];
|
||||
}
|
||||
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: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
|
||||
{
|
||||
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];
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
dotView.alpha = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
horizontalIndex++;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "JBChartView"
|
||||
s.version = "3.0.5"
|
||||
s.version = "3.0.13"
|
||||
s.summary = "Jawbone's iOS-based charting library for both line and bar graphs."
|
||||
s.homepage = "https://github.com/Jawbone/JBChartView"
|
||||
|
||||
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
|
||||
s.author = { "Terry Worona" => "tworona@jawbone.com" }
|
||||
s.source = {
|
||||
:git => "https://github.com/Jawbone/JBChartView.git",
|
||||
:tag => "v3.0.5"
|
||||
:tag => "v3.0.13"
|
||||
}
|
||||
|
||||
s.platform = :ios, '6.0'
|
||||
|
||||
@@ -205,18 +205,15 @@ NSString * const kJBBarChartViewControllerNavButtonViewKey = @"view";
|
||||
|
||||
- (void)chartToggleButtonPressed:(id)sender
|
||||
{
|
||||
int randomNumber = (-3) + rand() % (3-(-3));
|
||||
UIView *buttonImageView = [self.navigationItem.rightBarButtonItem valueForKey:kJBBarChartViewControllerNavButtonViewKey];
|
||||
buttonImageView.userInteractionEnabled = NO;
|
||||
|
||||
NSMutableArray *mutableChartData = [NSMutableArray array];
|
||||
for (int i=0; i<(kJBBarChartViewControllerNumBars + randomNumber ); i++)
|
||||
{
|
||||
NSInteger delta = ((kJBBarChartViewControllerNumBars + randomNumber) - labs(((kJBBarChartViewControllerNumBars + randomNumber) - i) - i)) + 2;
|
||||
[mutableChartData addObject:[NSNumber numberWithFloat:MAX((delta * kJBBarChartViewControllerMinBarHeight), arc4random() % (delta * kJBBarChartViewControllerMaxBarHeight))]];
|
||||
|
||||
}
|
||||
self.chartData = [NSArray arrayWithArray:mutableChartData];
|
||||
CGAffineTransform transform = self.barChartView.state == JBChartViewStateExpanded ? CGAffineTransformMakeRotation(M_PI) : CGAffineTransformMakeRotation(0);
|
||||
buttonImageView.transform = transform;
|
||||
|
||||
[self.barChartView reloadDataAnimated:YES];
|
||||
[self.barChartView setState:self.barChartView.state == JBChartViewStateExpanded ? JBChartViewStateCollapsed : JBChartViewStateExpanded animated:YES callback:^{
|
||||
buttonImageView.userInteractionEnabled = YES;
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Overrides
|
||||
|
||||
Reference in New Issue
Block a user