iphone - How to add a label to a plot -
i have core-plot graph this:
graph http://img413.imageshack.us/img413/8347/img0157h.jpg
how can add label each of these plots. have seen references adding cptextlayer graph, not figure out how it. there example can point me to?
i able add 3 labels top of graph this:
cptextstyle *textstyle1 = [cptextstyle textstyle]; textstyle1.color = [cpcolor bluecolor]; textstyle1.fontsize = 14; cptextstyle *textstyle2 = [cptextstyle textstyle]; textstyle2.color = [cpcolor greencolor]; textstyle2.fontsize = 14; cptextstyle *textstyle3 = [cptextstyle textstyle]; textstyle3.color = [cpcolor redcolor]; textstyle3.fontsize = 14; cptextlayer *layer1 = [[[cptextlayer alloc] initwithtext:[nsstring stringwithformat:@"text1"]] autorelease]; cptextlayer *layer2 = [[[cptextlayer alloc] initwithtext:[nsstring stringwithformat:@"text2"]] autorelease]; cptextlayer *layer3 = [[[cptextlayer alloc] initwithtext:[nsstring stringwithformat:@"text3"]] autorelease]; layer1.bounds = cgrectmake(-75,2,20,10); layer1.textstyle = textstyle1; layer2.bounds = cgrectmake(-130,2, 20,10); layer2.textstyle = textstyle2; layer3.bounds = cgrectmake(-190,2, 20,10); layer3.textstyle = textstyle3; cplayerhostingview * newview = [[cplayerhostingview alloc]initwithframe:[[uiscreen mainscreen] applicationframe]]; newview.hostedlayer = graph; nsinteger count = [graph.sublayers count]; [graph insertsublayer:layer1 atindex: count + 1]; [graph insertsublayer:layer2 atindex: count + 2]; [graph insertsublayer:layer3 atindex: count + 3]; self.view = newview; [newview release];
Comments
Post a Comment