SetTwoColorGradient Method

Microsoft Office Web Components Object Model

Show All

SetTwoColorGradient Method

       

Fills the specified ChInterior object with a two-color gradient.

expression.SetTwoColorGradient(GradientStyle, GradientVariant, Color, BackColor)

expression   Required. An expression that returns a ChInterior object.

GradientStyle  Required ChartGradientStyleEnum. The gradient style.

ChartGradientStyleEnum can be one of these ChartGradientStyleEnum constants.
chGradientDiagonalDown
chGradientDiagonalUp
chGradientFromCenter
chGradientFromCorner
chGradientHorizontal
chGradientVertical

GradientVariant  Required ChartGradientVariantEnum. The gradient variant. If GradientStyle is chGradientFromCenter, the GradientVariant argument can only be chGradientVariantStart or chGradientVariantEnd.

ChartGradientVariantEnum can be one of these ChartGradientVariantEnum constants.
chGradientVariantCenter
chGradientVariantEdges
chGradientVariantEnd
chGradientVariantStart

Color  Optional Variant. The foreground color of the gradient. You can use either a Long value representing a red-green-blue color value or a String value naming a valid HTML color value. In Microsoft Visual Basic, you can use the RGB function to create a red-green-blue color value (for example, red is RGB(255,0,0)). If omitted, the Color property is used to determine the foreground color.

BackColor  Optional Variant. The background color of the gradient. You can use either a Long value representing a red-green-blue color value or a String value naming a valid HTML color value. In Microsoft Visual Basic, you can use the RGB function to create a red-green-blue color value (for example, red is RGB(255,0,0)). If omitted, the BackColor property is used to determine the foreground color.

Example

This example sets the interior fill of the first two series and the plot area of the first chart in ChartSpace1.

Sub Format_Interior_Fills()

    Dim chConstants
    Dim serSeries1
    Dim serSeries2

    Set chConstants = ChartSpace1.Constants

    Set serSeries1 = ChartSpace1.Charts(0).SeriesCollection(0)
    Set serSeries2 = ChartSpace1.Charts(0).SeriesCollection(1)

    ' Set the interior fill of the first series to a two-color gradient.
    serSeries1.Interior.SetTwoColorGradient chConstants.chGradientDiagonalDown, _
              chConstants.chGradientVariantCenter, "Blue", "Silver"

    ' Set the interior fill of the second series to a solid color.
    serSeries2.Interior.SetSolid "Purple"

    ' Set the interior fill of the plot area to a preset texture.
    ChartSpace1.Charts(0).PlotArea.Interior.SetTextured _
              chConstants.chTextureParchment, chConstants.chTile

End Sub