首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JBChartView数据点隐藏直到用户交互

JBChartView数据点隐藏直到用户交互
EN

Stack Overflow用户
提问于 2014-05-29 01:40:57
回答 1查看 222关注 0票数 0

我在数据点的JBLineChartView上遇到了麻烦。主要是,图形上的线被隐藏,直到(并且只有在)用户与它交互时。显然,由于用户体验的原因,在这里拥有一个空图并不那么可取,但我似乎无法找到在用户与其交互之前将其设置为隐藏行的位置。

即使在挖掘了所提供的演示之后,我也找不到调用它的位置。下面是处理视图中图表的绘制和设置的代码:

代码语言:javascript
复制
- (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.
}

我意识到这一点有点模糊,但有没有人有这个框架的经验,可以解释这一点?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-05-29 17:13:57

您已将图表的背景色设置为黑色:

代码语言:javascript
复制
_chartView.backgroundColor = [UIColor blackColor];

图表中任何一行的默认颜色也是黑色的。

您需要将chartView的背景色从黑色更改为其他颜色,或者通过以下方式提供不同的线条颜色:

代码语言:javascript
复制
(UIColor *)lineChartView:(JBLineChartView *)lineChartView colorForLineAtLineIndex:(NSUInteger)lineIndex;
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23924453

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档