setSelectedStyle apparently does not work


#1

I’m doing a simple test application for the iPad. I create a scatterplot and I want white points on the graph. When a point is selected by user, I want that the point becomes red. SChartScatterSeries allows me to set a style for normal point and another for selected ones.

However, no matter what kind of style I try to set for selected points, I get a purple circle for the selected point. Even if I change theme, result does not change. What am I doing wrong?

    SChartScatterSeries *series = [SChartScatterSeries new];
    series.crosshairEnabled = YES;
    series.title = [self titleForKey:key];
    series.selectionMode =  SChartSelectionPoint;

    SChartScatterSeriesStyle *style = [SChartScatterSeriesStyle 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];

    SChartScatterSeriesStyle *style2 = [SChartScatterSeriesStyle new];
    style2.pointStyle = [SChartPointStyle new];
    style2.pointStyle.showPoints = YES;
    style2.pointStyle.color = [UIColor redColor];
    style2.pointStyle.radius = [NSNumber numberWithInt:10];
    style2.pointStyle.innerRadius = [NSNumber numberWithInt:5];

    [series setStyle:style];
    [series setSelectedStyle:style2];

sorry for the crossposting on SO.


#2

“selectedStyle” is used when an entire series needs selecting. From the sounds of your example, you are only trying to select an individual point, in which case you want to set

style.selectedPointStyle.color = [UIColor redColor];


#3

How can I select individual bar in SchartColumnSeries. Following is the code I using, but it is not working:

SChartColumnSeries *colSeries = [[SChartColumnSeries alloc] init] ;
    SChartColumnSeriesStyle *selectedStyle = [[SChartColumnSeriesStyle alloc] init];
    selectedStyle.areaColor = [UIColor blackColor];
    [colSeries setSelectedStyle:selectedStyle];
    colSeries.selectionMode = SChartSelectionPoint;

#4

We currently don’t support selecting individual bars from a single column series, although we have work in the pipeline to support this in the future.

In the meantime, you could potentially have a series for each column, and use selectionMode = SChartSelectionSeries. Alternatively, you could use an annotation above the column.