Xceed Chart for WinForms v4.4 Documentation
Appearance

Welcome to Xceed Chart for WinForms v4.4 > User Guide > Series > Series Attributes > Appearance

Each series derived from Series has an associated instance of an Appearance object controlling the filling and lines of the data points displayed by the series. It is accessible with the help of the Appearance property of the Series class.

VB.NET  
Dim appearance As Appearance =   series.Appearance
C#  
Appearance appearance = series.Appearance;

Controlling the Data Point Fill Effects

The filling mode of the data points is controlled by the FillMode property of the Appearance class. It is of type AppearanceFillMode and accepts the following values (for details, see AppearanceFillMode Enumeration):

Series
DataPoints

Predefined

By default it is set to Series. The following is a description of these modes:

VB.NET  

[Visual Basic]

bar.Add("10")

bar.Add("20")

bar.Add("40")

bar.BarFillEffect.SetSolidColor(Color.Green) ' make all bars green

C#  

bar.Add("10");

bar.Add("20");

bar.Add("40");

bar.BarFillEffect.SetSolidColor(Color.Green); // make all bars green

The series can also implement some built-in logic and use the filling of the data points to express it. This is the case of the Stock chart (see Stock Candle and Stock Stick), which paints the data points with user specified up and down fill effects (controlled by the UpFillEffect and DownFillEffect properties of the Stock Series object).

VB.NET  

bar.Appearace.FillEffects.Add(New FillEffect(Color.Red))

bar.Appearace.FillEffects.Add(New FillEffect(Color.Blue))

C#  

bar.Appearace.FillEffects.Add(new FillEffect(Color.Red));

bar.Appearace.FillEffects.Add(new FillEffect(Color.Blue));

and switch the Appearance fill mode to DataPoints

VB.NET  

bar.Appearance.FillMode = AppearanceFillMode.DataPoints

C#  

bar.Appearance.FillMode = AppearanceFillMode.DataPoints;

In the context of the code in point 1, the first bar will be painted in red, the second in blue, and the third again in red. If you want to display the third bar in green, you simply have to add another fill effect: 

VB.NET  

bar.Appearace.FillEffects.Add(New FillEffect(Color.Green))

C#  

bar.Appearace.FillEffects.Add(new FillEffect(Color.Green));

When a series filling appearance is defined in cycle mode, it is a good idea to use the series helper routines that require a FillEffect object. The following sample code will create a pie chart with different pie colors. 

VB.NET  

Dim pie As PieSeries = CType(Chart.Series, PieSeries)

Dim pie As PieSeries = CType(Chart.Series.Add(SeriesType.Pie), PieSeries)

pie.Appearance.FillMode = AppearanceFillMode.Cycle

pie.Add(12,"Apples",New FillEffect(Color.Red))

pie.Add(34,"Oranges",New FillEffect(Color.Green))

pie.Add(26,"Bananas",New FillEffect(Color.Blue))

C#  

PieSeries pie = (PieSeries)Chart.Series;

PieSeries pie = (PieSeries)Chart.Series.Add(SeriesType.Pie);

pie.Appearance.FillMode = AppearanceFillMode.Cycle;

pie.Add(12, "Apples", new FillEffect(Color.Red));

pie.Add(34, "Oranges", new FillEffect(Color.Green));

pie.Add(26, "Bananas", new FillEffect(Color.Blue));

VB.NET  

Dim bar As BarSeries = CType(Chart.Series.Add(SeriesType.Bar), BarSeries)

bar.Appearance.FillMode = AppearanceFillMode.Predefined

pie.Add(12)

pie.Add(34)

pie.Add(26)

C#  

BarSeries bar = (BarSeries)Chart.Series.Add(SeriesType.Bar);

bar.Appearance.FillMode = AppearanceFillMode.Predefined;

pie.Add(12);

pie.Add(34);

pie.Add(26);

Controlling the Data Point Line Properties

Data point line properties are analogously controlled by the LineMode property of the Appearance class. It is of type AppearanceLineMode and accepts the following values (for details, see AppearanceLineMode Enumeration): 

Series
DataPoints
Predefined

The Control

The control implements the exact same logic to determine the line properties as is used for a particular data point. When LineMode is set to  DataPoints, the LineProperties objects are extracted from a data series containing LineProperties objects, which is accessible from the LineProperties property of the Appearance object. 

Related Examples

Windows Forms: Series Attributes\Appearance

See Also

Series | Appearance