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.
Unfortunately, activation email could not send to your email. Please try again.

Dynamically Resize Y Axis

Thread ID:

Created:

Updated:

Platform:

Replies:

119164 May 16,2015 03:54 AM May 20,2015 05:15 AM WPF 2
loading
Tags: SfChart
Tim Douglas
Asked On May 16, 2015 03:54 AM

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>

Suresh S [Syncfusion]
Replied On May 18, 2015 08:30 AM

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


Satheesh Kumar T [Syncfusion]
Replied On May 20, 2015 05:15 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;