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

X/Y Axis Title

1 Answer 48 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jon
Top achievements
Rank 1
Jon asked on 07 Feb 2014, 06:03 PM
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

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 10 Feb 2014, 09:44 AM
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).

Tags
General Discussion
Asked by
Jon
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or