Completed
Last Updated: 01 Jun 2015 08:19 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 12 May 2015 08:13
Category: ChartView
Type: Bug Report
0
FIX. RadChartView - Constant flickering of the chart if one of the series is hidden and the ShowTrackBall property is set to true
public Form1()
{
    InitializeComponent();

    AreaSeries areaSeries = new AreaSeries();
    areaSeries.DataPoints.Add(new CategoricalDataPoint(13, "Jan"));
    areaSeries.DataPoints.Add(new CategoricalDataPoint(20, "Apr"));
    areaSeries.DataPoints.Add(new CategoricalDataPoint(15, "Jul"));
    areaSeries.DataPoints.Add(new CategoricalDataPoint(16, "Oct"));
    this.radChartView1.Series.Add(areaSeries);

    AreaSeries areaSeries2 = new AreaSeries(); 
    areaSeries2.DataPoints.Add(new CategoricalDataPoint(15, "Jan"));
    areaSeries2.DataPoints.Add(new CategoricalDataPoint(25, "Apr"));
    areaSeries2.DataPoints.Add(new CategoricalDataPoint(27, "Jul"));
    areaSeries2.DataPoints.Add(new CategoricalDataPoint(18, "Oct"));
    this.radChartView1.Series.Add(areaSeries2);

    this.radChartView1.ShowTrackBall = true;
    this.radChartView1.Series.First().IsVisible = false;
}

Please refer to the attached sample video.

Workaround 1: remove the series instead of hiding it.

Workaround 2:

private void radChartView1_CreateRenderer(object sender, ChartViewCreateRendererEventArgs e)
{
     e.Renderer = new CustomCartesianRenderer(e.Area as CartesianArea);
}

public class CustomCartesianRenderer : CartesianRenderer
{
    public CustomCartesianRenderer(CartesianArea area) : base(area)
    {
    }

    private int renderPass = 0;

    public override void Draw(object context)
    {
        if (renderPass < 2)
        {
            if (this.Area.View.Owner.Control.Site == null)
            {
                for (int i = 0; i < this.Area.Series.Count; i++)
                {
                    if (this.Area.Series[i].IsVisible && !this.Area.Series[i].Model.IsArrangeValid)
                    {
                        this.Area.View.Layout();
                        renderPass++;
                        return;
                    }
                }
            }
        }
        FieldInfo fi = typeof(ChartRenderer).GetField("surface", BindingFlags.Instance | BindingFlags.NonPublic);
        if (context != null)
        {
            fi.SetValue(this, context);
        }
        Initialize();

        for (int i = 0; i < this.DrawParts.Count; i++)
        {
            this.DrawParts[i].Draw();
        }
    }
}

Attached Files:
0 comments