0
我使用Shinobi iOS控件在我的應用程序中繪製折線圖。我目前正在渲染一個嚴重的0值。結果圖是這樣的:Shinobi限制軸範圍值iOS圖表
現在的問題是,我代表數量的貨幣,因此不能爲負數。在這種特定情況下,我如何限制範圍從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;
我使用了一個簡單的ShinobiChart子類。通常範圍始終在最低和最高值之間。現在圖表反應是這樣的,因爲在這種情況下沒有提供極端值,但我更願意將最低極值設置爲0. – Claus
您是對的......完成:) – Claus
當您初始化yAxis SChartNumberAxis時可以嘗試使用具有適當SChartNumberRange的initWithRange:instance方法。 –