Sign In  Sign Up Live-Chat

Chart.ToImage() and DataLabels positioning

Last post 10-21-2008, 9:52 PM by roger. 28 replies.
Page 1 of 2 (29 items)   1 2 Next >
Sort Posts: Previous Next
  •  07-02-2008, 5:59 AM 133931

    Chart.ToImage() and DataLabels positioning

    Hello,

    I found an issue with the Chart.ToImage() method. If you try the code below and check the output files, you will notice that whilst the XLS file correctly positions the labels (so they won't overlap), the corresponding image does not. This is important to me because I have some pie charts with many slices and some of them are overlapping their labels.

            Workbook book = new Workbook();
            Worksheet sheet = book.Worksheets[0];

            sheet.Cells[0, 0].PutValue("A");
            sheet.Cells[0, 1].PutValue("BB");
            sheet.Cells[0, 2].PutValue("CCC");
            sheet.Cells[0, 3].PutValue("DDDD");
            sheet.Cells[0, 4].PutValue("EEEEE");
            sheet.Cells[0, 5].PutValue("FFFFFF");
            sheet.Cells[1, 0].PutValue(100);
            sheet.Cells[1, 1].PutValue(50);
            sheet.Cells[1, 2].PutValue(25);
            sheet.Cells[1, 3].PutValue(12.5);
            sheet.Cells[1, 4].PutValue(6.25);
            sheet.Cells[1, 5].PutValue(3.175);

            int chart_index = sheet.Charts.Add(Aspose.Cells.ChartType.Pie, 5, 5, 5, 5);
            Chart chart = sheet.Charts[chart_index];

            chart.FirstSliceAngle = 90;
            chart.SizeWithWindow = true;
            chart.IsLegendShown = false;
            chart.ChartArea.Background = BackgroundMode.Transparent;
            chart.ChartArea.Border.IsVisible = false;

            chart.Title.Text = "Great test";
            chart.Title.TextFont.IsBold = false;
            chart.Title.TextFont.Size = 24;
            chart.Title.Border.IsVisible = false;
            chart.Title.Background = BackgroundMode.Transparent;

            chart.ChartObject.Height = (int)(306 * 1.6);
            chart.ChartObject.Width = (int)(380 * 1.6);

            chart.PlotArea.Height = (int)Math.Round(3270 / 1.5);
            chart.PlotArea.Width = (int)Math.Round(3574 / 1.5);
            chart.PlotArea.X = 280 + (int)((3270 - (int)Math.Round(3270 / 1.5)) / 2);
            chart.PlotArea.Y = 400 + (int)((3574 - (int)Math.Round(3574 / 1.5)) / 2);

            chart.NSeries.Add("A2:F2", false);
            chart.NSeries.CategoryData = "A1:F1";
            chart.NSeries.IsColorVaried = true;

            chart.NSeries[0].DataLabels.Postion = LabelPositionType.BestFit;
            chart.NSeries[0].DataLabels.IsValueShown = false;
            chart.NSeries[0].DataLabels.IsCategoryNameShown = true;
            chart.NSeries[0].DataLabels.IsPercentageShown = true;
            chart.NSeries[0].DataLabels.Separator = DataLablesSeparatorType.NewLine;

            sheet.Charts[0].ToImage("c:\\test.bmp");
            book.Save("c:\\test.xls");


    Is this an easy issue to fix?
    Thanks for your help,
    Cruz
     
  •  07-02-2008, 7:10 AM 133959 in reply to 133931

    Re: Chart.ToImage() and DataLabels positioning

    Hi Cruz,

    Thanks for providing us the source code.

    We found the issue and will fix it soon.

    Thank you.


    Amjad Sahi
    Support Developer,
    Aspose Nanjing Team
    Contact Us
     
  •  07-07-2008, 12:45 PM 134579 in reply to 133959

    Re: Chart.ToImage() and DataLabels positioning

    Hi Amjad,

    I was wondering if you have any news on this issue. Do have any timings?

    Thanks again,
    Cruz
     
  •  07-07-2008, 1:04 PM 134583 in reply to 134579

    Re: Chart.ToImage() and DataLabels positioning

    Hi Cruz,

    Thanks for following up.

    We will get back to you soon.

    Thanks for being patient!


    Amjad Sahi
    Support Developer,
    Aspose Nanjing Team
    Contact Us
     
  •  07-16-2008, 11:59 AM 135774 in reply to 134583

    Re: Chart.ToImage() and DataLabels positioning

    Hello again,

    Really sorry to bother you again with this, but I really need an update on this issue. My project is awaiting production because of this.

    Do you have any timings for me?
    Thanks for all the support,
    Cruz
     
  •  07-17-2008, 8:30 PM 136004 in reply to 135774

    Re: Chart.ToImage() and DataLabels positioning

    Hi,

    We provide a fix for the issue at the end of next week. The issue is more complex as the leader lines are depend on the pie slices and at the same time the pie slices affect the leader lines.


    Roger Mo
    Developer
    Aspose Nanjing Team
    Contact Us
     
  •  07-18-2008, 3:29 AM 136039 in reply to 136004

    Re: Chart.ToImage() and DataLabels positioning

    Hi there,

    Ok, I understand your point. I'll wait till next week, then.

    Thanks again for your patience,
    Cruz
     
  •  07-19-2008, 9:04 AM 136186 in reply to 136039

    Re: Chart.ToImage() and DataLabels positioning

    Attachment: Present (inaccessible)
    Hello again,

    Sorry to bother you again, but I found another issue with the ToImage method.

    Just run this code with the attached template file:

            Workbook book = new Workbook();
            book.Open("c:\\test.xls");

            book.Worksheets[0].Charts[0].ToImage("c:\\test.bmp");

    You will notice that the alignment of the ticklabels is not correct in the resulting image, as they should be aligned vertically on top (next to the axis) but they are being aligned on the vertical center.

    Thanks in advance,
    Cruz
     
  •  07-20-2008, 12:09 AM 136192 in reply to 136186

    Re: Chart.ToImage() and DataLabels positioning

    Hi Cruz,

    Thanks for the template file.

    We did the conversion (chart2image) and yes, we noticed the issue (you have mentioned). We will figure it out soon.

    Thank you.


    Amjad Sahi
    Support Developer,
    Aspose Nanjing Team
    Contact Us
     
  •  08-26-2008, 4:15 AM 141255 in reply to 136192

    Re: Chart.ToImage() and DataLabels positioning

    Hello, again.

    Can you give me some feedback on this issue? It's been a month since your last reply.

    Thanks in advance
    Cruz
     
  •  08-26-2008, 7:36 PM 141337 in reply to 141255

    Re: Chart.ToImage() and DataLabels positioning

    Attachment: Present (inaccessible)

    Hi Cruz,

    Please try this fix.

    We have supported leader line and fixed the bug of area' s color.


    Simon Zhao
    Developer
    Aspose Nanjing Team
    Contact Us
     
  •  08-29-2008, 9:14 AM 141768 in reply to 141337

    Re: Chart.ToImage() and DataLabels positioning

    Attachment: Present (inaccessible)
    Hi, thanks for the fix.

    I found an issue, though. Please regard the attached test files.

    Simply open the xls file and use the ToImage method in the chart. The result is also attached.

    I tested the leader lines both by creating a chart from scratch, which was fine, but when I tested with a chart built in excel, the result is as attached.

    Thanks in advance,
    Cruz
     
  •  08-29-2008, 12:33 PM 141792 in reply to 141768

    Re: Chart.ToImage() and DataLabels positioning

    Hi,

    Thanks for providing us the template excel file.

    We will figure it out soon.

    Thank you.


    Amjad Sahi
    Support Developer,
    Aspose Nanjing Team
    Contact Us
     
  •  09-03-2008, 2:00 AM 142151 in reply to 141792

    Re: Chart.ToImage() and DataLabels positioning

    Attachment: Present (inaccessible)

    In the last fix, I only considered to fit your requirement and did not take notice of the chart if it was built in excel manually. Now, I think the previous fix has some serious bugs. In th current fix (attached), we have fixed the bug if the chart was built in MS Excel 2003 (2007 not supported yet) but it does not work fine in case if you are creating the chart from the scratch since there is still a bug in saving excel file. We will look into it soon.

    Thank you.


    Roger Mo
    Developer
    Aspose Nanjing Team
    Contact Us
     
  •  09-05-2008, 7:55 AM 142583 in reply to 142151

    Re: Chart.ToImage() and DataLabels positioning

    Ok, thanks for the fix. I will test it and get back to you soon.

    Cruz
     
Page 1 of 2 (29 items)   1 2 Next >
View as RSS news feed in XML