Skip to content

Commit

Permalink
horizontal legend view fixes, and values shown in percentage for pie …
Browse files Browse the repository at this point in the history
…and stack charts on touch
  • Loading branch information
dhirenthirani committed Jun 13, 2016
1 parent e141bee commit 7d64a00
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
touchedLayer = shapeLayer;

NSString *data = [shapeLayer valueForKey:@"data"];
[self showMarkerWithData:data withTouchedPoint:touchPoint];
NSString *dataPercentage = [NSString stringWithFormat:@"%0.2f%%",(data.floatValue/totalCount)*100];
[self showMarkerWithData:dataPercentage withTouchedPoint:touchPoint];
if ([self.delegate respondsToSelector:@selector(didTapOnHorizontalStackBarChartWithValue:)]) {
[self.delegate didTapOnHorizontalStackBarChartWithValue:data];
}
Expand Down
4 changes: 2 additions & 2 deletions dr-charts/Classes/Legend/LegendView.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ - (void)createLegend{

if (width >= WIDTH(self)) {
height = height + LEGEND_VIEW + INNER_PADDING;
width = 0;
width += LEGEND_VIEW + size.width + 2*INNER_PADDING;
x = 0;
}

Expand Down Expand Up @@ -128,7 +128,7 @@ + (CGFloat)getLegendHeightWithLegendArray:(NSMutableArray *)legendArray legendTy

if (width >= viewWidth) {
height = height + LEGEND_VIEW + INNER_PADDING;
width = 0;
width += LEGEND_VIEW + size.width + 2*INNER_PADDING;
x = 0;
}
}
Expand Down
3 changes: 2 additions & 1 deletion dr-charts/Classes/PieChart/PieChart.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
touchedLayer = shapeLayer;

NSString *data = [shapeLayer valueForKey:@"data"];
[self showMarkerWithData:data withTouchedPoint:touchPoint];
NSString *dataPercentage = [NSString stringWithFormat:@"%0.2f%%",(data.floatValue/self.totalCount.floatValue)*100];
[self showMarkerWithData:dataPercentage withTouchedPoint:touchPoint];
if ([self.delegate respondsToSelector:@selector(didTapOnPieChartWithValue:)]) {
[self.delegate didTapOnPieChartWithValue:data];
}
Expand Down

0 comments on commit 7d64a00

Please sign in to comment.