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.

Latest Data Point Marker on Y Axis

Thread ID:

Created:

Updated:

Platform:

Replies:

119165 May 16,2015 04:30 AM May 20,2015 12:05 AM WPF 3
loading
Tags: SfChart
Tim Douglas
Asked On May 16, 2015 04:30 AM

Hi,

On a chart updating in real time is there a way to show the latest datapoint as a marker on a numerical Y axis?

E.g. if the latest datapoint had a value of 105 this should be shown on the Yaxis.  A example screenshot is attached, the newest datapoint is 2120 and this is clearly represented on the Y axis.

Thanks





Attachment: DataPoint_1ce1daf1.rar

Rachel A [Syncfusion]
Replied On May 18, 2015 08:03 AM

Hi Tim,
Thank you for contacting Syncfusion support.
We can achieve your requirement using HorizontalLineAnnotation ShowAxisLabel property. When we set this property to true we can able the view the axis labels in y axis.As the chart is updating in real time the annotation Y1 value is updated dynamically as shown in the code snippet below.
Code Snippet:

[XAML]

<chart:SfChart.Annotations>

<chart:HorizontalLineAnnotation x:Name="annotation" ShowAxisLabel="True" ShowLine="False" ></chart:HorizontalLineAnnotation>

</chart:SfChart.Annotations>


[C#]

void timer_Tick(object sender, EventArgs e)

{

view.AddData();

value = (series.ItemsSource as ObservableCollection<Data>).Count;

annotation.Y1 = ((Chart.Series[0] as CandleSeries).ItemsSource as ObservableCollection<Data>)[value - 1].Value;

}




Please find the attached sample below for your reference.
Sample: DataMarker.zip
Please let us know if you require any further assistance on this.
Thanks,
Rachel. A

Tim Douglas
Replied On May 18, 2015 01:40 PM

Thanks for the quick response Rachel, it's now working after using your example.

One slight issue - the annotation is appearing at the far right of the axis rather than to the left as it was in your example.  I've tried setting the HorizontalAlignment but it didn't have any effect.  Any ideas?

The xmla is below and an image is attached.

Thanks

        <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:CategoryAxis ShowTrackBallInfo="True" LabelFormat="HH:mm" Interval="20" EnableScrollBar="True"
                                             Margin="4" ActualRangeChanged="XAxis_ActualRangeChanged" AxisLineOffset="10" EdgeLabelsDrawingMode="Fit"/>
                <!--<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" RangePadding="Additional" 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:SfChart.Annotations>
                <charts:HorizontalLineAnnotation x:Name="annotation" ShowAxisLabel="True" ShowLine="False" Y1="{Binding annotationCol.Value}"></charts:HorizontalLineAnnotation>
            </charts:SfChart.Annotations>
        </charts:SfChart>

Attachment: RightAlignment_4e133541.rar

Sheik Syed Abthaheer M [Syncfusion]
Replied On May 20, 2015 12:05 AM

Hi Tim,

Thanks for your update.

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.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let me know if you have any questions.

Regards,
M. Sheik

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.

;