我在数据点的JBLineChartView上遇到了麻烦。主要是,图形上的线被隐藏,直到(并且只有在)用户与它交互时。显然,由于用户体验的原因,在这里拥有一个空图并不那么可取,但我似乎无法找到在用户与其交互之前将其设置为隐藏行的位置。
即使在挖掘了所提供的演示之后,我也找不到调用它的位置。下面是处理视图中图表的绘制和设置的代码:
- (void)viewDidLoad
{
self.title = @"Water Quality";
_chartView = [[JBLineChartView alloc] init];
_chartView.delegate = self;
_chartView.dataSource = self;
[_chartView setState:JBChartViewStateExpanded];
_chartView.backgroundColor = [UIColor blackColor];
_chartView.showsLineSelection = YES;
_chartView.showsVerticalSelection = YES;
[_chartView setAlpha:0.5f];
_headerView = [[JBChartHeaderView alloc] initWithFrame:CGRectMake(0, 74, 320, 30)];
_chartView.frame = CGRectMake(0, 94, 320, 200);
_footerView = [[JBLineChartFooterView alloc] initWithFrame:CGRectMake(0, 294, 320, 30)];
_headerView.titleLabel.text = @"Alkalinity";
_headerView.titleLabel.textColor = [UIColor whiteColor];
_footerView.leftLabel.text = [testArray1 firstObject];
_footerView.rightLabel.text = [testArray1 lastObject];
_footerView.leftLabel.textColor = [UIColor whiteColor];
_footerView.rightLabel.textColor = [UIColor whiteColor];
_footerView.backgroundColor = [UIColor blackColor];
[_footerView setAlpha:0.5f];
_footerView.sectionCount = [testArray1 count];
// THIS IS THE VIEW WHEN THE USER INTERACTS WITH THE CHART
/*
_informationView = [[JBChartInformationView alloc] initWithFrame:CGRectMake(0, 0, 40, 300)];
[_informationView setBackgroundColor:[UIColor grayColor]];*/
[_chartView setMinimumValue:1.0f];
[_chartView setMaximumValue:20.0f];
[self.view addSubview:_footerView];
[self.view addSubview:_headerView];
[self.view addSubview:_chartView];
// [self.view addSubview:_informationView];
[_chartView reloadData];
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}我意识到这一点有点模糊,但有没有人有这个框架的经验,可以解释这一点?
发布于 2014-05-29 17:13:57
您已将图表的背景色设置为黑色:
_chartView.backgroundColor = [UIColor blackColor];图表中任何一行的默认颜色也是黑色的。
您需要将chartView的背景色从黑色更改为其他颜色,或者通过以下方式提供不同的线条颜色:
(UIColor *)lineChartView:(JBLineChartView *)lineChartView colorForLineAtLineIndex:(NSUInteger)lineIndex;https://stackoverflow.com/questions/23924453
复制相似问题