Skip to main content

Setting background fill

Chart Background

All views have a common background fill.

  • in WinForms use chart. Background property
chart.Background.Color = Color.DarkBlue;
  • in WPF use chart. ChartBackground property
chart.ChartBackground.Color = Colors.DarkBlue;

The background fill (and Fill class in general) supports: solid, gradient and bitmap fills.

  • Solid color fills. Set GradientFill = Solid and use Color to define the color.
  • Gradient fills, going from Color to GradientColor. Set GradientFill = Linear / Radial / RadialStretched / Cylindrical. Use GradientDirection to control the fill direction in Linear and Cylindrical gradients.
chart.ChartBackground.GradientFill = GradientFill.Cylindrical;
chart.ChartBackground.GradientColor = Colors.Black;
chart.ChartBackground.GradientDirection = -45;
  • Bitmap fills, with different tiling and stretching options. Bitmap tint and alpha also are supported to, to make translucent bitmap fills.

Background Solid Setting background underneath ViewXY. GradientFill = Solid, and Color = DimGray.

Background Cylindrical Setting Background to gradient cylindrical, under GradientFill = Cylindrical, Color = Maroon, GradientColor = Black. GradientDirection = -45 degrees.

Background Bitmap Setting Background to tiled bitmap fill. Style = Bitmap, a picture set to Bitmap.Image, and Bitmap.Layout = Tile, under ViewPolar.

Setting transparent background

In WPF, the chart can be made appear transparent, so the objects placed underneath the chart will show through.

Set ChartBackground.Color = #00000000 (Black transparent).

note

Note! Do NOT set ‘Transparent’ (#00FFFFFF). It may not show through.

Background Transparent Transparent background in WPF chart

warning

WinForms does not support transparent background of controls.

Graph(XY) background

tip

Graph is the area where all grids, series, series cursors, event markers etc. are rendered.

In ViewXY GraphArea has own background. It is controlled by ViewXY. GraphBackground property. GraphBackground is the same Fill type as chart-background described above. Therefore, users can apply solid, gradient and bitmap fills. For example,

chart.ViewXY.GraphBackground.Color = Colors.DarkBlue;

There is one noticeable difference from chart-background. If user wants to make GraphBackground transparent, then one should set ViewXY.GraphBackground.Style to None

chart.ViewXY.GraphBackground.Style = RectFillStyle.None;

Background Transparent GraphBackground.Style is None, while ChartBackground.GradientFill is Linear between Crimson and Blue colors.