Unplanned
Last Updated: 31 Jul 2023 16:44 by ADMIN
Stephan
Created on: 05 Jun 2020 15:45
Category: ChartView
Type: Bug Report
3
RadRangeSelector: wrong bar length of some bars in RadRangeSelector when integrated with RadChart and BarSeries

Hello Telerik Support,

after taking my first steps with RangeSelector and ChartView controls I found an issue with a simple bar chart. The length of some bars in the chart of the RangeSelector doesn't match with the bars in the ChartView. The relation is wrong.I provided a screenshot and marked the bars. I could provide a sample application, but I can't attach a zip file, so here's the code of the main form:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls;
using Telerik.WinControls.UI;
 
namespace TelerikChartView
{
    public partial class MainForm : Telerik.WinControls.UI.RadForm
    {
        private List<Kapazitaetspunkt> _BackListPunkte;
        private BindingList<Kapazitaetspunkt> Punkte;
 
        public MainForm()
        {
            InitializeComponent();
        }
 
        private void MainForm_Load(object sender, EventArgs e)
        {
            _BackListPunkte = new List<Kapazitaetspunkt>();
            Punkte = new BindingList<Kapazitaetspunkt>(_BackListPunkte);
            //Punkte = new BindingList<Kapazitaetspunkt>();
            rngTimeSelector.AssociatedControl = cvChart;
            rngTimeSelector.RangeSelectorElement.ScrollSelectorElement.Visibility = ElementVisibility.Collapsed;
 
            BarSeries bars = new BarSeries();
            bars.DataSource = Punkte;
            bars.ValueMember = nameof(Kapazitaetspunkt.Percentage);
            bars.CategoryMember = nameof(Kapazitaetspunkt.Date);
            cvChart.Series.Add(bars);
        }
 
        private void GenerateTestData(int addMonths = 0)
        {
            Punkte.Clear();
            const int count = 25;
            const int step = 4;
            var von = DateTime.Today.AddMonths(addMonths);
            var bis = von.AddDays(count);
            double percentage = 0;
            //_BackListPunkte.Add(new Kapazitaetspunkt(von.AddDays(-1), null));
            Punkte.Add(new Kapazitaetspunkt(von.AddDays(-1), null));
 
            while (von < bis)
            {
                //_BackListPunkte.Add(new Kapazitaetspunkt(von, percentage));
                Punkte.Add(new Kapazitaetspunkt(von, percentage));
                percentage += step;
                von = von.AddDays(1);
            }
 
            //_BackListPunkte.Add(new Kapazitaetspunkt(von.AddDays(1), null));
            Punkte.Add(new Kapazitaetspunkt(von.AddDays(1), null));
        }
 
        private void btnGenerateData_Click(object sender, EventArgs e)
        {
            GenerateTestData();
 
            rngTimeSelector.RangeSelectorElement.InitializeElements();
            rngTimeSelector.RangeSelectorElement.ResetLayout(true);
        }
 
        private void btnGenerateData2_Click(object sender, EventArgs e)
        {
            GenerateTestData(2);
 
            rngTimeSelector.RangeSelectorElement.InitializeElements();
            rngTimeSelector.RangeSelectorElement.ResetLayout(true);
 
        }
 
        private void rngTimeSelector_ScaleInitializing(object sender, ScaleInitializingEventArgs e)
        {
            e.Cancel = true;
        }
    }
 
    public class Kapazitaetspunkt : INotifyPropertyChanged
    {
        private DateTime _Date;
 
        public DateTime Date
        {
            get => _Date;
            set
            {
                if (value != Date)
                {
                    _Date = value;
                    OnPropertyChanged();
                }
            }
        }
 
 
        public double? _Percentage;
 
        public double? Percentage
        {
            get => _Percentage;
            set
            {
                if (value != Percentage)
                {
                    _Percentage = value;
                    OnPropertyChanged();
                }
            }
        }
 
 
        public Kapazitaetspunkt(DateTime date, double? percentage)
        {
            Date = date;
            Percentage = percentage;
        }
 
 
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

Regards,

Stephan

3 comments
ADMIN
Dinko | Tech Support Engineer
Posted on: 31 Jul 2023 16:44

Hi Fabrice,

So far this behavior is not planned for fixing. The status of the feedback item will be changed at the moment adding to our plan for implementation. You can follow the item so that you can be notified.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Fabrice
Posted on: 25 Jul 2023 15:39

Hi,

 

A fix on this one would be greetly appreciated!

 

Thanks

ADMIN
Nadya | Tech Support Engineer
Posted on: 09 Jun 2020 15:25

Hello Stephan,

The provided code snippet is greatly appreciated.

I used it in my test project and was able to observe the same incorrect behavior with BarSeries in RadRangeSelector. This is why I have logged it in our Feedback portal by making this thread public. You can track its progress, subscribe for status changes, and add your comments on the following link: feedback item.

Currently, due to the specifics of the issue, I can not suggest a workaround.

I have also updated your Telerik Points for the report.

If you have other questions or concerns do not hesitate to contact us.

Regards,
Nadya
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.