1

I am using Shinobi charts on iOS and i am having issues when i try not to display the axis.

chart.axis.width = @0 -> doesn't work

chart.axis.width = @0.1 -> it works ok seems hacky though.

Is there another way to hide the axis?

zero7
  • 1,298
  • 8
  • 14

4 Answers4

7

chart.xAxis.width = @0.1; works. Only problem is it logs a nasty warning message every time the chart renders.

This is what you want:

self.chart.xAxis.style.lineWidth = @0;
self.chart.xAxis.style.majorTickStyle.showLabels = NO;
self.chart.xAxis.style.majorTickStyle.showTicks  = NO;
tybro0103
  • 48,327
  • 33
  • 144
  • 170
1

You can avoid using chart.xAxis.width = @0.1; (and get rid of the warning messages that result, as well) by also hiding the minorTicks:

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

and repeat for the yAxis, if desired.

adamup
  • 1,508
  • 19
  • 29
0

Did you mean to say "chart.xAxis" or "chart.yAxis"? I don't see an option for "chart.axis".

At any rate, try this:

chart.xAxis.style.majorGridLineStyle.showMajorGridLines = NO;

You can play around with other style items as you wish. Check out http://www.shinobicontrols.com/docs/ShinobiControls/ShinobiCharts/2.2.0/Standard/Normal/Classes/SChartAxisStyle.html for more info.

Cam
  • 128
  • 5
  • yes no axis. i just wanted to generalize so xAxis or yAxis doesn't matter. setting showMajorGridLines will hide the grid lines behind the chart so the axis will still show. – zero7 Apr 11 '13 at 20:28
  • thanks for the link, that got me going to the right direction. I edited your post with correct solution and accepted it. – zero7 Apr 11 '13 at 20:37
0

Hiding Ticks and Labels

chart.yAxis.style.minorTickStyle.showLabels = NO;
chart.yAxis.style.minorTickStyle.showTicks = NO;
chart.yAxis.style.majorTickStyle.showLabels = NO;
chart.yAxis.style.majorTickStyle.showTicks = NO;

Do you have a Multi Axis Chart?

You can hide the ticks and labels on the shinobi delegate method yAxisForSeriesAtIndex or xAxisForSeriesAtIndex (depending what axis you are interested).

-(SChartAxis *)sChart:(ShinobiChart *)chart yAxisForSeriesAtIndex:(NSInteger)index
{
  //secondary axis
 if (index == 0)
 {
    SChartAxis * secondAxis = chart.allYAxes[1];

    //hiding axis in chart
    secondAxis.style.minorTickStyle.showLabels = NO;
    secondAxis.style.minorTickStyle.showTicks = NO;
    secondAxis.style.majorTickStyle.showLabels = NO;
    secondAxis.style.majorTickStyle.showTicks = NO;

     return secondAxis;
  }
  //primary axis
  else
  {
      return chart.yAxis;
   }
}//eom
LuAndre
  • 1,114
  • 12
  • 23