Get currently visible points on Candlestick chart

7 posts, 1 answers
  1. Jonathan
    Jonathan avatar
    6 posts
    Member since:
    Feb 2016

    Posted 29 Feb Link to this post

    Hi,

    I'm trying to get the current visible range of values in a Candlestick chart, in order to apply different levels of sampling threshold when zoom changes (in an attempt to get adaptative sampling to solve this issue: http://www.telerik.com/forums/adaptive-sampling-zoom-scrolling). Is there any way to get this value, or the limits of the visible area, or at least know when a point is visible or not when zooming in and out?

    Thanks.

  2. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 03 Mar Link to this post

    Hello Jonathan,

    You can use the ActualVisibleRange property of the axis and see the range that the visible plot area corresponds to. You can then iterate all data points and see which data points have a date in this range. You can get the date from the Category property of the data point. I hope this will suffice.

    Regards,
    Petar Marchev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Jonathan
    Jonathan avatar
    6 posts
    Member since:
    Feb 2016

    Posted 03 Mar in reply to Petar Marchev Link to this post

    Hi Petar,

    If I'm not mistaken, DateTimeCategoricalAxis doesn't contain the property ActualVisibleRange. Instead, DateTimeContinuousAxis contains it, but using this kind of axis causes my Candlestick chart to look like a mess. This is why I'm using the former.

    Regards,

    Jonathan.

  5. Answer
    Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 07 Mar Link to this post

    Hello Jonathan,

    We think that usually the datetime continuous axis would be a better choice for a financial chart. Otherwise, if you have too many categories, you risk of the axis getting cluttered by so many ticks.

    Anyway, if you decide to keep the categorical axis, you can still use a similar approach. The categorical axis has a Categories collection that contains all the categories. You can get the relative zoom from the chart's HorizontalZoomRangeStart/End properties and calculate the first and last visible categories. So, you can still get the items in this range. I hope this helps.

    Regards,
    Petar Marchev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Jonathan
    Jonathan avatar
    6 posts
    Member since:
    Feb 2016

    Posted 07 Mar in reply to Petar Marchev Link to this post

    Hello Petar,

    The problem with DateTime Continuous is that candles in Candlestick chart are shown too wide. You'll find an attached screenshot that shows this issue.

    On the other hand, I'll give it a try using the Categories collection approach. 

    Thanks,

    Jonathan.

  7. Jonathan
    Jonathan avatar
    6 posts
    Member since:
    Feb 2016

    Posted 07 Mar in reply to Petar Marchev Link to this post

    Sorry, I forgot to attach the screenshot...
  8. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 07 Mar Link to this post

    Hello Jonathan,

    You can use the properties of the DateTimeContuousAxis to specify the major step and major step unit. I suggest you give it a go.

    Regards,
    Petar Marchev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready