kaiserfarrell / core-plot

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

Text is not displaying while saving the graph as screenshot on retina display #516

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

 While saving the graph as an image on retina display,text is not coming properly,only graph is coming.Please help.

-(void)drawGraph
{
    // Create graph
    graph = [[CPTXYGraph alloc] initWithFrame: self.view.bounds];
    [self positionGraph:graph];
    [self performSelector:@selector(getAxisValue) onThread:[NSThread mainThread] withObject:nil waitUntilDone:YES];

    CPTGraphHostingView *hostingView = [[CPTGraphHostingView alloc]initWithFrame:self.view.bounds];
    hostingView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
    [self.view addSubview:hostingView];
    hostingView.hostedGraph = graph;

    graph.title = graphName;
    // 3 - Create and set text style
    CPTMutableTextStyle *titleStyle = [CPTMutableTextStyle textStyle];
    titleStyle.color = [CPTColor blueColor];
    titleStyle.fontName = @"Helvetica-Bold";
    titleStyle.fontSize = 30.0f;
    graph.titleTextStyle = titleStyle;
    graph.titlePlotAreaFrameAnchor = CPTRectAnchorTop;
    graph.titleDisplacement = CGPointMake(0.0f, 10.0f);

    // Setup plot space
    CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace;

    plotSpace.allowsUserInteraction = YES;
    plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(xLeftMostValue) length:CPTDecimalFromFloat(xRightMostValue-xLeftMostValue)];
    plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(yBottomMostValue) length:CPTDecimalFromFloat(yTopMostValue-yBottomMostValue)];

    [self configureXAxisForGraph:graph];
    [self configureYAxisForGraph:graph];

    CPTPlotSymbol *plotSymbol = [CPTPlotSymbol ellipsePlotSymbol];
    plotSymbol.fill = [CPTFill fillWithColor:[CPTColor greenColor]];
    plotSymbol.size = CGSizeMake(10.0, 10.0);
    graph.plotAreaFrame.masksToBorder = NO;
    [self positionPlotArea:graph.plotAreaFrame];

    CPTScatterPlot *dataSourceLinePlot = [[CPTScatterPlot alloc] init];
    dataSourceLinePlot.identifier=@"Line1";
    dataSourceLinePlot.dataSource = self;
    dataSourceLinePlot.plotSymbol = plotSymbol;
    [graph addPlot:dataSourceLinePlot toPlotSpace:plotSpace];

    if(numberOfDataSource == 2)
    {
        CPTScatterPlot *dataSourceLinePlot2 = [[CPTScatterPlot alloc] init];
        dataSourceLinePlot2.identifier=@"Line2";
        //Lines to color
        //Nandana chg 2 lines
        //dataSourceLinePlot2.dataLineStyle.lineWidth = 3.f;
//        dataSourceLinePlot2.dataLineStyle.lineColor = [CPTColor redColor];
        dataSourceLinePlot2.dataSource = self;
        dataSourceLinePlot2.plotSymbol = plotSymbol;
        [graph addPlot:dataSourceLinePlot2 toPlotSpace:plotSpace];
    }

    [self savePhotoOfView];

}

 -(void)savePhotoOfView
{
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    [[NSFileManager defaultManager] removeItemAtPath:[documentsDirectory stringByAppendingPathComponent:imageName] error:nil];

    // the path to write file
    NSString *myFile = [documentsDirectory stringByAppendingPathComponent:imageName];
    if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
        UIGraphicsBeginImageContextWithOptions(self.view.frame.size, NO, [[UIScreen mainScreen] scale]);
    } else {
        UIGraphicsBeginImageContext(self.view.frame.size);
    }
     [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    NSData *imageData = UIImagePNGRepresentation(image);
    [imageData writeToFile:myFile  atomically:YES];
}

What is the expected output? What do you see instead?
Only Graphs are coming but not any text.

What version of the product are you using? On what operating system?
Coreplot1.1/ios6.1/OSX 10.8/Xcode 4.6

Original issue reported on code.google.com by kandpa...@gmail.com on 13 Mar 2013 at 11:18

GoogleCodeExporter commented 8 years ago

Original comment by eskr...@mac.com on 14 Mar 2013 at 1:19

GoogleCodeExporter commented 8 years ago
Please find the screenshots also

Original comment by kandpa...@gmail.com on 14 Mar 2013 at 8:52

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by eskr...@mac.com on 16 Mar 2013 at 12:40

GoogleCodeExporter commented 8 years ago
This issue was closed by revision a36c1f0f042d.

Original comment by eskr...@mac.com on 17 Mar 2013 at 9:17