X/Y Axis Title

2 posts, 0 answers
  1. Jon
    Jon avatar
    6 posts
    Member since:
    Aug 2013

    Posted 07 Feb 2014 Link to this post

    I'm attempting to set the x/y axis titles.  I'm using the following code:


        TKChartSeries *series = [[TKChartBarSeries alloc] initWithItems:array];
        //series.style.paletteMode = TKChartSeriesStylePaletteModeUseItemIndex;
        series.selectionMode = TKChartSeriesSelectionModeNone;

        [[series xAxis] setTitle:@"X Axis Name"];
        [[series yAxis] setTitle:@"Y Axis Name"];

    However, nothing is being display at run time.  What am I leaving out?


    Cheers, Jon
  2. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 10 Feb 2014 Link to this post

    Hi Jon,

    Thank you for evaluating our product.

    By default xAxis and yAxis properties are empty, they are assigned to valid values after the series object is added to a chart instance. For example:
    TKChartSeries *series = [[TKChartBarSeries alloc] initWithItems:array];
    series.selectionMode = TKChartSeriesSelectionModeNone;
     
    [_chart addSeries:series];
     
    [[series xAxis] setTitle:@"X Axis Name"];
    [[series yAxis] setTitle:@"Y Axis Name"];

    Another option would be to create the axis instance manually:
    TKChartSeries *series = [[TKChartBarSeries alloc] initWithItems:array];
    series.selectionMode = TKChartSeriesSelectionModeNone;
     
    TKChartNumericAxis *xAxis = [[TKChartNumericAxis alloc] initWithMinimum:@0 andMaximum:@2000];
    xAxis.position = TKChartAxisPositionBottom;
    xAxis.majorTickInterval = @300;
    series.xAxis = xAxis;
    [_chart addAxis:xAxis];
     
    TKChartNumericAxis *yAxis = [[TKChartNumericAxis alloc] initWithMinimum:@0 andMaximum:@12];
    yAxis.position = TKChartAxisPositionLeft;
    yAxis.majorTickInterval = @1;
    series.yAxis = yAxis;
    [_chart addAxis:yAxis];
     
    [[series xAxis] setTitle:@"X Axis Name"];
    [[series yAxis] setTitle:@"Y Axis Name"];
     
    [_chart addSeries:series];

    Do not hesitate to contact us if you need further assistance.

    Regards,
    Jack
    Telerik

    Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

  3. DevCraft banner
Back to Top