Link to home
Start Free TrialLog in
Avatar of Russellbrown
RussellbrownFlag for United States of America

asked on

Getting Started: Visual Studio and SharePoint 2010 > Create Custom Chart with data from SharePoint List


Would appreciate it very much your help to point me to the resource sites ( with sample code, if possible )  to get started on the following:

Using Visual Studio 2012 to create web part / solution that can be deployed in SharePoint 2010,  to create custom chart with SharePoint List(s).

Would specifically like to cover the following items:
1. Visual C#
2. References  to include System.Web.UI.DataVisualization.Charting, System.Data,  .DataSource, .DataBind

Thank you.
Avatar of Rainer Jeschor
Rainer Jeschor
Flag of Germany image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Russellbrown


Thank you for the link and it is very informative.

Would you have a sample code or point me to a site with such a code,  for building  a web part to generate a chart with the following conditions:

1) datasource: a SharePoint List,
2) Visual C#
3) utilising Visual Web Part,
4) sandboxed solution,

Environment: Visual Studio 2012, SharePoint 2012

Thank you.

I managed to sample a code and able to obtain an array of the x and y values for the chart i.e.  SPListItemCollection itemColl = list.GetItems(query);
How do I debug ( similar to debug.print in VBA  immediate window e.g. ?sales(1)  * ) by printing out an element of the array to either Output / Immediate window in Visual Studio 2012 using C#?

The series in the list are:
Product:        P1   P2   P3 .....
Sales:            50  100  150

the 1st element of the array will be P1, 50.

*The VBA code is something along this line:
Option Explicit
Option Base 1 ' start indexing array elements at 1
Dim sales() As String
Dim item As Variant

and the array is ( 50, 100, 150 )
.....Each item In sales ..........
?sales(1) = 50
?sales(2) = 100

Thank you.
you will have to attach to the W3P process of your SharePoint web app and use
System.Diagnostics.Debug.Write or
to print to the immediate window.


Thank you for the reply. Will work on it. I have paused for a while but will be getting back into this assignment. Will revert in a week's time with the result.

I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
I do not agree with the Deletion.
The original request has been for a resource to start development. This request has been fulfilled as the creator made it to develop the solution.
Then he asked the question for debugging - which is an extension of the original one.
Therefore imho the first answer can be seen as successful.
Agree with Rainer. It has been a while and  was looking on another aspect of a project and missed closing this case. Will be happy to take the first answer as good. Regards.
@Russellbrown: thank you very much - I really appreciate your support!
The pointer has helped to get me started looking further into the issue.