Monday, May 13, 2013

Objective c Hiding yAxis in Shinobi bar charts

When we are using the column charts, some times we display y-axis values on top of the y-axis slices. So we don't need to display y-axis. Developers, If your client is so concerned about hiding the y-axis in Shinobi charts, you came to the right article :)


                         




Here is the Objective-c piece of code which hides the y-axis for your need.


SChartNumberRange *range = [[SChartNumberRange alloc] 
           initWithMinimum:[NSNumber numberWithInt:0] 
            andMaximum:[NSNumber numberWithInt:500]];
    
SChartNumberAxis *yAxis = [[SChartNumberAxis alloc] initWithRange:range];
yAxis.title = @"";
    
yAxis.style.majorGridLineStyle.showMajorGridLines = NO;
    
[yAxis.style setLineWidth:[NSNumber numberWithInt:0]];  
yAxis.style.majorTickStyle.showTicks = NO;
yAxis.style.majorTickStyle.showLabels = NO;    
yAxis.style.minorTickStyle.showTicks = NO;
yAxis.style.minorTickStyle.showLabels = NO;

chart.yAxis = yAxis;


Here in the above code I am doing nothing but disabling all the display features of y-axis. Nice trick right :)


Feel free to comment in case of any queries or concerns.