我有一个饼图,使用数据源和委托(delegate)方法来绘制核心图,但是我现在尝试使用绑定(bind)并遇到了一些问题。
我使用以下代码绑定(bind)到数组 Controller :
[graph addPlot:pieChart];
// add bindings
NSLog(@"The arranged objects are: %@", [[[self sectorAllocation] arrangedObjects] valueForKey:@"sectorPercentage"]);
[pieChart bind:CPTPieChartBindingPieSliceWidthValues toObject:[self
sectorAllocation] withKeyPath:@"arrangedObjects.sectorPercentage"
options:nil];
//Set the sorting
[[self sectorAllocation] setSortDescriptors:[NSArray arrayWithObject:
[NSSortDescriptor sortDescriptorWithKey:@"sectorPercentage" ascending:YES]]];
它似乎被 updateNormalizedData 函数挂断了。根据我的 NSlog 语句,我的数组 Controller 返回正确的值,所以我不知道我做错了什么......有什么建议吗?
最佳答案
您在饼图中发现了一个错误。我刚刚修复了它并将更改推送到存储库。使用 Mercurial 拉取最新代码。如果您不想更新整个 Core Plot 库,请使用更改 here修补您的副本。
关于 cocoa 绑定(bind)和核心情节,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17912832/