0

我正在使用 Shinobi iOS 控件在我的应用程序中绘制折线图。我目前正在渲染严重的 0 值。结果图是这样的:

在此处输入图像描述

现在,问题是我所代表的数量是一种货币,所以它不能是负数。在这种特定情况下,如何将范围限制为从 0 开始?

这就是我创建图表的方式:

    // 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;
4

1 回答 1

0

yAxis.anchorPoint = @0;

设置它,它应该可以解决您的问题。

于 2013-11-29T09:37:48.353 回答