gujjula / core-plot

Automatically exported from code.google.com/p/core-plot
0 stars 0 forks source link

Improve API for applying fills to regions of scatter plots #279

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The current implementation for applying fills to regions of scatter plots is 
limited: You can apply two separate fills, for two different base values. This 
allows you to have a fill above, and a fill below a scatter plot, for example. 
But if you want to have a different fill for when the plot goes below an axis, 
for example, you can't do that. You end up having to split the scatter plot 
into two separate plots.

It would be good if there was a system for filling regions of scatter plots 
that was flexible, and could handle all cases. Here is one suggestion:

Introduce a CPRegionFill class

@interface CPRegionFill : NSObject 
@property CPFill *fill;
@property NSDecimal baseDecimal;
@property CPRegion region;
@end

CPRegion is an enum 

typedef enum {
        CPRegionNone = 0,
    CPRegionAbove,
    CPRegionBelow,
    CPRegionAboveAndBelow
} CPRegion;

Scatter plot would need methods to add and remove the region fills

@interface CPScatterPlot
-(void)addRegionFill:(CPRegionFill *)fill;
-(void)removeRegionFill:(CPRegionFill *)fill;
@end

Drawing the regions would not be quite as easy as now. Some means of only 
drawing fill on the appropriate side of the scatter plot would be needed. In 
effect the intersection of two areas would need to be found. One masks the 
other. It may be possible to do this with Quartz 2D calls.

Original issue reported on code.google.com by drewmcco...@mac.com on 7 Apr 2011 at 7:46

GoogleCodeExporter commented 9 years ago
Moved to GitHub issue #13.

https://github.com/core-plot/core-plot/issues/13

Original comment by eskr...@mac.com on 29 Dec 2013 at 2:00