Period Selector

Hi,
I'm using the Stock Chart control with several defined periods and the period selector enabled. Is there some way to detect when the user has selected a different period, and find out which period is currently active? I tried catching the RangeChange event, since that is automatically triggered whenever a different period is selected, but when I access the Periods property of the SfStockChart object, and try to search for one where Selected == true, it only finds the period that I enabled by default, and it doesn't seem to ever change, even if I click on a different one. The reason why I need to do this is because I want to load a different data set for the chart based on which period is selected - for example if the user selects "1m", I want to load data where the interval between each candle is 1 minute, if the user selects "1D" then the interval is 1 day and so on.

3 Replies 1 reply marked as answer

BP Baby Palanidurai Syncfusion Team April 6, 2021 03:53 PM UTC

Hi Daniel,

Greetings from Syncfusion.

We are checking your requirement and we will update you further details on 8th April 2021. We appreciate your patience untill then.

Regards,
Baby.


BP Baby Palanidurai Syncfusion Team April 8, 2021 11:35 AM UTC

Hi Daniel, 
 
 
Thanks for your patience. 
 
We have considered your requirement, and we will implement an event to get period information based on selected.  We will include it in our next service pack release which is expected to be rolled out in the middle of May 2021. 
 
Please find the below feedback link, 
 
 
Regards, 
Baby. 



SM Srihari Muthukaruppan Syncfusion Team May 20, 2021 09:58 AM UTC

Hi Daniel, 
  
We are glad to announce that our v19.1.64 patch release is rolled out, we have added the fix for the reported scenario. And you can use the latest (19.1.64) Syncfusion.EJ2.Blazor NuGet package version to get rid of the reported issue.  
 
Code Snippet: 
// add your additional code here 
@using Syncfusion.Blazor.Charts 
 
<SfStockChart>
<StockChartEvents PeriodChanged="StockChartPeriodChanged"></StockChartEvents>
<StockChartSeriesCollection>
<StockChartSeries DataSource="@StockDetails" Type="ChartSeriesType.Column" XName="Date" YName="Y">
</StockChartSeries>
</StockChartSeriesCollection>
</SfStockChart>
 
@code {
public class ChartData
{
public DateTime Date { get; set; }
public Double Y { get; set; }
}
 
public List<ChartData> StockDetails = new List<ChartData>
{
new ChartData { Date = new DateTime(2012, 04, 02), Y= 100},
new ChartData { Date = new DateTime(2012, 04, 09), Y= 10 },
new ChartData { Date = new DateTime(2012, 04, 16), Y= 500},
new ChartData { Date = new DateTime(2012, 04, 23), Y= 80 },
new ChartData { Date = new DateTime(2012, 04, 30), Y= 200},
new ChartData { Date = new DateTime(2012, 05, 07), Y= 600},
new ChartData { Date = new DateTime(2012, 05, 14), Y= 50 },
new ChartData { Date = new DateTime(2012, 05, 21), Y= 700},
new ChartData { Date = new DateTime(2012, 05, 28), Y= 90 }
};
public void StockChartPeriodChanged(StockChartPeriodChangedEventArgs args)
{
       // Here you can customize your code
}

}
 
// add your additional code here 
 
 
We appreciate your patience in waiting for this release. Kindly let us know if you need further assistance. 
  
Regards, 
Srihari 


Marked as answer
Loader.
Up arrow icon