CorePlot - How to add label to a limit band?

时间:2016-02-12 21:46:17

标签: ios core-plot

I am graphing data which has categorical ranges as follows:

Range --> Category

40-70 --> Low

70-110 --> Normal

110-140 --> High

CPTLimitBand works great for shading the different regions of a graph based on the data's categorical range, but I couldn't find any way to label a limit band. I would like to add a label to the limit band so that it is immediately obvious what category each shaded region represents.

I was unable to find anything on SO and the CorePlot API doesn't appear to explicitly support labeling limit bands, but perhaps I'm mistaken.

The graph will be resized for portrait and landscape orientations. The only workaround I could think of was adding a subview to the graphHostingView so that it sits behind the graph layer, but that doesn't seem ideal.

I've attached an image of how I would like to label the limiting bands.

Graph with labeled limit bands for Low, Normal, and High values

1 个答案:

答案 0 :(得分:0)

您可以使用绘图空间注释来标记限制带。使用CPTTextLayer作为注释的contentLayer