Ios Shinobic正在选择列
我试图使图表中的列可选择,并在单击时显示所选列的更多详细信息。每一列都由一个系列表示(您马上就会明白) 以下是我构建每个系列的方式:Ios Shinobic正在选择列,ios,graph,charts,Ios,Graph,Charts,我试图使图表中的列可选择,并在单击时显示所选列的更多详细信息。每一列都由一个系列表示(您马上就会明白) 以下是我构建每个系列的方式: -(SChartSeries *)sChart:(ShinobiChart *)chart seriesAtIndex:(int)index { SChartColumnSeries *series = [SChartColumnSeries new]; series.style.showAreaWithGradient = NO; ser
-(SChartSeries *)sChart:(ShinobiChart *)chart seriesAtIndex:(int)index {
SChartColumnSeries *series = [SChartColumnSeries new];
series.style.showAreaWithGradient = NO;
series.stackIndex = [NSNumber numberWithInt:0];
series.selectedStyle.showAreaWithGradient = NO;
CHART_COLOR_TYPE dataType = [TestGraphDataManager getDataType:index];
series.style.areaColor = (dataType == ACCOUNT)?
[UIColor colorWithRed:227.0f/255.0f green:179.0f/255.0f blue:0.0f/255.0f alpha:0.5f]:
[UIColor colorWithRed:0.0f/255.0f green:172.0f/255.0f blue:235.0f/255.0f alpha:0.5f];
series.selectedStyle.areaColor = [UIColor colorWithRed:129.0f/255.0f green:0.0f/255.0f blue:82.0f/255.0f alpha:0.5f];
series.selectionMode = SChartSelectionSeries;
series.style.lineColor = [UIColor clearColor];
series.selectedStyle.lineColor = [UIColor clearColor];
return series;
}
我目前的问题是,只有第一个系列是可选的。此外,我还将每个条用不同的系列表示,这样我就可以使用series.selectionMode=SChartSelectionSeries
最后,我有了这个委托事件,这样我可以加载额外的数据,但它也只在第一个系列中被调用
- (void)sChart:(ShinobiChart *)chart toggledSelectionForSeries:(SChartSeries *)series nearPoint:(SChartDataPoint *)dataPoint atPixelCoordinate:(CGPoint)pixelPoint{
NSLog(@"click event called");
//Display data
}
有人知道为什么会这样吗?这一整天都让我发疯
提前感谢您提供的任何帮助
编辑:
我在series.stackIndex=[NSNumber numberwhithint:0]中发现了主要问题代码>它使所有的条都具有相同的名称堆栈(在我看来,名称重复不是问题),我这样做是为了使所有条都与记号标记保持相同的距离,从而使条不是很长。但我相信,shinobi为这些值设置了不可见的条,并且它们在另一个上面,使得只有第一个系列是可选的,因为它比其他系列更重要。如果我去掉那一行,图形看起来很糟糕,但都可以点击。
有没有关于如何绕过这个问题或避免这个问题的想法
它应该是什么样子(使用堆叠索引),但它破坏了单击事件:
如果没有堆叠索引,所有的条都可以单击,但看起来不太好,而且我的条越多,情况就越糟。这只使用了4条条:
来自Shinobi的Rob在这里-感谢您的联系
这可以通过使用子类化并为列偏移量返回零来解决,如下所示:
@interface MyColumnSeries : SChartColumnSeries
@end
@implementation MyColumnSeries
- (double) offsetOfStackInChart:(ShinobiChart *)chart forDatapointIndex:(const int)pointIndex withPointSelector:(SEL)pointSelector
{
return 0.0;
}
@end
你为什么不请求shinobi的支持?他们很乐意帮助你,通常会在24小时内回复。我只是想听听你的建议:)你好,我读了你的电子邮件,我使用的版本是:version:2.1.1(试用版),于2012年10月18日发布
如果是因为这个版本,有什么想法吗?