pavan16 / core-plot

Automatically exported from code.google.com/p/core-plot
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Add annotation for single plot in CPTXYgraph #616

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,
I try to add annotation for a single point in my scatter plot graph. 
Coordinates of this point are calculate inside an own method and I apply a 
reloadData to refresh the graph.
So I add this code in numberForPlot method to create the annotation:

    CPTMutableTextStyle *textStyle = [[CPTMutableTextStyle alloc] init];
    textStyle.color = [CPTColor whiteColor];
    textStyle.fontName = @"Helvetica-Bold";
    textStyle.fontSize = 11.0f;
    CPTPlotSpaceAnnotation *annotZFW;
    CPTTextLayer *textAnnotZFW=[[CPTTextLayer alloc]initWithFrame:CGRectMake(0,0,30,10)];
    textAnnotZFW.textStyle=textStyle;
    textAnnotZFW.text=@"ZFW";
    annotZFW.contentLayer=textAnnotZFW;
    NSArray *anchorpoint=[NSArray arrayWithObjects:iZFW,mZFW,nil];
    annotZFW=[[CPTPlotSpaceAnnotation alloc]initWithPlotSpace:graph.defaultPlotSpace anchorPlotPoint:anchorpoint];
    [graph.plotAreaFrame.plotArea addAnnotation:annotZFW];

but there is no annotation for my single plot.
Can you help me and explain what is the way to do so?

Thanks,

Original issue reported on code.google.com by famille....@gmail.com on 2 Apr 2014 at 4:36

GoogleCodeExporter commented 8 years ago
What are iZFW and mZFW? Make sure they represent numbers within the xRange and 
yRange of the plot space.

Please ask questions like this on the discussion board 
(https://groups.google.com/forum/#!forum/coreplot-discuss).

This issue tracker is closed--new issues should be posted on Github 
(https://github.com/core-plot/core-plot/issues).

Original comment by eskr...@mac.com on 3 Apr 2014 at 12:32