Create Pie Chart from SharePoint Task list using Fusion Charts
Two years back, I posted an article on Creating Fusion Charts in SharePoint.(Refer to this article for step-by-step instructions to create Fusion charts, Just replace the below-given XSL) There is a similar request today, But this time, I had to create a Pie Chart from SharePoint Task List. The requirement is just to display the Chart based on the Task Status counts.
Here is my XSL:
<xsl:template name="dvt_1.body">
<xsl:param name="Rows"/>
<xsl:variable name="varNotStarted" select="count(/dsQueryResponse/Rows/Row[normalize-space(@Status) = 'Not Started'])" />
<xsl:variable name="varInProgress" select="count(/dsQueryResponse/Rows/Row[normalize-space(@Status) = 'In Progress'])" />
<xsl:variable name="varCompleted" select="count(/dsQueryResponse/Rows/Row[normalize-space(@Status) = 'Completed'])" />
<xsl:variable name="varDataset">
<set name='Not Started' color='FF6666' value='<xsl:value-of select="$varNotStarted"/>' />
<set name='In Progress' color='66A866' value='<xsl:value-of select="$varInProgress"/>' />
<set name='varCompleted' color='0B9CFD' value='<xsl:value-of select="$varCompleted"/>' />
</xsl:variable>
<xsl:variable name="varChartData">
<graph caption='' showPercentValues='1' decimalPrecision='0' showValues='1' showLegend='1' showNames='1' >
<xsl:value-of select="$varDataset" />
</graph>
</xsl:variable>
<tr>
<td>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="500">
<param name="movie" value="https://intranet.company.com/sites/IT/itsm/Charts/Pie2D.swf?chartWidth=600&chartHeight=500" >
<xsl:text xmlns:ddwrt="https://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:whitespace-preserve="yes" xml:space="preserve">
</xsl:text>
<param name="FlashVars" value="&dataXML={$varChartData}&chartWidth=500&chartHeight=400"><param name="quality" value="high" /></param></param> </object>
</td>
</tr>
</xsl:template>
and my Chart with data:
Related Fusion Chart Articles:
Great….. Very Nice….
Hi Salaudeen,
This is Rishi from the FusionCharts Team.
We’re glad to see your article about FusionCharts with Sharepoint.
We would like to let you know that FusionCharts has a product which provides charting for Sharepoint – known as Collabion Charts for Sharepoint. You can read more about it here – https://www.fusioncharts.com/extensions/sharepoint/.
Let us know about your experience with Collabion.