CandlestickSeries and negative Values

6 posts, 0 answers
  1. Janko
    Janko avatar
    5 posts
    Member since:
    Sep 2012

    Posted 07 May 2013 Link to this post

    Hi Telerik Team.

    The CandlestickSeries seems to have an odd behavior for negative values. The attached image shows a graph where the candlestick values should decrease linearly from left to right, but they stop at around y=0.


    What is a workaround for this?


    I use Telerik Version 2012.2.912.40, WPF


    Code:

    <telerik:RadCartesianChart>
        <telerik:RadCartesianChart.VerticalAxis>
            <telerik:LinearAxis/>
        </telerik:RadCartesianChart.VerticalAxis>
        <telerik:RadCartesianChart.HorizontalAxis>
            <telerik:CategoricalAxis/>
        </telerik:RadCartesianChart.HorizontalAxis>
        <telerik:CandlestickSeries x:Name="Series0" 
                                HighBinding="High"
                                OpenBinding="Open"
                                CloseBinding="Close"
                                LowBinding="Low"
                                CategoryBinding="X">
        </telerik:CandlestickSeries>
    </telerik:RadCartesianChart>

    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
        }
     
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var chartData = new List<MyChartDataClass>();
            for (int i = 0; i < 35; i++)
            {
                var cdc = new MyChartDataClass()
                {
                    X = i,
                    High = 5 - i,
                    Open = 4 - i,
                    Close = 3 - i,
                    Low = 2 - i,
                };
                chartData.Add(cdc);
            }
            Series0.ItemsSource = chartData;
        }
    }
     
    public class MyChartDataClass
    {
        public int X { get; set; }
        public double Close { get; set; }
        public double Low { get; set; }
        public double Open { get; set; }
        public double High { get; set; }
    }
  2. Peshito
    Admin
    Peshito avatar
    497 posts

    Posted 10 May 2013 Link to this post

    Hello Janko,

    CandleStick series type is used primarily to describe price movements of a security, derivative, or currency over time. Using CandleStick series with negative values is not a real case scenario therefore this behavior is not supported by RadChartView and there is no workaround for it.

    Regards,
    Peshito
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Janko
    Janko avatar
    5 posts
    Member since:
    Sep 2012

    Posted 13 May 2013 Link to this post

    Hello Telerik Team.

    I use CandleSticks to show the confidence Intervals of the points as error bars.

    Is there any other way to show error bars?

    (As far as I remember your old RadChart did not have this 'bug'.)


    Regards,
    Janko
  5. Peshito
    Admin
    Peshito avatar
    497 posts

    Posted 16 May 2013 Link to this post

    Hello Janko,

    You are right that RadChart behaves in a way different than RadChartView in that scenario. This is why I have forwarded this matter to our developers for further consideration and improvement for the CandleStick series in order to support negative values as well. I have also submitted a feature request for showing error bars. You can vote for it here.

    Kind regards,
    Peshito
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Janko
    Janko avatar
    5 posts
    Member since:
    Sep 2012

    Posted 16 May 2013 Link to this post

    Hi Peshito/Telerik Team.

     

    Thank you for your post :)

     

    In my humble opinion the title/description of the feature request does not describe my problem.

    ;) ;)


    Could you mention the negative values, e.g.:

    “CandleStick series support for negative values such that they can be used as error bars in a negative value range, too.”



    best Regards :)

    Janko

  7. Peshito
    Admin
    Peshito avatar
    497 posts

    Posted 21 May 2013 Link to this post

    Hi Janko,

    Thank you for the suggestion.

    The issue you are facing with the candle sticks not drown correctly when the values are negative has been fixed and it will be included in our next major release which is in about two weeks.

    Kind regards,
    Peshito
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
UI for WPF is Visual Studio 2017 Ready