Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6691f7a8c3 | |||
| c015531c85 | |||
| 3d036edc96 | |||
| 85c30351fe | |||
| d37383a352 | |||
| 3c6cf24cf7 | |||
| 8dbb2679ee | |||
| 867466d1d1 |
@@ -1,5 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.5.4">2.5.4</a>
|
||||
#### 05/07/14
|
||||
- Additional fixes to issue <a href="https://github.com/Jawbone/JBChartView/pull/53">#53</a>.
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.5.3">2.5.3</a>
|
||||
#### 05/06/14
|
||||
- More compiler warning fixes.
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.5.2">2.5.2</a>
|
||||
#### 05/06/14
|
||||
- Fixed compiler warnings.
|
||||
|
||||
@@ -102,9 +102,22 @@
|
||||
*/
|
||||
- (UIView *)barChartView:(JBBarChartView *)barChartView barViewAtIndex:(NSUInteger)index;
|
||||
|
||||
/**
|
||||
* If you already implement barChartView:barViewAtIndex: delegate - this method has no effect.
|
||||
* If a custom UIView isn't supplied, a flat bar will be made automatically (default color black).
|
||||
*
|
||||
* Default: if none specified - calls barChartView:barViewAtIndex:.
|
||||
*
|
||||
* @param barChartView The bar chart object requesting this information.
|
||||
* @param index The 0-based index of a given bar (left to right, x-axis).
|
||||
*
|
||||
* @return The color to be used to color a bar in the chart.
|
||||
*/
|
||||
- (UIColor *)barChartView:(JBBarChartView *)barChartView colorForBarViewAtIndex:(NSUInteger)index;
|
||||
|
||||
/**
|
||||
* The selection color to be overlayed on a bar during touch events.
|
||||
* The color is automically faded to transparent (vertically). The property showsVerticalSelection
|
||||
* The color is automatically faded to transparent (vertically). The property showsVerticalSelection
|
||||
* must be YES for the color to apply.
|
||||
*
|
||||
* Default: white color (faded to transparent).
|
||||
|
||||
@@ -181,8 +181,21 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
else
|
||||
{
|
||||
barView = [[UIView alloc] init];
|
||||
barView.backgroundColor = kJBBarChartViewDefaultBarColor;
|
||||
UIColor *backgroundColor = nil;
|
||||
|
||||
if ([self.dataSource respondsToSelector:@selector(barChartView:colorForBarViewAtIndex:)])
|
||||
{
|
||||
backgroundColor = [self.dataSource barChartView:self colorForBarViewAtIndex:index];
|
||||
NSAssert(backgroundColor != nil, @"JBBarChartView // datasource function - (UIColor *)barChartView:(JBBarChartView *)barChartView colorForBarViewAtIndex:(NSUInteger)index must return a non-nil UIColor");
|
||||
}
|
||||
else
|
||||
{
|
||||
backgroundColor = kJBBarChartViewDefaultBarColor;
|
||||
}
|
||||
|
||||
barView.backgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
CGFloat height = [self normalizedHeightForRawHeight:[self.chartDataDictionary objectForKey:key]];
|
||||
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);
|
||||
|
||||
@@ -1041,7 +1041,7 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
path.miterLimit = kJBLineChartLinesViewMiterLimit;
|
||||
|
||||
JBLineChartPoint *previousLineChartPoint = nil;
|
||||
CGFloat previousSlope;
|
||||
CGFloat previousSlope = 0.0f;
|
||||
|
||||
NSAssert([self.delegate respondsToSelector:@selector(lineChartLinesView:smoothLineAtLineIndex:)], @"JBLineChartLinesView // delegate must implement - (BOOL)lineChartLinesView:(JBLineChartLinesView *)lineChartLinesView smoothLineAtLineIndex:(NSUInteger)lineIndex");
|
||||
BOOL smoothLine = [self.delegate lineChartLinesView:self smoothLineAtLineIndex:lineIndex];
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "JBChartView"
|
||||
s.version = "2.5.2"
|
||||
s.version = "2.5.4"
|
||||
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 => "v2.5.2"
|
||||
:tag => "v2.5.4"
|
||||
}
|
||||
|
||||
s.platform = :ios, '7.0'
|
||||
|
||||
@@ -21,7 +21,7 @@ CGFloat const kJBBarChartViewControllerChartHeaderHeight = 80.0f;
|
||||
CGFloat const kJBBarChartViewControllerChartHeaderPadding = 10.0f;
|
||||
CGFloat const kJBBarChartViewControllerChartFooterHeight = 25.0f;
|
||||
CGFloat const kJBBarChartViewControllerChartFooterPadding = 5.0f;
|
||||
CGFloat const kJBBarChartViewControllerBarPadding = 1;
|
||||
NSUInteger kJBBarChartViewControllerBarPadding = 1;
|
||||
NSInteger const kJBBarChartViewControllerNumBars = 12;
|
||||
NSInteger const kJBBarChartViewControllerMaxBarHeight = 10;
|
||||
NSInteger const kJBBarChartViewControllerMinBarHeight = 5;
|
||||
@@ -155,11 +155,9 @@ NSString * const kJBBarChartViewControllerNavButtonViewKey = @"view";
|
||||
return kJBBarChartViewControllerBarPadding;
|
||||
}
|
||||
|
||||
- (UIView *)barChartView:(JBBarChartView *)barChartView barViewAtIndex:(NSUInteger)index
|
||||
- (UIColor *)barChartView:(JBBarChartView *)barChartView colorForBarViewAtIndex:(NSUInteger)index
|
||||
{
|
||||
UIView *barView = [[UIView alloc] init];
|
||||
barView.backgroundColor = (index % 2 == 0) ? kJBColorBarChartBarBlue : kJBColorBarChartBarGreen;
|
||||
return barView;
|
||||
return (index % 2 == 0) ? kJBColorBarChartBarBlue : kJBColorBarChartBarGreen;
|
||||
}
|
||||
|
||||
- (UIColor *)barSelectionColorForBarChartView:(JBBarChartView *)barChartView
|
||||
|
||||
@@ -38,7 +38,7 @@ Simply add the following line to your <code>Podfile</code>:
|
||||
Your Podfile should look something like:
|
||||
|
||||
platform :ios, '7.0'
|
||||
pod 'JBChartView', '~> 2.5.2'
|
||||
pod 'JBChartView', '~> 2.5.4'
|
||||
|
||||
### The Old School Way
|
||||
|
||||
@@ -140,6 +140,10 @@ By default, a chart's bars will be black and flat. They can be customized by sup
|
||||
{
|
||||
return ...; // color of line in chart
|
||||
}
|
||||
|
||||
If you don't require a custom UIView, simply supply a color for the bar instead:
|
||||
|
||||
- (UIColor *)barChartView:(JBBarChartView *)barChartView colorForBarViewAtIndex:(NSUInteger)index;
|
||||
|
||||
Furthermore, the color of the selection bar (on touch events) can be customized via the <i>optional</i> protocol:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user