SciChart WPF 2D Charts > 2D Chart Types > The Column Series Type
The Column Series Type

Column Series are provided by the FastColumnRenderableSeries type. This draws columns between the X-Y data-point and the ZeroLineY, a constant Y-value (defaults to zero).

Examples for the Column Series can be found in the SciChart WPF Examples Suite which can be downloaded from the SciChart Website or our SciChart.WPF.Examples Github Repository.

To declare a FastColumnRenderableSeries use the following code:

Declare a FastColumnRenderableSeries in Xaml / Code Behind

Declare a FastMountainRenderableSeries
Copy Code
<!-- where xmlns:s="http://schemas.abtsoftware.co.uk/scichart" -->
<s:SciChartSurface>

    <s:SciChartSurface.RenderableSeries>
       <s:FastColumnRenderableSeries x:Name="columnSeries" AntiAliasing="True"
                                        StrokeThickness="1"
                                        Stroke="White"
                                        Fill="OrangeRed"
                                        DataPointWidth="0.4"
                                        UseUniformWidth="False"
                                          ZeroLineY="0.0">
       </s:FastColumnRenderableSeries>
    </s:SciChartSurface.RenderableSeries>

    <!--  XAxis, YAxis omitted for brevity  -->

</s:SciChartSurface>

// Code Behind, e.g. in OnLoaded event handler, set the DataSeries
var dataSeries = new XyDataSeries<double, double>();
for(int i = 0; i < 100; i++)
       dataSeries.Append(i, Math.Sin(i*0.2));
columnSeries.DataSeries = dataSeries;

Declare a FastColumnRenderableSeries in Pure Code

Declare a FastColumnRenderableSeries
Copy Code
// Declare the scichartsurface
var sciChartSurface = new SciChartSurface();
// ...
// Declare and add a Column Series
var columnSeries = new FastColumnRenderableSeries()
{
    Stroke = Colors.White,
    Fill = new SolidColorBrush(Color.FromArgb(0x33, 0xFF, 0x66, 0x00)),
     StrokeThickness = 2,
    DataPointWidth = 0.4,
    UseUniformWidth = false,
    AntiAliasing = true,
    ZeroLineY = 0.0,
};
sciChartSurface.RenderableSeries.Add(columnSeries);

// Set some data
var dataSeries = new XyDataSeries<double, double>();
for(int i = 0; i < 100; i++)
    dataSeries.Append(i, Math.Sin(i*0.2));
columnSeries.DataSeries = dataSeries;

Specifying Column Width

Width of columns is controlled via the DataPointWidth property on FastColumnRenderableSeries.

The DataPointWidth can be interpreted as Relative or Absolute value. This is specified via the DataPointWidthMode property. The default value is DataPointWidthMode.Relative.

DataPointWidthMode.Relative means that DataPointWidth value is set in relative units. The value must fall into [0..1] range. Columns will not appear with DataPointWidth == “0”, while having DataPointWidth == “1” means that a column will occupy all the space available for a single column.

DataPointWidthMode.Relative
Copy Code
var columnSeries = new FastColumnRenderableSeries
{
    // DataPointWidthMode specifies that DataPointWidth is set in relative units
    DataPointWidthMode = DataPointWidthMode.Relative,
    DataPointWidth = 0.8,
    ...
};

DataPointWidthMode.Absolute means that DataPointWidth value is set in absolute units (pixels). This means that every column will be DataPointWidth pixels long:

DataPointWidthMode.Absolute
Copy Code
var columnSeries = new FastColumnRenderableSeries
{ 
    // DataPointWidthMode specifies that DataPointWidth is set in absolute units (pixels) 
    DataPointWidthMode = DataPointWidthMode.Absolute, 
  // Specifies that columns should be 45px wide
    DataPointWidth = 45, 
    ... 
};

 

NOTE: You can also declare RenderableSeries using full MVVM (series ViewModels). Please see MVVM DataSeries / RenderableSeries API for more details