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

[CPTLegend legendWithPlots:] does not use retina graphics for plot symbols if plot is not part of the graph #523

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If you want to display symbols in your legend that are different to your plot 
you need to use [CPTLegend legendWithPlots:]. Unfortunately this does not work 
correctly on retina iPhone.

Steps to reproduce:
1. Using SimpleScatterPlot from the Coreplot Gallery create a dummy plot and 
assign a plot symbol with image fill like so:

    // Add plot symbols
    CPTPlotSymbol *plotSymbol = [CPTPlotSymbol ellipsePlotSymbol];
    UIImage *img = [UIImage imageNamed:@"graph-point-yellow"];
    plotSymbol.fill               = [CPTFill fillWithImage:[CPTImage imageWithCGImage:img.CGImage scale:img.scale]];
    plotSymbol.size               = CGSizeMake(21.0, 21.0);
    dataSourceLinePlot.plotSymbol = plotSymbol;

    CPTScatterPlot *dummyPlot = [[[CPTScatterPlot alloc] init] autorelease];
    dummyPlot.dataLineStyle = dataSourceLinePlot.dataLineStyle;
    dummyPlot.plotSymbol = plotSymbol;
    dummyPlot.identifier = @"Dummy";

    // Add legend
    //graph.legend                 = [CPTLegend legendWithGraph:graph];
    graph.legend                 = [CPTLegend legendWithPlots:@[dummyPlot]];

Expected vs actual output:
The legend will be displayed using the non retina plot symbol image. On retina 
devices it should use the correct @2x image.

What version of the product are you using? On what operating system?
CorePlot 1.1, iOS

Please provide any additional information below:
This does work if you add the dummy plot to the actual graph:
[graph addPlot:dummyPlot];
graph.legend = [CPTLegend legendWithPlots:@[dummyPlot]];

Original issue reported on code.google.com by imu...@gmail.com on 11 Apr 2013 at 9:58

GoogleCodeExporter commented 8 years ago
Please remove this duplicate, the formatting was incorrect so I created it 
again.

Original comment by imu...@gmail.com on 11 Apr 2013 at 10:01

GoogleCodeExporter commented 8 years ago

Original comment by eskr...@mac.com on 11 Apr 2013 at 11:06