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. Image for the cookie policy date
close icon

Add stock indicators to chart in separate rows

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.


3 Replies

MK Muneesh Kumar G Syncfusion Team 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. 
 



RB Ronnie Barnard March 21, 2019 03:44 PM UTC

Great, that worked, had the wrong rows


MK Muneesh Kumar G Syncfusion Team 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 


Loader.
Live Chat Icon For mobile
Up arrow icon