This is a migrated thread and some comments may be shown as answers.

Set style for selected series

3 Answers 53 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Thomas
Top achievements
Rank 1
Thomas asked on 19 Mar 2015, 05:47 PM
I have a stacked column series and style them by myself i.e.:

- (void)styleColumn:(TKChartSeries*)series activityId:(NSNumber*) id
{
    series.style.palette = [TKChartPalette new];
    UIColor* color = [UIColor someColor];
    TKSolidFill *fill = [[TKSolidFill alloc] initWithColor:color];
    [series.style.palette addPaletteItem:[[TKChartPaletteItem alloc] initWithFill:fill]];
}

but then the series is no longer highlighted when it is selected. I dug through the documentation and examples but couldn't find a simple way
to set an alternative style for selected series.
How do I set the style for selected series? (Without doing everything myself in the delegate)

I also tried to implement the delegate didSelect/didUnselect but noticed that didUnselect is veeery unreliable. Often the non-styled series got unselected by a tap but the delegate was never informed.
Is this an issue or a feature?

Furthermore I noticed that panning is very unresponsive. Oftentimes panning to the right does not work at all, I have to pan a bit left and then turn right, otherwise it does not work. If it works it is very choppy.
How can I improve this?


System:
- Target iOS 7
- iOS SDK 8.2
- Xcode 6.2
- Telerik UI for iOS Q1 2015

Thanks for your reply!
Thomas

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 20 Mar 2015, 11:52 AM
Hello Thnomas,

Thank you for contacting us.

You should set the series color explicitly with code when using a custom palette item. That means, you should adopt TKChartDelegate method and implement the appropriate select/deselect methods. Please, could you describe the issues observed by you in this scenario. Maybe there is something specific in your application? That is why I suggest that you send us a sample application where the issues can be demonstrated. This will help us to locate them and provide you with a proper solution. Thank you in advance.

Regarding to your second question, you can try changing the value of the allowPanDeceleration property which controls whether to use inertial panning:
_chart.allowPanDeceleration = YES;

We want to research this issue further, so please prepare a sample project where we can reproduce the issue.

Looking forward to your reply.
 
Regards,
Jack
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Thomas
Top achievements
Rank 1
answered on 20 Mar 2015, 01:18 PM
And how do I change the style for one specific point (the selected one)? I don't want to have the entire series highlighted.


Activating panDeceleration did not help at all. Still feels unresponsive.

I will try to get a sample project ready, although this may take some time.

Thanks for your reply, Thomas
0
Jack
Telerik team
answered on 23 Mar 2015, 04:06 PM
Hello Thomas,

Thank you for this update.

You should set the series selectionMode property to TKChartSeriesSelectionModeDataPoint in order to select single points:
series.style.pointShape = [TKPredefinedShape shapeWithType:TKShapeTypeCircle andSize:CGSizeMake(8, 8)];
series.selectionMode = TKChartSeriesSelectionModeDataPoint;

Use the chart:paletteItemForPoint: method from TKChartDelegate to customize the point appearance:
*
- (TKChartPaletteItem *)chart:(TKChart *)chart paletteItemForPoint:(NSUInteger)index inSeries:(TKChartSeries *)series
{
    BOOL isSelected = [series pointIsSelected:index];
    TKSolidFill *fill = [TKSolidFill solidFillWithColor:isSelected ? [UIColor yellowColor] : [UIColor redColor]];
    TKChartPaletteItem *item = [[TKChartPaletteItem alloc] initWithFill:fill];
    return item;
}

I hope this helps.

Regards,
Jack
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Chart
Asked by
Thomas
Top achievements
Rank 1
Answers by
Jack
Telerik team
Thomas
Top achievements
Rank 1
Share this question
or