We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Dynamically Resize Y Axis

Hi,

Currently I dynamically resize the X axis using code from the ChartAutoScrollingDemo_2013 as below.  I've tried to adpat this to the Y axis but when doing so the candles are no longer plotted although I can the chart is functioning as the X asix continues to scroll.

Is this possible to do?

Thanks


Xaxis - works

       public void XAxis_ActualRangeChanged(object sender, ActualRangeChangedEventArgs e)
        {
            if (e.IsScrolling)
                return;
            e.VisibleMinimum = (double)e.ActualMaximum - 100d;
        }

Yaxis - Candles do not render

        private void YAxis_ActualRangeChanged(object sender, ActualRangeChangedEventArgs e)
        {
            if (e.IsScrolling)
                return;
            e.VisibleMinimum = Convert.ToDouble(e.ActualMaximum) + 10;
        }

XAML code

        <charts:SfChart
            x:Name="financialChart">
           
            <charts:SfChart.DataContext>
            <local:CandleChartViewModel/>
        </charts:SfChart.DataContext>

            <charts:SfChart.Behaviors>
                <charts:ChartCrossHairBehavior/>
            </charts:SfChart.Behaviors>

            <charts:SfChart.PrimaryAxis>
                <charts:DateTimeCategoryAxis ShowTrackBallInfo="True" LabelFormat="HH:mm" Interval="20" IntervalType="Minutes" EnableScrollBar="True" ActualRangeChanged="XAxis_ActualRangeChanged" Margin="4"/>
            </charts:SfChart.PrimaryAxis>
            <charts:SfChart.SecondaryAxis>
                <charts:NumericalAxis  ShowTrackBallInfo="True" OpposedPosition="True" Margin="-2" ActualRangeChanged="YAxis_ActualRangeChanged" />
            </charts:SfChart.SecondaryAxis>

            <charts:CandleSeries Name="series" ItemsSource="{Binding obPriceBar}" StrokeThickness="1" XBindingPath="DateTime"  High="High" Open="Open" Close="Close"
                                 Low="Low"  Label="Candleseries" ShowTooltip="True" BearFillColor="Blue" BullFillColor="Red"
                                 charts:ChartTooltip.HorizontalAlignment="Left" charts:ChartTooltip.TooltipMargin="10"
                                 >
                </charts:CandleSeries>
        </charts:SfChart>

2 Replies

SS Suresh S Syncfusion Team May 18, 2015 12:30 PM UTC

Hi Tim,

We were able to reproduce the issue and we have confirmed this as bug and logged a report on this. Also we have created a support incident under your account to track the status of this issue.

Please log on to our support website to check for further updates.

Link: https://www.syncfusion.com/account/login

Regards,

Suresh S



SK Satheesh Kumar T Syncfusion Team May 20, 2015 09:15 AM UTC

Hi Tim,
Please ignore the previous update.
Upon further analysis with your problem in source, we have confirmed this as a behavior. Please find the details below.

Event Arguments

Use Case

ActualMinimum

Get or set the start value of the axis.

ActualMaximum

Get or set end value of the axis.

VisibleMinimum & VisibleMaximum

To define the range of values to be display for the view port.


Note: VisibleMinimum and VisibleMaximum should be lay between the ActualMinimum and ActualMaximum.
In your code snippet, we have noticed the below code.
[C#]
e.VisibleMinimum = Convert.ToDouble(e.ActualMaximum) + 10d;
It will results to VisibleMinimum is greater than ActualMaximum, then it will not work.

If your requirement is to show only the last few range of values in Y Axis as like AutoScrolling Demo, we can set VisibleMinimum as below:
e.VisibleMinimum = (double)e.ActualMaximum - 100d; //to view last 100 range values in view port.
(or)
e.VisibleMinimum = Convert.ToDouble(e.ActualMinimum) + 10d; //to ignore the 10 initial values.
Note: If this is not your requirement, please provide more information regarding your requirement so that we can provide you the better solution.
Please let us know, if you need any further assistance.
Thanks,
Satheesh Kumar T

Loader.
Live Chat Icon For mobile
Up arrow icon