Custom Y-Axis range values for dataset made of 0s


#1

I’m using Shinobi iOS control for drawing line charts in my app. I’m currently rendering a serious of 0s value.

 The resulting graph is like that:

enter image description here

Now, the problem is that the quantity I’m representing is a currency so it cannot be negative. How can I limit the range to start from 0 in this specific case? Basically I want the default range for dataset made of 0s to be [0,0.5] and not [-0.5,0.5]

This is how I create the graph:

// initiatialise line chart
    ShinobiChart *chartView = [[ShinobiChart alloc]initWithFrame:frame];
    chartView.clipsToBounds = NO;
    //Choose the light theme for this chart
    SChartLightTheme *theme = [SChartLightTheme new];
    //perform any theme stylign here before applying to the chart
    chartView.theme = theme;
    chartView.title = @"my Title"; 
    chartView.autoresizingMask = UIViewAutoresizingNone;
    // Use a number axis for the x axis.
    SChartDateTimeAxis *xAxis = [[SChartDateTimeAxis alloc] init];
    xAxis.title = @"date";
    xAxis.tickLabelClippingModeHigh = SChartTickLabelClippingModeTicksAndLabelsPersist;
 //keep tick marks at the right end
    //Make some space at the axis limits to prevent clipping of the datapoints
    xAxis.rangePaddingHigh = [SChartDateFrequency dateFrequencyWithDay:1];
    xAxis.rangePaddingLow = [SChartDateFrequency dateFrequencyWithDay:1];
    //allow zooming and panning
    xAxis.enableGesturePanning = YES;
    xAxis.enableGestureZooming = YES;
    xAxis.enableMomentumPanning = YES;
    xAxis.enableMomentumZooming = YES;
    chartView.xAxis = xAxis;
    // Use a number axis for the y axis.
    SChartNumberAxis *yAxis = [[SChartNumberAxis alloc] init];
    yAxis.title = @"Value";
    yAxis.enableGesturePanning = YES;
    yAxis.enableGestureZooming = YES;
    yAxis.enableMomentumPanning = YES;
    yAxis.enableMomentumZooming = YES;
    yAxis.title = @"Value";
    yAxis.style.titleStyle.position = SChartTitlePositionBottomOrLeft;
    chartView.yAxis = yAxis;
    chartView.userInteractionEnabled = YES;
    chartView.gesturePanType = SChartGesturePanTypeNone;

#2

Claus,

Did you take a look at my post on your previous thread?

Jan