Shinobi Charts选择了点突出显示

时间:2013-12-10 16:05:19

标签: shinobi

我有一个SChartLineSeries,当我选择一个点时,似乎没有应用selectedPointStyle。

这是我的代码:

-(SChartSeries*)sChart:(ShinobiChart *)chart seriesAtIndex:(NSInteger)index {
   SChartLineSeries* lineSeries = [[SChartLineSeries alloc] init];

   lineSeries.selectionMode = SChartSelectionPoint;

   SChartLineSeriesStyle *style = [SChartLineSeriesStyle new];
   style.pointStyle = [SChartPointStyle new];
   style.pointStyle.showPoints = YES;
   style.pointStyle.color = [UIColor whiteColor];
   style.pointStyle.radius = [NSNumber numberWithInt:5];
   //style.pointStyle.innerRadius = [NSNumber numberWithFloat:0.0];
   style.selectedPointStyle.color = [UIColor orangeColor];
   style.selectedPointStyle.radius = [NSNumber numberWithInt:15];

   [lineSeries setStyle:style];
   //[lineSeries setSelectedStyle:style];
}

请帮忙。我们正处于关键时刻。另外,如果我必须自定义显示虚线,是否可以在Shinobi中这样做?

1 个答案:

答案 0 :(得分:3)

问题是您尝试在selectedPointStyle属性上设置属性,默认情况下为nil。与为SChartPointStyle属性创建新pointStyle对象的方式相同,您需要为selectedPointStyle属性创建一个。{/ p>

将您的代码更新为以下内容,您应该观察您所选择的效果:

- (SChartSeries*)sChart:(ShinobiChart *)chart seriesAtIndex:(NSInteger)index {
   SChartLineSeries* lineSeries = [[SChartLineSeries alloc] init];

   lineSeries.selectionMode = SChartSelectionPoint;

   SChartLineSeriesStyle *style = [SChartLineSeriesStyle new];
   style.pointStyle = [SChartPointStyle new];
   style.pointStyle.showPoints = YES;
   style.pointStyle.color = [UIColor whiteColor];
   style.pointStyle.radius = @(5);

   style.selectedPointStyle = [SChartPointStyle new];
   style.selectedPointStyle.showPoints = YES;
   style.selectedPointStyle.color = [UIColor orangeColor];
   style.selectedPointStyle.radius = @(15);

   [lineSeries setStyle:style];
   return lineSeries;
}

在回答您的其他问题时,ShinobiCharts目前不支持虚线。