Graph overlap problem - reloadChart does not solve the issue
aalptekin opened this issue · comments
drawing the first chart is fine. However, when a second chart is to be drawn, the first graph still is shown thus the second graph overlaps the first one. For any subsequent graph draw attempt causes the overlap to build on top of previous graphs.
Similar issue is reported in closed issue #18 Reset Graph. The proposed fix to use ReloadPieChart method does not fix the issue.
Sample Code ;
#pragma Mark CreatePieChart
-
(void)createPieChart{
//PieChart *chart = [[PieChart alloc] initWithFrame:CGRectMake(0, header_height, WIDTH(self.view), (HEIGHT(self.view) - header_height)/2)];
PieChart *chart = [[PieChart alloc] initWithFrame:CGRectMake(0, header_height, 350, 290)];
[chart setDataSource:self];
[chart setDelegate:self];
[chart setShowLegend:TRUE];
//[chart setLegendViewType:LegendTypeHorizontal];
[chart setLegendViewType:LegendTypeVertical];
[chart setTextFontSize:12];
[chart setTextColor:[UIColor redColor]];
[chart setTextFont:[UIFont systemFontOfSize:chart.textFontSize]];
[chart setShowValueOnPieSlice:TRUE];
[chart setShowCustomMarkerView:TRUE];
//[chart drawPieChart];
[chart reloadPieChart];
[self.view addSubview:chart];
}