Completed
Last Updated: 01 Jun 2015 08:15 by ADMIN
ADMIN
Dimitar
Created on: 29 May 2015 11:54
Category: ChartView
Type: Bug Report
0
FIX. RadChartView - the smart labels are not exported correctly.
To reproduce:
Enable the smart labels and export the chart using custom size:
 this.radChartView1.ExportToImage(@"C:\df.png", new Size(1100,1100), System.Drawing.Imaging.ImageFormat.Png);

Workaround:
class MyPieRenderer : PieRenderer
{
    
    public MyPieRenderer(PieArea area) : base(area)
    {
    }

    protected override void Initialize()
    {
        base.Initialize();

        var area = this.View;

        SmartLabelsController smartController = null;
        for (int i = 0; i < area.View.Controllers.Count; i++)
        {
            smartController = area.View.Controllers[i] as SmartLabelsController;

            if (smartController != null)
            {
                RadRect viewport = area.View.Viewport;
                viewport.X -= area.View.Margin.Left;
                viewport.Y -= area.View.Margin.Top;
                viewport.Width += area.View.Margin.Horizontal;
                viewport.Height += area.View.Margin.Vertical;

                Rectangle plotArea = new Rectangle((int)viewport.X, (int)viewport.Y, (int)viewport.Width, (int)viewport.Height);
                smartController.CalculateLabelsPositions(area.View.Series, plotArea);

                break;
            }
        }
    }
}
// change like this 
void radChartView1_CreateRenderer(object sender, ChartViewCreateRendererEventArgs e)
{
    e.Renderer = new MyPieRenderer((PieArea)e.Area);
}
0 comments