aks.knit1108
aks.knit1108

Reputation: 1305

How to fill graph area with Color

I am trying to plot graph in which i want to fill graph area with custom color. But the color should be below only data lines which i have used to draw line graph and the remaining part should be as such.

Upvotes: 10

Views: 3784

Answers (2)

Eric Skroch
Eric Skroch

Reputation: 27381

Set the areaBaseValue and areaFill properties. The base value is the lower boundary of the filled area. This is normally set to the location value of the yRange so that the fill starts at the bottom of the plot area, but it doesn't have to be. The fill can be any CPTFill—a solid color (with optional transparency), an image, or a gradient. For example:

plot.areaFill = [CPTFill fillWithColor:[CPTColor redColor]];
plot.areaBaseValue = CPTDecimalFromInteger(0);

Upvotes: 13

sch
sch

Reputation: 27506

You have to draw (fill) the graph as a closed path with a fill color.

Then, if you also want to have the graph drawn with a stroke, you can redraw (stroke) only the path that defines the lines of the graph with a stroke color.

Upvotes: 0

Related Questions