|
|
Chart.ToImage() and DataLabels positioning
Last post 10-21-2008, 9:52 PM by roger. 28 replies.
-
07-02-2008, 5:59 AM |
-
cruzcarat
-
-
-
Joined on 09-06-2007
-
-
Posts 102
-
-
-
-
|
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 |
-
Amjad Sahi
-
-
-
Joined on 08-30-2006
-
-
Posts 5,095
-
-
-
-
|
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 |
-
cruzcarat
-
-
-
Joined on 09-06-2007
-
-
Posts 102
-
-
-
-
|
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 |
-
Amjad Sahi
-
-
-
Joined on 08-30-2006
-
-
Posts 5,095
-
-
-
-
|
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 |
-
cruzcarat
-
-
-
Joined on 09-06-2007
-
-
Posts 102
-
-
-
-
|
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 |
-
roger
-
-
-
Joined on 11-24-2005
-
-
Posts 178
-
-
-
-
|
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 |
-
cruzcarat
-
-
-
Joined on 09-06-2007
-
-
Posts 102
-
-
-
-
|
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 |
-
cruzcarat
-
-
-
Joined on 09-06-2007
-
-
Posts 102
-
-
-
-
|
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 |
-
Amjad Sahi
-
-
-
Joined on 08-30-2006
-
-
Posts 5,095
-
-
-
-
|
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 |
-
cruzcarat
-
-
-
Joined on 09-06-2007
-
-
Posts 102
-
-
-
-
|
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 |
-
simon.zhao
-
-
-
Joined on 10-24-2005
-
-
Posts 213
-
-
-
-
|
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 |
-
cruzcarat
-
-
-
Joined on 09-06-2007
-
-
Posts 102
-
-
-
-
|
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 |
-
Amjad Sahi
-
-
-
Joined on 08-30-2006
-
-
Posts 5,095
-
-
-
-
|
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 |
-
roger
-
-
-
Joined on 11-24-2005
-
-
Posts 178
-
-
-
-
|
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 |
-
cruzcarat
-
-
-
Joined on 09-06-2007
-
-
Posts 102
-
-
-
-
|
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
|
|