我想在覈心圖中添加一個類似於以下圖片的數據指標線。核心圖問題:如何添加數據指標
Plot Image http://img203.imageshack.us/img203/9412/plota.png
任何想法如何能夠做到這一點使用核心情節。我剛剛開始瞭解核心情節,所以任何提示都會非常有用。
感謝
編輯:
爲了更好地理解我創建了一個截屏,顯示我的意思:
http://www.screencast.com/users/GauravVerma/folders/Jing/media/78fbef04-8785-46d6-9347-4f35d257109c
添加於2月26日:
我有solv通過使用兩個數據滑塊來解決部分問題。這裏是當前實現:
http://www.screencast.com/users/GauravVerma/folders/Jing/media/02a1e685-8bf8-41a9-aaa6-5ea6445f6a6c
我用了兩個dataplots,一個是主要的一個&另外一個地塊被重新裝載滑塊值更改時只有一個數據點。
這裏是我的數據源的方法(可能會幫助別人):
-(NSUInteger)numberOfRecordsForPlot:(CPPlot *)plot {
if ([(NSString *)plot.identifier isEqualToString:@"Blue Plot"]){
return [dataForPlot count];
}else {
return 1;
}
}
-(NSNumber *)numberForPlot:(CPPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index
{
if ([(NSString *)plot.identifier isEqualToString:@"Green Plot"]) {
index = floor((double)[slider value]);
if (index > [dataForPlot count] -1) {
index = [dataForPlot count] -1;
}
NSLog(@"Green plot index : %f",index);
}
NSNumber *num = [[dataForPlot objectAtIndex:index] valueForKey:(fieldEnum == CPScatterPlotFieldX ? @"x" : @"y")];
num = [NSNumber numberWithDouble:[num doubleValue] + 1.0];
return num;
}
現在唯一的問題仍然是要找出一個簡單的方法來畫線。有任何想法嗎 ??
您顯示的圖像中的哪個元素是「數據指標」? – 2010-02-24 17:33:46
紅線顯示當前值。當用戶移動滑塊時,紅線也會移動,顯示當前的數值。有關實現,請參閱Roambi應用程序(http://www.roambi.com/)的Cardex視圖 – 2010-02-25 05:09:45