CandleSeries Y-Axis autorange

Hi support team,

I looked for UG manual carefully about Y-axis auto range according X-axis scrolling bar. But I could not find it.
I want to auto range setting minimum and maximum value to Y-axis that display stock price.
Stock price data has wide date scale, so necessary to move date range moving horizontal scroll bar.

My idea is following:
I want to set Y-axis minimum and maximum value by scroll bar width and position by code.
Width and position set date start/end range.

Please give me any advice or suggestion.

Best regards,
Junji Sumi

5 Replies 1 reply marked as answer

SM Saravanan Madheswaran Syncfusion Team October 8, 2020 04:46 AM UTC

Hi Junji,   
   
Greetings from Syncfusion.   
  
We have validated your query and from our understanding, it seems like your requirement is to show the small amount of data in chart and need to change the minimum and maximum of y axis depending on the value visible in the chart at X axis scrolling (panning). If so, changing the minimum and maximum continuously, will feel hard to see on panning. We will also have a chance to face chart flickering.    
  
 In case of misunderstanding your requirement, please share any graphical demo of your application. It will help us to validate the feasibility.   
 
Regards, 
Saravanan. 



JS Junji Sumi October 8, 2020 08:05 AM UTC

Hi Saravanan,

Thank you for quick response.

Yes, your understanding is right. See attach file, I hope it would help more understanding.
And my question is the followings.

1. How to get date range start and end.
    Start: Left end of Horizontal scroll bar in DateTimeCategoryAxis.
    End: Right end of Horizontal scroll bar in DateTimeCategoryAxis.

    I want to catch the date range from scroll bar left and right end.

2. How to notice the changing position of scroll bar.
    Which trigger will raise up when changing.

After I could get the date current range, I could code that set min and max in y-axis.

Caution of Attach file:
You may update SfChart.WPF version to 
18.3460.0.35.
It is in packages\Syncfusion.SfChart.WPF.18.3.0.35\lib\net46\Syncfusion.SfChart.WPF.dll

Best regards,
Junji

Attachment: SfChartTest_ea28582a.zip


SM Saravanan Madheswaran Syncfusion Team October 9, 2020 11:25 AM UTC

 Hi Junji,  
 
Thanks for the confirmation.  
 
Query 1. How to get date range start and end. 
We would like to let you know that we can get the current axis range using VisibleRange property of ChartAxis.  
 
Note: As you are using DateTimeCategoryAxis, the index of current range will be return from VisibleRange. 
 
Query 2. How to notice the changing position of scroll bar. 
 
Using PanChanging and PanChanged event we can get notify at scroll bar change and chart panning.  
 
<chart:SfChart x:Name="sfChart" PanChanging="sfChart_PanChanging" PanChanged="sfChart_PanChanged"> 
. . . 
</chart:SfChart> 
  
C#: 
private void sfChart_PanChanged(object sender, PanChangedEventArgs e) 
            var XAxis = e.Axis as DateTimeCategoryAxis; 
            if (XAxis != null) 
           
                //Index of start and end range.  
                var start = XAxis.VisibleRange.Start; 
                var end = XAxis.VisibleRange.End; 
                var startDate = datas[(int)start].Date; 
                var endDate = datas[(int)end].Date; 
           
 
 
As we informed before, changing minimum and maximum continuously, will feel hard to see on panning. Even though we prepare the sample for this requirement, it will be downloaded from below link.  
 
 
Regards, 
Saravanan. 


Marked as answer

JS Junji Sumi October 10, 2020 04:33 AM UTC

Hi Saravanan,

Thank you for rapid and good response.

Your answer is the right what I'm looking for. 

I think this is basic or default function for candle series chart with scroll bar.
UG is some difficult to understand and develop AP.
I hope UG to add some short samples.

Best regards,
Junji


SM Saravanan Madheswaran Syncfusion Team October 12, 2020 10:22 AM UTC

Hi Junji, 
 
Thanks for your feedback.   
   
Currently, we are in the process of revamping our help document. We surely update this with more details. 
 
Regards, 
Saravanan. 


Loader.
Up arrow icon