My 2p about ERP Solutions, Information Worker Solutions and other software products (mainly Microsoft Dynamics AX and Microsoft SharePoint).

05 January 2009

Generating charts from SharePoint lists

by Patrik Luca 24 comments


Business requirement: Generating charts from SharePoint lists

Microsoft Office SharePoint Server 2007 doesn't have OOTB features to generate charts from SharePoint lists. This post describes a solution which can be found on CodePlex to make this possible with just a few clicks. Multiple graph types such as bars, columns and lines are possible.

Step 1: Installation of the ChartPart for SharePoint.

A nice installation script can be found on CodePlex.

Some important remarks:

  • You will need to install Microsoft .NET 3.5 Service Pack 1 and the Microsoft Chart Controls for Microsoft .NET Framework to be able to use the ChartPart for SharePoint solution. 
  • Add following line to the SafeControls section of the web.config file of your web application:
    <SafeControl Assembly="System.Web.DataVisualization, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"  Namespace="System.Web.UI.DataVisualization.Charting" TypeName="*" Safe="True" AllowRemoteDesigner="True"/>      
    Else, you'll receive an error like The "ChartPartWebPart" Web Part appears to be causing a problem. Error executing child request for ChartImg.axd.


Step 2: Add the ChartPart for SharePoint Web Part to a Web Part Page.

You should have it in your Add Web Parts Web Page Dialog after having correctly installed it as described in Step 1.

Step 3: Configure The ChartPart Web Part.

You should define your Site where the SharePoint list resides on which you want to generate a chart first.

The List drop down box will be loaded automatically with the available SharePoint lists for the chosen SharePoint site.

You can limit the items to be represented in the rendered chart based on an existing SharePoint view.

Number fields can be chosen as X-Series. You can always choose an Item Count. In the Y-series you specify a column of your SharePoint list.

The Chart type can be set to different types such as Column, StackedColumn, Bar, StackedBar, ...

In this example, I have based my Chart on a OOTB Issue Tracking List in which I created some list items. The result looks like this:

We can finetune the Chart with some simple clicks in the standard Web Part User Interface:

You can change colors, width, height with just a few clicks. You can add a link to the source list to let end users jump immediately to the source list merely by clicking on the Chart. It jumps to the list view as selected previously.

After some finetuning, my Chart looks already more fancy as shown below:

Comments 24 comments
Anonymous said...

Hi the solution for the following erroe ChartPartWebPart" Web Part appears to be causing a problem. Error executing child request for ChartImg.axd. is add this statment in your web application webconfig under httphandler
add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"

then restart you iss through cmd -- iisresrt

then enjoy :)

Huda Albar

Anonymous said...

Thank you for the excellent information concerning ChartPart. With your help, I was able to install and configure the web part fairly easily. My question is concerning the X / Y axis. I have a list which includes "branch" (that is, a specific town) and a "count" (the number of branches in the town). Right now, the "branch" appears on the Y-axis; the "count" on the X. I would like the "count" to appear on the Y-axis instead. I understand that numbers post on the X-axis, but, in your example, you post the "Active/Resolved/Closed" on the X-axis. What settings did you use to achieve this?

Patrik Luca said...

Hi Kathy,

glad to hear I could help you out.
As answer to your question: change the Chart type from Bar to Column.

Anonymous said...

Eureka! Thank you so much! I appreciate your time and help!

Anonymous said...

Awesome post about the line that needed to be added to the web.config files. Not sure why they haven't added that to the codeplex page.

Nevertheless THANKYOU!!!


Anonymous said...

I have added the codes to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG\web.config file, and followed your instructions to build the chart and associated the site URL and list - however I still recieve the "Error executing to child" message. 3.5 SP1 and the MSChart.exe and chartpart.wsp has been successfully installed and deployed within MOSS and the chartpart web part is available within the web part gallery also. Can you assist me please?

Patrik Luca said...

Have you executed an iisreset already?

Anonymous said...

Yes - I have done an iisreset luck I am afraid. Anything else you could suggest? Nel

