0
我有一個核心繪圖圖,其中有價格數據。 x軸表示時間,而y表示價格。我已經確定了它的這個代碼將專門確定的空間刻度線之間:核心繪圖:使x軸刻度均勻分佈
CGFloat dateCount = [timestamps count];
NSMutableSet *xLabels = [NSMutableSet setWithCapacity:dateCount];
NSMutableSet *xLocations = [NSMutableSet setWithCapacity:dateCount];
float i = 0;
for (NSString *date in timestampStrings) {
CPTAxisLabel *label = [[CPTAxisLabel alloc] initWithText:date textStyle:x.labelTextStyle];
CGFloat location = i+=spaceBetweenXAxisTicks; // Here's where the space between is set
label.tickLocation = CPTDecimalFromCGFloat(location);
label.offset = x.majorTickLength;
if (label) {
[xLabels addObject:label];
[xLocations addObject:[NSNumber numberWithFloat:location]];
}
}
是否有某種方式來動態設置的空間之間,因此最後一跳打圖的右側?謝謝!
你只需要讓你的座標軸範圍爲你的座標標記間距的一個倍數,以便在一個抽搐中結束和結束。還把'+ ='部分作爲自己的行放在前一行,我從來沒有見過像這樣寫過,bug? –
@boyfarrell'+ ='似乎工作正常。 – Burrito411