のためのカスタムラベルを提供します。私は、データソースと凡例のタイトルメソッドをviewControllerに持っています。これは棒グラフをインスタンス化し、デリゲートとして自身を設定します。コアプロット1.0:私は<strong>CorePlot</strong> 1.0を使用していますが、(サブクラス化XYGraphである)私の<strong>棒グラフ</strong>に<strong>伝説</strong>を追加したいと思い伝説
私は、異なる代理人と伝説のセットアップでかなりの時間を費やしましたが、私のエラーは見つかりませんでした。私が間違いを犯した可能性がある箇所について私は何かヒントを教えてください。
私は次のように棒グラフを生成するXYGraphをサブクラス化している次のように私の実装.Mで
.h
@interface BarLineChart : CPTXYGraph
@property (strong, nonatomic) id <CPTPlotDataSource, CPTBarPlotDataSource, CPTBarPlotDelegate, CPTPlotSpaceDelegate> delegate;
@end
、私は伝説を設定します。
// Add legend
CPTLegend *legend = [CPTLegend legendWithGraph:self];
legend.fill = [CPTFill fillWithColor:[CPTColor colorWithGenericGray:0.15]];
legend.borderLineStyle = axisLineStyle;
legend.cornerRadius = 10.0;
legend.swatchSize = CGSizeMake(16.0, 16.0);
CPTMutableTextStyle *legendTextStyle = [CPTMutableTextStyle textStyle];
legendTextStyle.color = [CPTColor whiteColor];
legendTextStyle.fontSize = 10.0;
legend.textStyle = legendTextStyle;
legend.rowMargin = 1.0;
legend.numberOfRows = 3;
legend.paddingLeft = 10.0;
legend.paddingTop = 10.0;
legend.paddingRight = 10.0;
legend.paddingBottom = 10.0;
legend.delegate = self.delegate;
self.legend = legend;
self.legendAnchor = CPTRectAnchorTop;
self.defaultPlotSpace.delegate = self.delegate;
私は別のviewControllerにデータソースメソッドを保持しています。そのために、デリゲートを設定しています(self.delegateに格納されています)。 この私のViewControllerのインターフェイスされています
`@interface FinstatViewController : CompanyViewController <UITableViewDelegate, UITableViewDataSource, UISplitViewControllerDelegate, UIPopoverControllerDelegate, CompanyPresenter, ChartSelectionDelegate, CPTPlotDataSource, CPTBarPlotDataSource, CPTBarPlotDelegate, CPTPlotSpaceDelegate, CPTLegendDelegate, CPTScatterPlotDataSource, CPTScatterPlotDelegate>`
マイデータソースメソッドプロットデータを取得するためには、正常に動作しますが、凡例のタイトル方法
-(NSString *)legendTitleForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)index
が呼び出されることはありません。
これに関する解決方法はありますか?私も同様の問題があります – SPatil