Spread Windows Forms 10.0 Product Documentation
Fill Effects

A fill effect is when the interior of an object is painted. Two types of fill effects are solid and gradient. A solid fill effect uses a single color and a gradient fill uses two colors and a direction. The elements in the chart that can have fill effects are label, legend, wall, stripe, and the chart itself.

The following fill effects are available in the Fill class:

You can fill elements using the Fill property in the following classes:

To set the fill effect for the entire plot area, you can set the Fill property of the wall for the plot area. For example, for a y-plot, you can set the fill of the wall set by the BackWall property in the YPlotArea class.

Using Code

Use properties to set fill effects.

Example

The following example sets a fill effect for a bar.

C#
Copy Code
BarSeries series = new BarSeries();
series.BarFill = new SolidFill(Color.Red);
series.Values.Add(2.0);
series.Values.Add(4.0);
series.Values.Add(3.0);
series.Values.Add(5.0);
YPlotArea plotArea = new YPlotArea();
plotArea.Location = new PointF(0.2f, 0.2f);
plotArea.Size = new SizeF(0.6f, 0.6f);
plotArea.Series.Add(series);
ChartModel model = new ChartModel();
model.PlotAreas.Add(plotArea);
fpChart1.Model = model; 
VB
Copy Code
Dim series As New FarPoint.Win.Chart.BarSeries()
series.BarFill = New SolidFill(Color.Red)
series.Values.Add(2.0)
series.Values.Add(4.0)
series.Values.Add(3.0)
series.Values.Add(5.0)
Dim plotArea As New YPlotArea()
plotArea.Location = New PointF(0.2F, 0.2F)
plotArea.Size = New SizeF(0.6F, 0.6F)
plotArea.Series.Add(series)
Dim model As New ChartModel()
model.PlotAreas.Add(plotArea)
fpChart1.Model = model 

Using Code

Use properties to set fill effects.

Example

You can set the fill effect before or after adding the data points if you set the fill effect for the entire series.

C#
Copy Code
BarSeries series = new BarSeries();
series.BarFill = new SolidFill(Color.Red);
series.Values.Add(2.0);
\\ OR
BarSeries series = new BarSeries();
series.Values.Add(2.0);
series.BarFill = new SolidFill(Color.Red); 
VB
Copy Code
Dim series As New FarPoint.Win.Chart.BarSeries()
series.BarFill = New SolidFill(Color.Red)
series.Values.Add(2.0)
' OR
Dim series As New FarPoint.Win.Chart.BarSeries()
series.Values.Add(2.0)
series.BarFill = New SolidFill(Color.Red) 

Using Code

Use properties to set fill effects.

Example

If you set the fill effect for a single data point, then you need to assign the fill effect after you add the data point, so there is a data point to store the fill effect in. For example:

C#
Copy Code
BarSeries series = new BarSeries();
series.Values.Add(2.0);
series.Values.Add(4.0);
series.BarFills.Add(new SolidFill(Color.Green)); 
VB
Copy Code
Dim series As New FarPoint.Win.Chart.BarSeries()
series.Values.Add(2.0)
series.Values.Add(4.0)
series.BarFills.Add(New SolidFill(Color.Green)) 

Using Code

Use properties to set fill effects.

Example

You can assign fill effects for lines and markers as well. For example:

C#
Copy Code
PointSeries series = new PointSeries();
series.PointFill = new SolidFill(Color.Lime);
series.PointBorder = new SolidLine(Color.Red);
series.PointMarker = new BuiltinMarker(MarkerShape.Triangle, 10.0f);
series.Values.Add(2.0);
series.Values.Add(4.0);
series.Values.Add(3.0);
series.Values.Add(5.0); 
VB
Copy Code
Dim series As New PointSeries()
series.PointFill = New SolidFill(Color.Lime)
series.PointBorder = New SolidLine(Color.Red)
series.PointMarker = New BuiltinMarker(MarkerShape.Triangle, 10F)
series.Values.Add(2.0)
series.Values.Add(4.0)
series.Values.Add(3.0)
series.Values.Add(5.0) 

Using the Chart Designer

  1. Select the Fill option.
  2. Set properties as needed.

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback