ChartPart for SharePoint

If you would like to generate some charts in Microsoft SharePoint 2007, after a quick search you will find that there is no such out-of-the-box functionality. You shouldn’t worry, though, as there is a free web part available at Codeplex, which has everything you need for your list-based charting needs. It is called “ChartPart for SharePoint” and is available here.

Prerequisites

In order to get it working on your server, you will need to have Microsoft .NET 3.5 SP1 and Microsoft Chart Controls for Microsoft .NET Framework 3.5 installed. The ‘installation package’ does not check for those prerequisites, so make sure you do that manually before you install. Most probably you already have .NET 3.5 SP1 installed, but chances are, the MS Chart Controls are not installed.

Installation

The deployment package consists of two WSP files (SharePoint solution deployment packages) – MSChartControls.wsp and ChartPart 2.0.wsp. First, you have to install the MSChartControls package. Login on your SharePoint server, start the Console (Start -> Run -> cmd) and type:

stsadm -o addsolution –filename MSChartControls.wsp
stsadm -o execadmsvcjobs

STSADM NOTE: Of course, you will have to choose between the convenience of not typing the full path to the stsadm.exe file or not having to type the full path to the WSP. So, you have to be in one of the two folders and type the full path to the other file.

This will add the solution to the SharePoint Central Administration -> Operations -> Solution Management. You can either use the User Interface it provides to deploy the added solution, or you can continue executing console commands, like this:

stsadm -o deploysolution -name MSChartControls.wsp -immediate –allowgacdeployment
stsadm -o execadmsvcjobs

Then, you have to activate the installed solution on Web Application level:

  1. Go to Central Administration
  2. Go to Application Management
  3. Select Manage Web Application Features
  4. Verify that you have selected the correct Web Application in the top right corner
  5. Click Activate on the Microsoft Chart Controls Feature

Now, you have to do something similar for the other WSP (Chart Part 2.0.wsp):

stsadm -o addsolution -filename “ChartPart 2.0.wsp”
stsadm -o execadmsvcjobs

Deploy the solution, either from Central Admin, or by using the console:

stsadm -o deploysolution -name “Chartpart 2.0.wsp” -immediate -allowCasPolicies -url <url>
stsadm -o execadmsvcjobs

Where <url> is the address of the web site you wish to deploy the webpart to. Now all you have to do is activate the feature on the selected Site Collection.

  1. Go to Site Settings for your top-level site
  2. Go To Site Collection Features
  3. Activate the ChartPart for SharePoint feature
  4. Now you can add ChartParts on every site in your Site Collection.

Usage

I created a new ‘Web Part Page’ on my site, to use for experimenting with the web parts. I chose ‘Full Page, Vertical’ layout template, as it  is one of the simplest and I preferred to have full width.

I chose to ‘Edit Page’ and clicked on ‘Add a Web Part’ link in the design mode of the page. A pop-up showing all available web parts appears and from there, I chose to add on the page the ‘ChartPart’ web part.


Once added on the page, you have to configure it. While the page is still in design mode, click on the little arrow down in the right upper corner of the web part. It will open a side menu. Click on ‘Modify Shared Web Part’. This will open the options of the web part.

Here, you can set the title of the web part (as it will appear on the page it is added to), the web site to pull data from, the specific list and its view. Then you have to select X and Y “Series” column. A bit of explanation… Only Number fields can be choses as “X-Series”. “Item Count” is always available to you. As “Y-Series” you have to specify a column of the SharePoint list.

To illustrate all this, I will configure my list to contain only two columns – “City” (single line of text) and “Population” (number field). Here is what my list looks like:

Now, I want to configure the Chart web part to visualize this statistics. I will set it up this way:

We click OK button and the generated chart looks like:

Customization

You can customize the chart in many ways. First. by selecting the ‘Chart Type’ for the chart. Choices are Column, Bar, Pie and so many others. Additionally, you can select ‘Style’ (Cylinder, Emboss, LightToDark, Wedge), which seems to work only on specific ‘Chart Types’. For example, it clearly works on a ‘Column’ chart type. Here is the difference between ‘Cylinder’ and ‘Wedge’:

There is many other fine tunings you can do, like color palette, size and etc. Also what’s really nice is that in the tooltip (when you hover a column in the chart) you will see an exact value, of the column.

Conclusion

ChartPart for SharePoint is a great component, if you want to visualize some statistics based on SharePoint list items. It is highly customizable, easy to install and use.

Advertisements