|
|
Chart.ToImage() and DataLabels positioning
Last post 10-21-2008, 9:52 PM by roger. 28 replies.
-
09-22-2008, 3:53 AM |
-
cruzcarat
-
-
-
Joined on 09-06-2007
-
-
Posts 102
-
-
-
-
|
Re: Chart.ToImage() and DataLabels positioning
Attachment: Present (inaccessible)
Ok, I have done some tests on the fix but I'm having some problems with the leader lines.
Here is a sample code. Basically the output excel file represents exactly what I want of the leader lines, but the generated image is different from the output excel file.
Please try this code and check with the attached files
Workbook book = new Workbook(); Worksheet sheet = book.Worksheets[0];
sheet.Cells[0, 0].PutValue("veeeeeeery loooooooong name"); sheet.Cells[0, 1].PutValue("small name"); sheet.Cells[0, 2].PutValue("normal nnaammee"); sheet.Cells[0, 3].PutValue("another relatively long name"); sheet.Cells[0, 4].PutValue("naaaaaaaameeeeeeeee"); sheet.Cells[0, 5].PutValue("i also have a naaaaaameee"); sheet.Cells[0, 6].PutValue("my name is loooong"); 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); sheet.Cells[1, 6].PutValue(1.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:G2", false); chart.NSeries.CategoryData = "A1:G1"; 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;
book.Worksheets[0].Charts[0].ToImage("c:\\test.emf", System.Drawing.Imaging.ImageFormat.Emf);
book.Save("c:\\test.xls");
Am I'm missing something in this code? Thanks once more for your support and sorry to bother you again, Cruz
|
|
-
09-22-2008, 4:33 AM |
-
Amjad Sahi
-
-
-
Joined on 08-30-2006
-
-
Posts 5,095
-
-
-
-
|
Re: Chart.ToImage() and DataLabels positioning
Hi Cruz,
Yes, we noticed the issue you have mentioned. We will look into it soon.
Thank you.
Amjad Sahi Support Developer, Aspose Nanjing Team Contact Us
|
|
-
09-24-2008, 7:28 AM |
-
cruzcarat
-
-
-
Joined on 09-06-2007
-
-
Posts 102
-
-
-
-
|
Re: Chart.ToImage() and DataLabels positioning
Hello again,
I was wondering if you have any updates or at least a timing for this issue, since this is the only issue that's left for my project to complete.
Thanks again for your patience, Cruz
|
|
-
09-24-2008, 7:57 AM |
-
Amjad Sahi
-
-
-
Joined on 08-30-2006
-
-
Posts 5,095
-
-
-
-
|
Re: Chart.ToImage() and DataLabels positioning
Hi,
We are working on your issue. Hopefully, a fix would be provided as soon as we figure it out.
Thanks for being patient!
Amjad Sahi Support Developer, Aspose Nanjing Team Contact Us
|
|
-
09-25-2008, 8:02 PM |
-
simon.zhao
-
-
-
Joined on 10-24-2005
-
-
Posts 213
-
-
-
-
|
Re: Chart.ToImage() and DataLabels positioning
Attachment: Present (inaccessible)
Hi,
Please try this fix.The chart image is similar to the display in MS Excel.
BTW, there is another issue in this fix. If you custom the position and size of plot area, MS Excel will custom the position and size of all objects(Title,Legend,DataLabels ...) in the chart, we do not change them now. So the plot area in MS Excel is less than your setting. We will look into this issue. It will take us a long time to support this issue.
Simon Zhao Developer Aspose Nanjing Team Contact Us
|
|
-
09-30-2008, 4:05 AM |
-
cruzcarat
-
-
-
Joined on 09-06-2007
-
-
Posts 102
-
-
-
-
|
Re: Chart.ToImage() and DataLabels positioning
Attachment: Present (inaccessible)
Ok, this is almost perfect.
I found only one problem, regarding the amount of data in the chart. Please regard the attached xls example file. In its current state, the chart is correctly converted to an image but if you add another "slice" to the pie chart (selecting another row of data in the first worksheet) all leader lines and label positions are reset. I guess this happens because the new line of data caused a label to overflow the chart boundaries.
Is this an easy issue to fix? Can you give me timings on this? Thanks again, Cruz
|
|
-
09-30-2008, 4:21 AM |
-
Amjad Sahi
-
-
-
Joined on 08-30-2006
-
-
Posts 5,095
-
-
-
-
|
Re: Chart.ToImage() and DataLabels positioning
Hi,
Thanks for your feedback.
OK, we will look into it and get back to you soon.
Thank you.
Amjad Sahi Support Developer, Aspose Nanjing Team Contact Us
|
|
-
10-15-2008, 3:06 AM |
-
cruzcarat
-
-
-
Joined on 09-06-2007
-
-
Posts 102
-
-
-
-
|
Re: Chart.ToImage() and DataLabels positioning
Hi there,
Do you already have any feedback for this issue?
Thanks, Cruz
|
|
-
10-15-2008, 7:06 AM |
-
Amjad Sahi
-
-
-
Joined on 08-30-2006
-
-
Posts 5,095
-
-
-
-
|
Re: Chart.ToImage() and DataLabels positioning
Hi Cruz,
We are still working on your issue and will update you soon.
Thanks for your patience.
Amjad Sahi Support Developer, Aspose Nanjing Team Contact Us
|
|
-
10-16-2008, 9:52 PM |
-
roger
-
-
-
Joined on 11-24-2005
-
-
Posts 178
-
-
-
-
|
Re: Chart.ToImage() and DataLabels positioning
Attachment: Present (inaccessible)
Hi Cruz,
Please try the attachment. We update the leader lines issue and sheet2Image issue.
Roger Mo Developer Aspose Nanjing Team Contact Us
|
|
-
10-19-2008, 12:26 PM |
-
cruzcarat
-
-
-
Joined on 09-06-2007
-
-
Posts 102
-
-
-
-
|
Re: Chart.ToImage() and DataLabels positioning
Attachment: Present (inaccessible)
Thanks again for your reply,
I see the issue of the leader lines is fixed. It's perfect so far.
I noticed another issue, though. It's a matter of cells custom format.
Please try the attached file with the the following code:
Workbook book = new Workbook();
book.Open( "c:\\teste.xls");
string aux = book.Worksheets[0].Cells[1, 1].StringValue;
Notice that the value in the workbook is correctly formated, but the String Value of the cell is just part of the string specified in the custom format, and it is not applying to the data it contains. I managed a workaround for me, but I thought you'd like to know about this.
Thanks again for your reply,
Cruz
|
|
-
10-20-2008, 4:39 AM |
-
Amjad Sahi
-
-
-
Joined on 08-30-2006
-
-
Posts 5,095
-
-
-
-
|
Re: Chart.ToImage() and DataLabels positioning
Hi,
Thanks for pointing it out.
Yes, we found the issue, we will figure it out. If you want to get the value only, you may try to use "book.Worksheets[0].Cells[1, 1].Value".
Thank you.
Amjad Sahi Support Developer, Aspose Nanjing Team Contact Us
|
|
-
10-20-2008, 9:18 AM |
-
cruzcarat
-
-
-
Joined on 09-06-2007
-
-
Posts 102
-
-
-
-
|
Re: Chart.ToImage() and DataLabels positioning
Thanks for the tip, I used the Value property for the workaround, yes. Basically I retrieved the Style string, retrieved the Value and then manually applied the style to the value.
Thanks again, Cruz
|
|
-
10-21-2008, 9:52 PM |
-
roger
-
-
-
Joined on 11-24-2005
-
-
Posts 178
-
-
-
-
|
Re: Chart.ToImage() and DataLabels positioning
Attachment: Present (inaccessible)
Hi Cruz,
Please try this fix.
Thank you.
Roger Mo Developer Aspose Nanjing Team Contact Us
|
|
Page 2 of 2 (29 items)
2
|
|