SharePoint 2010 Guru - Adding Charts to Standard Webparts and Visual Webparts
Congratulations to 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 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:
SharePoint 2010 Technical Guru - May 2013 |
|
Matthew Yarlett | Adding Charts to Webparts |
|
|
Christopher Clement | How to filter a list dynamically |
|
|
Christopher Clement | How to delete crawled property |
|
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:
<``handlers``>
<``addname``=``"ChartImageHandler"verb``=``"*"path``=``"ChartImg.axd"type``=``"System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</``handlers``>
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):
<``appSettings`` >
<``addkey``=``"ChartImageHandler"value``=``"storage=file;timeout=20;dir=c:\Temp\;"/>
</``appSettings``>
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 for the fantastic contribution!
- User Ed
Comments
- Anonymous
January 31, 2016
Computers Today (part 1 of 6) blogs.msdn.com/.../computers-today.aspx ..... CS SPOTLIGHT: Girls in computer programming... why it matters!!! blogs.msdn.com/.../cs-spotlight-girls-in-computer-programming-why-it-matters.aspx ... Computational Thinking - Videos & Papers by Jeannette Wing blogs.msdn.com/.../computational-thinking-videos-amp-papers-by-jeannette-wing.aspx