FlexChart: axisY autoscale issues. Range selector

Posted by: a.sharov on 26 November 2021, 4:18 pm EST

    • Post Options:
    • Link

    Posted 26 November 2021, 4:18 pm EST - Updated 3 October 2022, 10:52 pm EST

    Hi.

    I have some data points of a magnitude, say 0.01 - 0.1. Then some outlier happens with value 10. Everything is rescaled to 10, so prevois values around 0.01 are simply look like laying on a single line around 0. When I look at a whole picture with all points it is ok, normal behavoir. But then I use range selector to navigate to the points of the same small magnitude (~0.01), but nothing changed, I’m still rescaled to AxisY max value around 10.

    Look pictures for more info.

    My code can be found here - https://drive.google.com/file/d/1ib1wes-quVN43TvJw10XNNJNEVYEqFAx/view?usp=sharing

  • Posted 26 November 2021, 4:23 pm EST

    I saw this discussion but it was not usefull in my case – https://www.grapecity.com/forums/winforms-edition/c1winchartflexchart---chan

    How to fix this issue given my code above (see link to gdrive).

    PS:For some reason I can’t edit initial post.

    Thanks in advance.

  • Posted 29 November 2021, 12:55 am EST

    Hi Anton,

    JFYI, RangeSelector works with AxisX i.e. it does not manipulates the AxisY while scrolling which is expected.

    Just in case needed, you can use AxisScrollbar for manually scrolling AxisY. Please refer to the same from here.

    https://www.grapecity.com/componentone/docs/win/online-flexchart/scroll.html

    Best Regards,

    Kartik

  • Posted 29 November 2021, 11:41 am EST

    Hi. Thank you for reply!

    What I asked if is there any api to scale automatically, based on currently visible data? I think I can do it with some coarseness, namely based on values of range selector I can select appropriate data from datasource (which are currently displayed), select them and setup flexchart AxisY min/max. If it is possbile to do automatically then great.

    One more question: is there any way to select data which are displayed, smth like selectedObjects (selectedItems) property, so I don’t have to do additional manipulations?

  • Posted 30 November 2021, 12:52 am EST

    Hi Anton,

    We are sorry but there is no API available for scaling the axis automatically. So, as you mentioned the only possible way is to manually set AxisY Min/Max based on the displayed data.

    > One more question: is there any way to select data which are displayed, smth like selectedObjects (selectedItems) property

    Yes, FlexChart supports Series/Point selection. Please refer to the same from here.

    https://www.grapecity.com/componentone/docs/win/online-flexchart/selection.html

    Best Regards,

    Kartik

  • Posted 30 November 2021, 11:58 am EST

    Hi.

    Yes, FlexChart supports Series/Point selection. Please refer to the same from here.

    Sorry, I wasn’t clear. I asked if it is possible to obtain part of visible datasource? Suppose that I see data like on pic. 2 above, is there any way to obtain datasource items for visible points? Smth like flexchart.viewitems, or itemsinview? So as a result of such a call I would get some array (subarray) or few indexes (first\last)?

    For now I see only option to directly request in datasource based on range selector upper\lower value.

  • Posted 1 December 2021, 1:25 am EST

    Hi Anton,

    There is no default way of getting the visible items. However, you can get the visible/plotted items for each series using Series’s SymbolRendered event. For example, you can create a custom series which can provide the list of visible items as follows:

    
    public class CustomSeries : Series
    {
            private List<object> _visibleItems;
            public IEnumerable<object> VisibleItems => _visibleItems;
    
            public CustomSeries()
            {
                _visibleItems = new List<object>();
                SymbolRendered += OnSymbolRendered;
            }
    
            private void OnSymbolRendered(object sender, RenderSymbolEventArgs e)
            {
                if(!_visibleItems.Contains(e.Item))
                {
                    _visibleItems.Add(e.Item);
                }
            }
    
            protected override bool OnRendering(IRenderEngine engine)
            {
                _visibleItems.Clear();
                return base.OnRendering(engine);
            }
     }
    
    

    Please refer to the same from the attached sample. (see FlexChartVisibleData)

    Best Regards,

    Kartik

    FlexChartVisibleData.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels