Completed
Last Updated: 17 Jul 2018 07:17 by Dimitar
ADMIN
Dimitar
Created on: 15 Jun 2018 10:32
Category: ChartView
Type: Bug Report
0
FIX. RadChartView - the shape is applied to wrong point when changing at run-time.
Use attached to reproduce.

Workaround:
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)
    {
    }

    protected override void Initialize()
    {
        base.Initialize();
        for (int i = 0; i < this.DrawParts.Count; i++)
        {
            LineSeriesDrawPart linePart = this.DrawParts[i] as LineSeriesDrawPart;
            if (linePart != null)
            {
                this.DrawParts[i] = new CustomLineSeriesDrawPart((LineSeries)linePart.Element, this);
            }
        }
    }

    
}
public class CustomLineSeriesDrawPart : LineSeriesDrawPart
{
    public CustomLineSeriesDrawPart(LineSeriesBase series, IChartRenderer renderer) : base(series, renderer)
    {
    }

    protected override PointF[] GetPointsPositionsArray()
    {
        List<DataPoint> points = new List<DataPoint>(this.Element.DataPoints);

        PointF[] result = new PointF[points.Count];

        for (int i = 0; i < points.Count; i++)
        {
            result[i] = new PointF(this.OffsetX + (float)points[i].LayoutSlot.X, this.OffsetY + (float)points[i].LayoutSlot.Y);
        }

        return result;
    }

}
Attached Files:
0 comments