We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Create a Pi-Diagram on the first worksheet

Thread ID:

Created:

Updated:

Platform:

Replies:

127842 Dec 12,2016 11:54 AM Dec 16,2016 04:43 AM ASP.NET MVC 11
loading
Tags: XlsIO
Testname
Asked On December 12, 2016 11:54 AM

Create a Pi-Diagram on the first worksheet ("workbook.Worksheets[0]").
 
foreach over all "Worksheets"

- new entry for the Pie-chart
- the name and values of the pie chart ("workbook.Worksheets[0]") should be build like this:
-> name of the current worksheet's name
-> value "the second column, and the sum between sheet[1, 2].Value and sheet[usedRange.LastRow, 2].Value")


end foreach

- the diagram should fill the entire viewport of "workbook.Worksheets[0]"

By the way which DLL's do I need ?

Sridhar Sukumar [Syncfusion]
Replied On December 13, 2016 07:04 AM

Hi, 
 
Thank you for contacting Syncfusion support. 
 
We have prepared a sample for your requirement which can be downloaded from the following link 
 
 
If you want to view the chart in full worksheet, you can create a new chart sheet. Otherwise you can set the chart height and width based on your screen resolution by using ChartShape.Width and ChartShape.Height property to fill the chart in entire viewport of worksheet. 
 
Please refer the following UG Documentation link to know about the assemblies to be referenced in your application 
 
UG Documentation link: 
 
Please let us know if you have any concern. 
 
Regards, 
Sridhar S. 


mvxyc
Replied On December 13, 2016 08:09 AM

This is a nice beginning, but not exactly what  I need.

I need a single pie chart on the first worksheet("workbook.Worksheets[0];"),.

Each peace of the pie should be the sum of each worksheet's sum(- > "the second column, and the sum between sheet[1, 2].Value and sheet[usedRange.LastRow, 2].Value")") and the name for that peace of cake should its worksheet name(in the legend).

Please update your code.

Sridhar Sukumar [Syncfusion]
Replied On December 14, 2016 02:21 AM

Hi, 
 
Thank you for updating us. 
 
We have prepared a sample for your requirement which can be downloaded from the following link 
 
 
Please let us know if you have any concern. 
 
Regards, 
Sridhar S.  
  


Testname
Replied On December 14, 2016 02:39 AM

I get a "System.ArgumentOutOfRangeException", for Range, remember "workbook.Worksheets[0]" has no values for calculation...

Testname
Replied On December 15, 2016 03:21 AM

worksheet.UsedRange.LastRow
sheet.UsedRange.LastColumn

are sometimes "0". Don't know the reason for this.

Sridhar Sukumar [Syncfusion]
Replied On December 15, 2016 07:25 AM

Hi, 
 
Thank you for updating us. 
 
When the worksheet does not contain any value (data and styles), then the UsedRange.LastRow and UsedRange.LastColumn value will be 0. So, you can check whether the worksheet contains any value using WorksheetImpl.IsEmpty property before accessing LastRow and LastColumn property of used range which is illustrated in following code example.   
 
Code snippet: 
if (! (worksheet as WorksheetImpl).IsEmpty) 
{ 
range = worksheet.Range[1, 2, worksheet.UsedRange.LastRow, 2]; 
sheet.Range[i, column + 1].Value = worksheet.Name; 
sheet.Range[i, column + 2].Formula = "SUM(" + range.AddressGlobal + ")"; 
i++; 
} 
 
We have also modified the sample for your reference which can be downloaded from the following location 
 
 
Please let us know if you have any concern. 
 
Regards, 
Sridhar S. 


Testname
Replied On December 15, 2016 09:02 AM

Sorry, this did not work out.

worksheet.UsedRange.LastRow, is still 0 and I get that exeption...

Testname
Replied On December 15, 2016 09:06 AM

and taking a look at the file especially the sheet, it has the required data ... mmhh

Testname
Replied On December 15, 2016 09:15 AM

the first sheet is empty, because here should the chart drawed from the other sheets

Testname
Replied On December 15, 2016 09:32 AM

Ok, I solved that error.

I changed the charttype to "ExcelChartType.Bar_Stacked;".
How can I the scala(numbers in the chart, which show the amount).

How can I change it to "int" because now I have something like"0.5, 1, 1.5, 2 ,2.5...."

Sridhar Sukumar [Syncfusion]
Replied On December 16, 2016 04:43 AM

Hi,  
 
Thank you for updating us. 
 
You can achieve your requirement by assigning PrimaryValueAxis.MajorUnit property value. Please refer the following code example to achieve this. 
 
Code snippet: 
chart.PrimaryValueAxis.MajorUnit = 2; 
 
If you are still facing the issue, kindly share us the issue reproducing sample along with input files which will be helpful for us to give you a prompt solution at the earliest. 
 
Regards, 
Sridhar S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;