This is a migrated thread and some comments may be shown as answers.

Wrong auto scale for negative values

1 Answer 84 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Sergey
Top achievements
Rank 1
Sergey asked on 20 Dec 2016, 12:06 PM

Hi, I use RadCartesianChart to display some candles, but I see only part of them on the screen (see picture). Seems that auto-scale works not well. How to show all candles?

Here is the code:

<Window x:Class="TelerikWpfApp1.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                Title="MainWindow" Background="#FF1E1E1E" >
    <Grid>
        <telerik:RadCartesianChart>
            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:CategoricalAxis/>
            </telerik:RadCartesianChart.HorizontalAxis>
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis HorizontalLocation="Right"/>
            </telerik:RadCartesianChart.VerticalAxis>
            <telerik:RadCartesianChart.Series>
                <telerik:CandlestickSeries>
                    <telerik:CandlestickSeries.DataPoints>
<telerik:OhlcDataPoint Category="04/15/2015 02:21:00" Open="-125.7368" Close="-125.7128" Low="-125.7029" High="-125.7516" />
<telerik:OhlcDataPoint Category="04/15/2015 02:22:00" Open="-125.7128" Close="-125.7367" Low="-125.6828" High="-125.7396" />
<telerik:OhlcDataPoint Category="04/15/2015 02:23:00" Open="-125.7328" Close="-125.7297" Low="-125.704" High="-125.7417" />
<telerik:OhlcDataPoint Category="04/15/2015 02:24:00" Open="-125.7327" Close="-125.7308" Low="-125.6938" High="-125.7357" />
<telerik:OhlcDataPoint Category="04/15/2015 02:25:00" Open="-125.7268" Close="-125.7069" Low="-125.6743" High="-125.7307" />
<telerik:OhlcDataPoint Category="04/15/2015 02:26:00" Open="-125.7039" Close="-125.7068" Low="-125.6941" High="-125.7128" />
<telerik:OhlcDataPoint Category="04/15/2015 02:27:00" Open="-125.7028" Close="-125.7157" Low="-125.694" High="-125.7296" />
<telerik:OhlcDataPoint Category="04/15/2015 02:28:00" Open="-125.7327" Close="-125.7056" Low="-125.6738" High="-125.7325" />
<telerik:OhlcDataPoint Category="04/15/2015 02:29:00" Open="-125.6976" Close="-125.7036" Low="-125.6918" High="-125.7116" />
<telerik:OhlcDataPoint Category="04/15/2015 02:30:00" Open="-125.7096" Close="-125.7037" Low="-125.6739" High="-125.7156" />
<telerik:OhlcDataPoint Category="04/15/2015 02:31:00" Open="-125.7057" Close="-125.6768" Low="-125.6531" High="-125.7086" />
<telerik:OhlcDataPoint Category="04/15/2015 02:32:00" Open="-125.6818" Close="-125.6688" Low="-125.666" High="-125.6947" />
<telerik:OhlcDataPoint Category="04/15/2015 02:33:00" Open="-125.6708" Close="-125.6769" Low="-125.6631" High="-125.6828" />
<telerik:OhlcDataPoint Category="04/15/2015 02:34:00" Open="-125.6789" Close="-125.666" Low="-125.6532" High="-125.6829" />
<telerik:OhlcDataPoint Category="04/15/2015 02:35:00" Open="-125.668" Close="-125.6738" Low="-125.6442" High="-125.6798" />
<telerik:OhlcDataPoint Category="04/15/2015 02:36:00" Open="-125.6828" Close="-125.6906" Low="-125.6529" High="-125.7026" />
<telerik:OhlcDataPoint Category="04/15/2015 02:37:00" Open="-125.6906" Close="-125.6816" Low="-125.6628" High="-125.7005" />
<telerik:OhlcDataPoint Category="04/15/2015 02:38:00" Open="-125.6936" Close="-125.6996" Low="-125.6738" High="-125.7036" />
<telerik:OhlcDataPoint Category="04/15/2015 02:39:00" Open="-125.6856" Close="-125.6916" Low="-125.6628" High="-125.7066" />
<telerik:OhlcDataPoint Category="04/15/2015 02:40:00" Open="-125.6886" Close="-125.6797" Low="-125.6738" High="-125.6976" />
<telerik:OhlcDataPoint Category="04/15/2015 02:41:00" Open="-125.6887" Close="-125.6738" Low="-125.644" High="-125.6937" />
<telerik:OhlcDataPoint Category="04/15/2015 02:42:00" Open="-125.6748" Close="-125.6709" Low="-125.6442" High="-125.6828" />
<telerik:OhlcDataPoint Category="04/15/2015 02:43:00" Open="-125.6629" Close="-125.68" Low="-125.6503" High="-125.6819" />
<telerik:OhlcDataPoint Category="04/15/2015 02:44:00" Open="-125.6829" Close="-125.674" Low="-125.6442" High="-125.6829" />
<telerik:OhlcDataPoint Category="04/15/2015 02:45:00" Open="-125.665" Close="-125.674" Low="-125.6443" High="-125.6879" />
<telerik:OhlcDataPoint Category="04/15/2015 02:46:00" Open="-125.68" Close="-125.6623" Low="-125.6337" High="-125.683" />
<telerik:OhlcDataPoint Category="04/15/2015 02:47:00" Open="-125.6542" Close="-125.6753" Low="-125.6445" High="-125.6831" />
<telerik:OhlcDataPoint Category="04/15/2015 02:48:00" Open="-125.6833" Close="-125.6803" Low="-125.6627" High="-125.6832" />
<telerik:OhlcDataPoint Category="04/15/2015 02:49:00" Open="-125.6773" Close="-125.6912" Low="-125.6634" High="-125.692" />
<telerik:OhlcDataPoint Category="04/15/2015 02:50:00" Open="-125.6912" Close="-125.6781" Low="-125.6742" High="-125.7031" />
                    </telerik:CandlestickSeries.DataPoints>
                </telerik:CandlestickSeries>
            </telerik:RadCartesianChart.Series>
        </telerik:RadCartesianChart>
    </Grid>
</Window>

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 23 Dec 2016, 11:39 AM
Hi Sergey,

This happens because the candlesticks values are not defined in the expected range in the financial context. Keep in mind that in order for the data to make sense you should make sure that the Low value is smaller than the High value. In your case, this is reversed - the Low value is bigger than the High value. If you switch the values the range will be calculated as expected. Also, the Open and Close values should be between (or equal) the range of the High an Low values. In your case this is satisfied.

Regards,
Martin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ChartView
Asked by
Sergey
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or