2017-06-01 7 views
0

https://www.dropbox.com/s/8fqez61k9jhnoa4/Screen%20Shot%202017-06-01%20at%201.04.25%20PM.png?dl=0yAchse schneiden in Shinobi iOS-Diagramm

  • (void) {createBurnoutChart

    // Erstellen Sie das Diagramm (falls erforderlich) if (burnoutChart == null) {off if (UI_USER_INTERFACE_IDIOM () == UIUserInterfaceIdiomPad)

     burnoutChart = [[ShinobiChart alloc] initWithFrame:CGRectMake(0, 270, 768,725)]; // iPad 
    else 
    
        burnoutChart = [[ShinobiChart alloc] initWithFrame:CGRectMake(0, 165, 320,290)]; // iPhone 
    
    // Set a different theme on the chart 
    SChartMidnightTheme *midnight = [[SChartMidnightTheme alloc] init]; 
    [burnoutChart setTheme:midnight]; 
    
    //As the chart is a UIView, set its resizing mask to allow it to automatically resize when screen orientation changes. 
    burnoutChart.autoresizingMask = ~UIViewAutoresizingNone; 
    
    // Initialise the data source we will use for the chart 
    burnoutDatasource = [[LineChartDataSource alloc] initWithFileName:LineChartSource_Burnout seriesCount:1]; 
    
    // Give the chart the data source 
    burnoutChart.datasource = burnoutDatasource; 
    
    // Create a date time axis to use as the x axis. 
    SChartDateTimeAxis *xAxis = [[SChartDateTimeAxis alloc] init]; 
    
    // Enable panning and zooming on the x-axis. 
    xAxis.enableGesturePanning = YES; 
    xAxis.enableGestureZooming = YES; 
    xAxis.enableMomentumPanning = YES; 
    xAxis.enableMomentumZooming = YES; 
    xAxis.axisPositionValue = [NSNumber numberWithInt: 0]; 
    
    // And allow them to scroll past the default range 
    xAxis.allowPanningOutOfMaxRange = YES; 
    xAxis.allowPanningOutOfDefaultRange = YES; 
    
    // Make the frequency of tick marks be one day 
    SChartDateFrequency *freq = [[SChartDateFrequency alloc] initWithDay:1]; 
    xAxis.majorTickFrequency = freq; 
    
    burnoutChart.xAxis = xAxis; 
    
    //Create a number axis to use as the y axis. 
    //TODO:Checkback 
    NSNumber *lowRange = [[NSNumber alloc] initWithInteger:0]; 
    NSNumber *highRange = [[NSNumber alloc] initWithInteger:100]; 
    
    SChartNumberRange *yRange = [[SChartNumberRange alloc] initWithMinimum:lowRange andMaximum:highRange]; 
    SChartNumberAxis *yAxis = [[SChartNumberAxis alloc] initWithRange:yRange ]; 
    
    //Enable panning and zooming on Y 
    yAxis.enableGesturePanning = YES; 
    yAxis.enableGestureZooming = YES; 
    yAxis.enableMomentumPanning = YES; 
    yAxis.enableMomentumZooming = YES; 
    

    // yAxis.axisPositionValue = [NSNumber numberWithInt: 0];

    // And allow them to scroll past the default range 
    yAxis.allowPanningOutOfMaxRange = NO; 
    yAxis.allowPanningOutOfDefaultRange = NO; 
    
    
    burnoutChart.yAxis.defaultRange; 
    burnoutChart.yAxis = yAxis; 
    
    //Set the chart title 
    burnoutChart.title = @""; 
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 
        burnoutChart.titleLabel.font = [UIFont fontWithName:@"TrebuchetMS" size:27.0f]; 
    } else { 
        burnoutChart.titleLabel.font = [UIFont fontWithName:@"TrebuchetMS" size:17.0f]; 
    } 
    burnoutChart.titleLabel.textColor = [UIColor whiteColor]; 
    
    
    // If you have a trial version, you need to enter your licence key here: 
    // chart.licenseKey = @""; 
    
    // Add the chart to the view controller 
    [self.viewBurnoutChart addSubview:burnoutChart]; 
    

    }

    // Stellen Sie sicher, dass wir die neuesten Daten NSInteger lastScore = [burnoutDatasource reReadData] erhalten; [self vasBurnoutBild: lastScore]; [self vasBurnoutScore: lastScore]; [burnoutChart reloadData]; [burnoutChart neu zeichnenChartAndGL: YES];

    // ***** Wichtig für das Zurücksetzen des sichtbaren Teils..wenn ich es jemals bekomme //[burnoutChart.xAxis resetZoomLevel]; es hält genau an dem 100 Grenzbereich }

Die Grafik zeigt gut, aber wenn es um die yAchse kommt. Ich möchte mehr Intervalle zeigen, damit es nicht aussieht, als wäre es abgeschnitten.

Antwort

0

Es gibt zwei Möglichkeiten, wie Sie dies erreichen können:

  • Wenn Sie manuell den Bereich für die Achse einstellen möchten (wie Sie gerade tun), dann einfach den Bereich erhöhen z.B. bis 103. Die Tickbeschriftungen sollten nicht betroffen sein.
  • Wenn Sie den Bereich durch das Diagramm bestimmen lassen möchten, können Sie mithilfe der Eigenschaft rangePaddingHigh anpassen, wie viel Abstand zum berechneten Bereich hinzugefügt wird.

Ich hoffe, dass hilft!

+0

Danke, es hat funktioniert! –