How do I hide ticks and their labels?


#1

Hi,

I would like to hide all of the ticks and their labels from the chart. I tried the followings but it did not do anything.

    self.chart.xAxis.style.majorTickStyle.showLabels = NO;
     self.chart.xAxis.style.majorTickStyle.showTicks = NO;
     [self.chart.xAxisgenerateTickMarks:NO];

Is there a way to hide them?

Thanks,

Oguzhan.


#2

Hi Oguzhan,

It looks to me like you’re on the right track - are you making those calls before the chart is rendered the first time? Otherwise it will already have generated the tickmarks and labels and you may need to call redrawChart on your chart to apply the changes. If you can’t get this working, if you can send in your project to info@shinobicontrols.com, I’ll take a look for you :slight_smile:

Simon


#3

Hi Simon,

I added  redrawChart  but it still did not remove the ticks and labels. I sent you the relevant code to info@shinobicontrols.com. Please have a look at it.

Please note that there is a problem with the project that it does not install to the simulator but it installs to iPad.

Thank you!


#4

By Simon’s help, we solved the problem. After the following code that removes the labels and ticks:

    self.chart.xAxis.style.majorTickStyle.showLabels = NO;
     self.chart.xAxis.style.majorTickStyle.showTicks = NO;
     self.chart.yAxis.style.majorTickStyle.showLabels = NO;
     self.chart.yAxis.style.majorTickStyle.showTicks = NO;

I had the following code which was overwriting the above style changes. Moving the following code before the above code solved the problem:

    self.chart.theme.chartStyle.plotAreaBackgroundColor = [UIColorclearColor];
     self.chart.theme.chartStyle.canvasBackgroundColor = [UIColorclearColor];
     self.chart.theme.chartStyle.plotAreaBorderColor = [UIColorclearColor];
     [self.chartapplyTheme];

Thanks Simon…