Pre loader

Automatically adjust Zoom of Chart after changing Data

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

1
0

hi all, I’m using SciChart with MVVM light.

I am working on a stock chart OHLC and data are coming in from Mintpal.

Mintpal has an API where you can request a specific date range: 6 hours, 24 hours, 1 week, etc.

Running the application requests for 6 hours OHLC data, and on the application, I can select 24 hours, 3 days, 1 week

my problem is, how do you automatically adjust the zoom level without double clicking the cart?

Autorange is set by the way on YAxisStyle

To know about my problem, here’s a sample video using the test app I made.

http://screencast.com/t/dm7Ba4uaC

  • You must to post comments
1
0

You can try with for example this line of code:

YAxis.VisibleRange = RangeFactory.NewWithMinMax(this.YAxis.VisibleRange, yaxisminimRange, yaxismaximumRange);

You can also look at the examples with ViewportManager. However i think the line above is what you need. Of course this is for the Y axis but you can do the same for the X Axis. Just make sure to use the correct format.

Here is a good example with the ViewportManager: Zoom Including Annotations

  • jaysonragasa
    I am using MVVM light.. I am not really sure how to implement that on the code behind of the Window. But I'll see what I can do. Can I ask, how do you enumerate child charts on a chart group? Thanks
    • Guest
    • 10 years ago
    • 1
    hi, you could bind the ViewportManager to your ViewModel, please, take a look at the Drag Horizontal Threshold example
  • Andrew Burnett-Thompson
    And another ViewportManager example in your other question on ZoomExtents of charts in a SciChartGroup. This is the way to directly control the chart from a ViewModel. Thanks everyone who posted!
  • jaysonragasa
    I found another way which works as well <s:SciStockChart.XAxisStyle><Style TargetType="s:CategoryDateTimeAxis"><Setter Property="AutoRange" Value="Always"/></Style></s:SciStockChart.XAxisStyle>
  • Andrew Burnett-Thompson
    Awesome, thanks for sharing! You can create your own answer and we can vote for it if you want
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies