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

TKChartAreaSeries

2 Answers 118 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.
Jerry
Top achievements
Rank 1
Jerry asked on 14 May 2015, 03:55 PM

I am not able to change the text color for the x or y Axis.  I have read post after post and still, I am not able to make the text change color.  Any help would be appreciated.  Here is the code I am using to initialize the chart:

  _lineSeries3Month = [[TKChartAreaSeries alloc] initWithItems:_points];

  [self.chartView addSeries:_lineSeries3Month];

  _lineSeries3Month.selectionMode = TKChartSeriesSelectionModeDataPoint;
  _lineSeries3Month.style.pointShape = [TKPredefinedShape shapeWithType:TKShapeTypeCircle andSize:CGSizeMake(8.f, 8.f)];
  _lineSeries3Month.style.shapeMode = TKChartSeriesStyleShapeModeAlwaysShow;
  _lineSeries3Month.yAxis.style.labelStyle.textColor = [UIColor whiteColor];

  self.chartView.yAxis.style.labelStyle.textHidden = NO;
  self.chartView.allowAnimations = YES;
  self.chartView.title.hidden = YES;

  [self.chartView reloadData];

2 Answers, 1 is accepted

Sort by
0
Jerry
Top achievements
Rank 1
answered on 14 May 2015, 04:45 PM

Update:

 I cloned the telerik/ios-sdk from Github and modified the Customize Example App to change the yAxis text color to red and it did not work.  The Customize example was setting the yAxis to black and the only thing I changed was to change the color to red.  However, when executing the App, it did not change to red but, remained black.

0
Adrian
Telerik team
answered on 18 May 2015, 11:44 AM
Hello Jerry,

Thank you for contacting us.

After investigating the scenario I can confirm that there is an issue when you try to set the textColor property of TKChartAxisLabelStyle after the series are added to the chart. I logged it in our feedback portal. Feel free to vote/comment the issue. I also updated your Telerik point for reporting it. The issue will be addressed in a future version of UI for iOS. Until then a possible way to change the color of the axis labels is to invoke the update method of TKChart. This method updates the chart's UI. Please consider the code snippet below:
TKChartLineSeries *series = [[TKChartLineSeries alloc] initWithItems:dataPoints];
[_chart addSeries:series];
_chart.yAxis.style.labelStyle.textColor = [UIColor redColor];
[_chart update];

Please note that if you are using automatic axes and you call the reloadData method of TKChart, the axes styles will be overriden to the default ones and the color of the labels will be black - the default.

I hope this helps. if you have further questions, do not hesitate to contact us.

Regards,
Adrian
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
Jerry
Top achievements
Rank 1
Answers by
Jerry
Top achievements
Rank 1
Adrian
Telerik team
Share this question
or