Spread Windows Forms 17
Spread Windows Forms 17.0 Product Documentation / Developer's Guide / Chart Control / Creating Charts / Advanced chart settings / Fill Effects
In This Topic
    Fill Effects
    In This Topic

    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 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,  use the BackWall property of the YPlotArea class to reference the Wall object and set the Fill property.

    Example

    The following example sets a fill effect for a bar chart. You can also set the fill effect before or after adding the data points if you set the fill effect for the entire series.

    C#
    Copy Code
    FarPoint.Win.Chart.BarSeries series = new FarPoint.Win.Chart.BarSeries();
    series.BarFill = new FarPoint.Win.Chart.SolidFill(Color.Red);
    series.Values.Add(2.0);
    series.Values.Add(4.0);
    series.Values.Add(3.0);
    series.Values.Add(5.0);
    FarPoint.Win.Chart.YPlotArea plotArea = new FarPoint.Win.Chart.YPlotArea();
    plotArea.Location = new PointF(0.2f, 0.2f);
    plotArea.Size = new SizeF(0.6f, 0.6f);
    plotArea.Series.Add(series);
    FarPoint.Win.Chart.ChartModel model = new FarPoint.Win.Chart.ChartModel();
    model.PlotAreas.Add(plotArea);
    fpChart1.Model = model;
    
    Visual Basic
    Copy Code
    Dim series As New FarPoint.Win.Chart.BarSeries()
    series.BarFill = New FarPoint.Win.Chart.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 FarPoint.Win.Chart.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 FarPoint.Win.Chart.ChartModel()
    model.PlotAreas.Add(plotArea)
    fpChart1.Model = model
    

    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
    FarPoint.Win.Chart.BarSeries series = new FarPoint.Win.Chart.BarSeries();
    series.Values.Add(2.0);
    series.Values.Add(4.0);
    series.BarFills.Add(new SolidFill(Color.Green));
    
    Visual Basic
    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))
    

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

    C#
    Copy Code
    FarPoint.Win.Chart.PointSeries series = new FarPoint.Win.Chart.PointSeries();
    series.PointFill = new FarPoint.Win.Chart.SolidFill(Color.Lime);
    series.PointBorder = new FarPoint.Win.Chart.SolidLine(Color.Red);
    series.PointMarker = new FarPoint.Win.Chart.BuiltinMarker(FarPoint.Win.Chart.MarkerShape.Triangle, 10.0f);
    series.Values.Add(2.0);
    series.Values.Add(4.0);
    series.Values.Add(3.0);
    series.Values.Add(5.0);
    
    Visual Basic
    Copy Code
    Dim series As New FarPoint.Win.Chart.PointSeries()
    series.PointFill = New FarPoint.Win.Chart.SolidFill(Color.Lime)
    series.PointBorder = New FarPoint.Win.Chart.SolidLine(Color.Red)
    series.PointMarker = New FarPoint.Win.Chart.BuiltinMarker(FarPoint.Win.Chart.MarkerShape.Triangle, 10.0F)
    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. Run the Chart Designer.
    2. Expand the target Plot Area from the tree menu on the left.
    3. Select Bar Chart Series and set BarFill or BarFills in the Appearance section in the property list on the right.
    4. Click OK and close the Chart Designer.
    For information on starting Chart Designer, refer to Chart Designer in the SPREAD Designer Guide.