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">
                 &lt;set name=&apos;Not Started&apos; color=&apos;FF6666&apos; value=&apos;<xsl:value-of select="$varNotStarted"/>&apos;  /&gt;
                 &lt;set name=&apos;In Progress&apos; color=&apos;66A866&apos; value=&apos;<xsl:value-of select="$varInProgress"/>&apos;  /&gt;
                 &lt;set name=&apos;varCompleted&apos; color=&apos;0B9CFD&apos; value=&apos;<xsl:value-of select="$varCompleted"/>&apos;  /&gt;
   </xsl:variable>
   
   
 <xsl:variable name="varChartData">
      &lt;graph caption=&apos;&apos; showPercentValues=&apos;1&apos; decimalPrecision=&apos;0&apos; showValues=&apos;1&apos;  showLegend=&apos;1&apos; showNames=&apos;1&apos;  &gt;
      <xsl:value-of select="$varDataset" />
      &lt;/graph&gt;  
      </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&amp;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="&amp;dataXML={$varChartData}&amp;chartWidth=500&amp;chartHeight=400"><param name="quality" value="high" /></param></param>  </object>
      </td>
</tr>
</xsl:template>

and my Chart with data:

Create Pie Chart from SharePoint Task list using Fusion Charts

Related Fusion Chart Articles:

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

2 thoughts on “Create Pie Chart from SharePoint Task list using Fusion Charts

  • Great….. Very Nice….

    Reply
  • 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.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *