We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Add stock indicators to chart in separate rows

Thread ID:

Created:

Updated:

Platform:

Replies:

143420 Mar 19,2019 08:29 PM UTC Mar 22,2019 03:07 PM UTC WPF 3
loading
Tags: SfChart
Ronnie Barnard
Asked On March 19, 2019 08:41 PM UTC

I would like to create the following graph in WPF (the image is from the Asp.Net example).

I created the Candle series using SfChart, and added the Volume at the bottom in the same way the Stock Chart demo shows, but for the life of me, I cannot get the Indicators to show up in their own Row below the candle series, it overlays.

Can someone please show me the right way to do that in WPF.


Muneesh Kumar G [Syncfusion]
Replied On March 21, 2019 11:21 AM UTC

Hi Ronnie, 
 
Greetings from Syncfusion, we have analyzed your requirement and you can achieve this by adding multiple rows in SfChart and set position for each axis as per the below code snippet.  
 
Code snippet 
   <chart:SfChart x:Name="financialChart"  
                      Margin="10"> 
             
            <chart:SfChart.DataContext> 
                <local:ViewModel/> 
            </chart:SfChart.DataContext> 
             
            <chart:SfChart.RowDefinitions> 
                <chart:ChartRowDefinition/> 
                <chart:ChartRowDefinition/> 
            </chart:SfChart.RowDefinitions> 
             
            <chart:SfChart.PrimaryAxis> 
                
                <chart:CategoryAxis HeaderTemplate="{StaticResource headerTemplate}"  
                                    Header="Date" LabelFormat="MM/dd/yyyy"  
                                    LabelTemplate="{StaticResource labelTemplate}" 
                                    AxisLineStyle="{StaticResource axisStyle}"  
                                    MajorTickLineStyle="{StaticResource axisStyle}"/> 
            </chart:SfChart.PrimaryAxis> 
             
            <chart:SfChart.SecondaryAxis> 
                <!--1st Row--> 
                <chart:NumericalAxis StartRangeFromZero="False"  
                                     x:Name="axis2" Header="Stock Price"   
                                   OpposedPosition="True" chart:ChartBase.Row="1"/> 
            </chart:SfChart.SecondaryAxis> 
             
            <chart:CandleSeries Name="series" ItemsSource="{Binding StockPriceDetails}"  
                                XBindingPath="Date"  High="High" Open="Open"     
                                Close="Close" Low="Low"   
                                Label="Candleseries" ShowTooltip="True"  
                                chart:ChartTooltip.EnableAnimation="True"/> 
            <chart:SfChart.TechnicalIndicators> 
                <chart:TriangularAverageIndicator   
                                ItemsSource="{Binding StockPriceDetails}"  
                                XBindingPath="Date"  High="High" Open="Open"   
                                Close="Close" Low="Low"  
                                                     > 
                    <chart:TriangularAverageIndicator.YAxis> 
                        <!--0th Row--> 
                        <chart:NumericalAxis OpposedPosition="True"/> 
                    </chart:TriangularAverageIndicator.YAxis> 
                </chart:TriangularAverageIndicator> 
            </chart:SfChart.TechnicalIndicators> 
 
        </chart:SfChart> 
 
 
Screenshot:  
 
 
 
Please let us know if you have any queries.  
 
Thanks, 
Muneesh Kumar G. 
 


Ronnie Barnard
Replied On March 21, 2019 03:44 PM UTC

Great, that worked, had the wrong rows

Muneesh Kumar G [Syncfusion]
Replied On March 22, 2019 04:19 AM UTC

Hi Ronnie, 
 
Thanks for the update. 
  
We are glad to know that the given solution works. Please let us know if you need any further assistance. 
 
Thanks, 
Muneesh Kumar G 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;