Patrik Luca said...

What is written in the SharePoint logs in the 12 hive: maybe there you'll find a more descriptive error?

Anonymous said...

Does this work for anonymous sites?
Im having unauthorized error..

Patrik Luca said...

I don't know if this works for anonymous sites.

Anonymous said...

I too have installed the pre-requisites, added the code to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG\web.config file, and followed your instructions but I don't see the Web Part when trying to add it. Again, 3.5 SP1 and the MSChart.exe and chartpart.wsp has been successfully installed and deployed within WSS 3.0 but the chartpart web part is NOT available within the web part gallery also. Can you assist me please?

Patrik Luca said...

I haven't tried it yet on WSS, only on MOSS 2007. Maybe the webpart needs MOSS, although I doubt this.

Kat said...

i used the safe control tag provided and i already reset the IIS. The error is the same and sometimes the error
"An exception occurred:System.ArgumentException: An entry with the same key already exists. at System.Collections.Specialized.ListDictionary.Add(Object key, Object value) at Microsoft.SharePoint.SPListItemCollectionPosition.ExtractPagingInfo() at Microsoft.SharePoint.SPListItemCollectionPosition..ctor(String strData) at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData() at Microsoft.SharePoint.SPListItemCollection.Undirty() at Microsoft.SharePoint.SPBaseCollection.System.Collections.IEnumerable.GetEnumerator() at ChartPart.ChartPartWebPart.GenerateChart() at ChartPart.BaseChartPart`1.CreateChildControls()"

Patrik Luca said...

I have no idea to help you: I suggest you log an issue on the Issue Tracker list on Codeplex.

Anonymous said...

thanks for the chartpart webpart link.This webpart is working fine for me. I used this to get pie charts but these pie charts are displaying only values can some one tell me how to diaplay percentages for pie charts?

Laurent Bel said...

Another free tool to generate Charts on SharePoint is available here:

The charts looks really nice and it is easy to configure with any SharePoint list.

Anonymous said...

I had tried all this for sharepoint 10 but it was not working , giving error "Error importing Web Part".........Please help me out

Rahul said...

Hi Patrick,

Nice way to display charts using ChartPart.

Here's a blog i wrote on how to use ASP.NET 3.5 chart control in sharepoint 2007 pages provided you have the privelege to deploy code on the server.

Hope this helps.. :)

John Frag said...

My current project requires ability to display choice column value via color or image associated with a choice

But Sharepoint standard packaged misses that control

I am looking for available solutions on market

I came across

Does anybody has experiece using it?

Rahul said...

Hi dan,

Are you using SharePoint 2010 or 2007? Also are you looking at a custom solution or an out of the box solution?

Anonymous said...

If you are looking for something really powerful you need to check out Nevron Chart for SharePoint ( - it supports both SP 2007 and 2010 out of the box and templates are forward and backward compatible - meaning you can create charts on SP 2007 that you can later import in SP 2010 and vice verca!

It also supports charting and pivot charting from SP Lists, BDC, Excel Services and databases (ODBC, ADO.NET, Oracle and SQL Server).

Anonymous said...

Hi. A late post, but do you know of any way to change the axis scale in SP 2007? I'd like the axis to be integers. Seems you had the same issue on your graph - the scales suggested you could measure your issues in steps 0f 0.5!

Anonymous said...

I would like to achieve the same in SharePoint 2013/online. Would it be possible?

Patrik Luca, Ieper, BELGIUM
Feel free to use or spread all of the content on my blog. In return, linking back to my blog would be greatly appreciated. All my posts and articles are provided "AS IS" with no warranties.

Subscribe feeds via e-mail
Subscribe in your preferred RSS reader

Subscribe feeds rss Most Read Entries

Subscribe feeds rss Recent Entries


Recommended Books

Subscribe feeds rss Recent Comments

This Blog is part of the U Comment I Follow movement in blogosphere. Means the comment field of this blog is made DOFOLLOW. Spam wont be tolerated.

Blog Archive

My Blog List