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

CPTFill fillWithImage does not work as expected #479

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Create a background limit band and fill it with an image.  Result: the image is 
not displayed in the correct position, but rather offset.  The offset changes 
as you pan the graph around.  Also the image appears to be stretched.  Here is 
my code.

    UIImage *gradientBkgd = [UIImage imageNamed:@"LightGrayGradientBackgd"];
    CPTFill *bandYAxis = [CPTFill fillWithImage:[CPTImage imageWithCGImage:gradientBkgd.CGImage]];
    [yAxis addBackgroundLimitBand:[CPTLimitBand limitBandWithRange:[CPTPlotRange plotRangeWithLocation:CPTDecimalFromInt(0) length:CPTDecimalFromInt(-50)] fill:bandYAxis]];

Original issue reported on code.google.com by tony....@netbrains.com on 20 Nov 2012 at 10:40

GoogleCodeExporter commented 8 years ago
You may need to adjust some of the properties of the CPTImage before using it 
to build the CPTFill. Look into the scale, tiled, and tileAnchoredToContext 
properties.

Original comment by eskr...@mac.com on 21 Nov 2012 at 1:46

GoogleCodeExporter commented 8 years ago
I tried all possible options.  The axis band is drawn differently, but still 
incorrectly.

Original comment by tony....@netbrains.com on 26 Nov 2012 at 5:54

GoogleCodeExporter commented 8 years ago
Can you post a screenshot?

Original comment by eskr...@mac.com on 27 Nov 2012 at 2:35

GoogleCodeExporter commented 8 years ago
I have an image, size 320x30.  I want it on screen the same size.  I set 
scale=1 and it looks bad, regardless of tiled and tileAnchoredToContext.  Then 
I tried playing with the scale and found that setting scale = 2.0 works 
perfectly.  But why?  Even after I change the plot view's limits, scale=2 
works.  What exactly does scale measure?

Original comment by tony....@netbrains.com on 27 Nov 2012 at 7:11

GoogleCodeExporter commented 8 years ago
The image scale is designed to support Retina images. Set it to 2.0 for a 
Retina (double resolution) image and 1.0 otherwise.

Original comment by eskr...@mac.com on 28 Nov 2012 at 1:56

GoogleCodeExporter commented 8 years ago
It appears that the image scale is for Retina DEVICE, not image.  My image is 
320 pixels wide, which is a non-Retina image.  If I run it on a Retina device, 
I need to set scale=2.  When on a non-Retina device, I need to set scale=1.

Original comment by tony....@netbrains.com on 28 Nov 2012 at 6:38

GoogleCodeExporter commented 8 years ago
Exactly.

Original comment by eskr...@mac.com on 29 Nov 2012 at 1:14