Set style for selected series

4 posts, 0 answers
  1. Thomas
    Thomas avatar
    5 posts
    Member since:
    Mar 2015

    Posted 19 Mar 2015 Link to this post

    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
  2. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 20 Mar 2015 Link to this post

    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.

     
  3. DevCraft banner
  4. Thomas
    Thomas avatar
    5 posts
    Member since:
    Mar 2015

    Posted 20 Mar 2015 Link to this post

    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
  5. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 23 Mar 2015 Link to this post

    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.

     
Back to Top
DevCraft banner