WPF Charting Documentation - SciChart WPF Charts SDK v5.x
SciStockChart - Simplified Financial Charts

SciStockChart – Simplified WPF Stock Charts

What is SciStockChart?

SciStockChart is a control which inherits SciChartSurface, and adds some default (less flexible) configuration, so you don’t have to write so much code in the case that you want a stock-chart like control in your application.

Example 2D Charts > Create Stock Charts > Using SciStockChart shows how to declare this control

Wherever you see SciStockChart in our exmaples, you can substitute a SciChartSurface, but you will have to configure the Axis and Modifiers yourself.

Declaring a SciStockChart in XAML

To declare a SciStockChart in XAML, use the following code:

Declaring a SciStockChart
Copy Code
<!--  Create the SciStockChart. In the code-behind we append data and add series  -->
<s:SciStockChart x:Name="StockChart" Grid.Column="1">

   <!--  Override any property of the built-in CategoryDateTimeAxis here  -->
   <s:SciStockChart.XAxisStyle>
      <Style TargetType="s:CategoryDateTimeAxis">
         <Setter Property="DrawMinorGridLines" Value="True"/>
         <Setter Property="DrawMajorGridLines" Value="True"/>
         <Setter Property="DrawMajorBands" Value="True"/>
         <Setter Property="MinorsPerMajor" Value="5"/>
         <Setter Property="TextFormatting" Value="dd MMM yyyy"/>
         <Setter Property="GrowBy" Value="0, 0.1"/>
      </Style>
   </s:SciStockChart.XAxisStyle>

   <!--  Override any property of the built-in NumericAxis here  -->
   <s:SciStockChart.YAxisStyle>
      <Style TargetType="s:NumericAxis">
         <Setter Property="DrawMinorGridLines" Value="True"/>
         <Setter Property="DrawMajorGridLines" Value="True"/>
         <Setter Property="DrawMajorBands" Value="False"/>
         <Setter Property="MinorsPerMajor" Value="5"/>
         <Setter Property="TextFormatting" Value="0.0000"/>
      </Style>
   </s:SciStockChart.YAxisStyle>

   <s:SciStockChart.RenderableSeries>
      <s:FastCandlestickRenderableSeries AntiAliasing="False"/>
   </s:SciStockChart.RenderableSeries>
</s:SciStockChart>

Configuring the Axis on a SciStockChart

The SciStockChart automatically creates a CategoryDateTimeAxis for an XAxis, and a NumericAxis for YAxis. You can change any of the properties on the axis via the SciStockChart.XAxisStyle and SciStockChart.YAxisStyle properties above.

NOTE: For detailed information about how to configure the axis, please see Axis APIs

Configuring the Zoom, Pan and Tooltip Interaction on a SciStockChart

SciStockChart automatically creates the following Chart Modifiers. These can be enabled or disabled as follows:

Modifier

Bound to

XAxisDragModifier

Always enabled

YAxisDragModifier

Always enabled

ZoomPanModifier

IsEnabled bound to SciStockChart.IsPanEnabled

LegendModifier

IsEnabled bound to SciStockChart.ShowLegend

LegendData exposed via SciStockChart.LegendSource

Style bound to SciStockChart.LegendStyle

CursorModifier

IsEnabled bound to SciStockChart.IsCursorEnabled

RolloverModifier

IsEnabled bound to SciStockChart.IsRolloverEnabled

RubberBandXyZoomModifier

IsEnabled bound to SciStockChart.IsRubberBandZoomEnabled

MouseWheelZoomModifier

Always enabled

ZoomExtentsModifier

Always enabled. Executes on Mouse Double Click

SeriesValueModifier

IsEnabled bound to SciStockChart.IsAxisMarksEnabledIndividual series can be disabled via SeriesValueModifier.IncludeSeries attached property

Some of the modifiers can be styled, e.g via SciStockChart.LegendStyle allows you to apply a style directly to the LegendModifier created by the SciStockChart.

Some of them don’t expose styles, but you can still use implicit (unnamed) styles to affect modifiers that are children of SciStockChart.

Adding / Removing Series with a SciStockChart

The methods are exactly the same as with SciChartSurface. You can either add RenderableSeries in XAML, in code or use a SeriesBinding in MVVM.

Why not just use a SciChartSurface?

Well, you can, the flexibility is there if you use a SciChartSurface, but for some use-cases SciStockChart will suffice and requires significantly less coding. 

 

 


SCICHART ® is a Registered Trademark in the UK, US and EU. Copyright SciChart Ltd 2011-2018.

Email us to give feedback!