May SharePoint Guru – Adding Charts to Standard Webparts and Visual Webparts

Congratulations to Matthew Yarlett, our SharePoint Guru winner for May 2013! To find all the competitors for May (and more information about this monthly contest), see the Wiki article: TechNet Guru Awards, May 2013.

Matthew Yarlett's avatar

About Matthew: I'm a solutions architect primarily focused on delivering business solutions built on top of the SharePoint platform. I love getting technical, but I'm equally interested in the business end of IT and deriving value from IT systems.


Matthew took the top spot with this great article:

SharePoint 2010: Adding Charts to Standard Webparts and Visual Webparts


Here are our three winners for SharePoint 2010:


Gold Award Winner SharePoint 2010 Technical Guru - May 2013

Gold Award Winner


Matthew Yarlett Adding Charts to Webparts
  • "I know I’ll need this code some day."
  • "The article of Matthew is written in such a way that even if you have almost no experience with SharePoint development, you would be able to build a working proof-of-concept version by following the step by step guide he wrote. "
  • "Interesting solution, and it is clear."

Silver Award Winner


Christopher Clement How to filter a list dynamically
  • "Clever thinking, I like it!"
  • "It is a good workaround."

Bronze Award Winner


Christopher Clement How to delete crawled property
  • "Handy tip!"
  • "Good tip!"

Congratulations to Matt for leading the SharePoint 2010 category this month. Perfectly written article that is exactly what we like to see.

For an excerpt from the article, I'm going to mess you up completely and give you steps 9 & 10:


9. Now we're nearly ready to deploy... but first we need to add the httphandler to the web.config file for the web application you are going to be deploying the webpart to. To do this, you'll need to add an entry into the <handlers> section and the <appSettings> sections of the web.config file.

Add the Http Handler for the chart images:

<add name="ChartImageHandler" verb="*" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

Add a new key to the <appSettings> section to configure the location (among other things) the image files are written to (see: Image File Management (Chart Controls) for more information):

<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\Temp\;" />


10. Lastly, deploy your solution to SharePoint and add your webpart to the page. Hopefully it will look something similar to the one below (or the same if you stole my data)!

The only real difference when adding a chart to a Visual Webpart, is that you need to register the charting controls on the ascx page add the chart control directly onto the pages markup (you don't need to initialize the control on the OnInit event).




Read the entire article here:

SharePoint 2010: Adding Charts to Standard Webparts and Visual Webparts


Thanks again to Matthew Yarlett for the fantastic contribution! You can read about all the May winners here: TechNet Guru Awards - May 2013


Also, for the June Guru competition, there are lot of SharePoint entries, including 6 from Gokan! See TechNet Guru June Roundup & Commentary.


Are you a Wiki Ninja?

  - Ninja Ed

Comments (1)

Skip to main content