Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b6bc9c29ca | |||
| 124eabe98c | |||
| 1f0f3351c3 |
@@ -150,6 +150,16 @@ typedef NS_ENUM(NSInteger, JBLineChartViewLineStyle){
|
||||
*/
|
||||
- (void)didDeselectLineInLineChartView:(JBLineChartView *)lineChartView;
|
||||
|
||||
/**
|
||||
* Returns whether or not a line at a particular index responds to selection events.
|
||||
*
|
||||
* Default: YES
|
||||
*
|
||||
* @param lineChartView A line chart object informing the delegate about the new selection.
|
||||
* @param lineIndex An index number identifying the closest line in the chart to the current touch
|
||||
*/
|
||||
- (BOOL)lineChartView:(JBLineChartView *)lineChartView shouldIgnoreSelectionAtIndex:(NSUInteger)lineIndex;
|
||||
|
||||
/**
|
||||
* Returns the color of particular line at lineIndex within the chart.
|
||||
*
|
||||
|
||||
@@ -952,6 +952,15 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
for (NSUInteger lineIndex=0; lineIndex<numberOfLines; lineIndex++)
|
||||
{
|
||||
NSAssert([self.dataSource respondsToSelector:@selector(lineChartView:numberOfVerticalValuesAtLineIndex:)], @"JBLineChartView // dataSource must implement - (NSUInteger)lineChartView:(JBLineChartView *)lineChartView numberOfVerticalValuesAtLineIndex:(NSUInteger)lineIndex");
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector(lineChartView:shouldIgnoreSelectionAtIndex:)])
|
||||
{
|
||||
if([self.delegate lineChartView:self shouldIgnoreSelectionAtIndex:lineIndex])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ([self.dataSource lineChartView:self numberOfVerticalValuesAtLineIndex:lineIndex] > rightHorizontalIndex)
|
||||
{
|
||||
NSArray *lineData = [self.chartData objectAtIndex:lineIndex];
|
||||
|
||||
@@ -279,7 +279,7 @@ As well, by default, each line will have squared off end caps and connection poi
|
||||
|
||||
- (BOOL)lineChartView:(JBLineChartView *)lineChartView smoothLineAtLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
Lastly, a line chart's selection events are delegated back via:
|
||||
Furthermore, a line chart's selection events are delegated back via:
|
||||
|
||||
- (void)lineChartView:(JBLineChartView *)lineChartView didSelectLineAtIndex:(NSUInteger)lineIndex horizontalIndex:(NSUInteger)horizontalIndex touchPoint:(CGPoint)touchPoint
|
||||
{
|
||||
@@ -291,6 +291,13 @@ Lastly, a line chart's selection events are delegated back via:
|
||||
// Update view
|
||||
}
|
||||
|
||||
Lastly, if you don't want a line to be selectable:
|
||||
|
||||
- (BOOL)lineChartView:(JBLineChartView *)lineChartView shouldIgnoreSelectionAtIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return NO; // Check line index
|
||||
}
|
||||
|
||||
The <b>touchPoint</b> is especially important as it allows you to add custom elements to your chart during selection events. Refer to the demo project (<b>JBLineChartViewController</b>) to see how a tooltip can be used to display additional information during selection events.
|
||||
|
||||
## Minimum & Maximum Values
|
||||
|
||||
Reference in New Issue
Block a user