Playing With Plasticine

Elad Barkan's Share Point Pondering

Creating graphs in share point Using designer and silverlight

 

A lot of my customers want to view their share point contents in a “BI sexy way” on their site.

The common dream is about having a graph that will show high level information about a list, on real time. This article will show how to create such graph, with data view that uses Visifire Silverlight graph tools.

Our sample will be an "action items" list graph that shows the count of different status:

wanted graph

Step 1: Take resources from Visifire site

Download resources

1.       Download visifire resources zip file (first link on page).

2.       Upload SL.Visifire.Charts.xap and Visifire2.js to a library on your site, where your users have read permissions.

Design your graph

1.       Go to the Silverlight chart designer page in visifire.com.

2.       Create a mockup of your requested chart.

chart designer

3.       Click on “View HTML”

4.       Copy the code between <!-- To embed in existing html copy the code below --> <!-- Copy till here --> to an new designer page.

Step 2: initial your data view web part

Create the data view

I’m not going to show the web part creation here, the best instructions for doing that are located in CIzi’s blog “My First Data View”.

Please note:

-          Insert the title in multiple items view

-          In data view properties, under “paging”, mark “display all items”

Do your calculations

The logic: we will create new parameters that will be the result of our wanted calculations. In this sample, we will tell the "data view" to go to over all items and to count each status items.

Under <xsl:template name="dvt_1"> add new parameters with your requested calculations.

The base is: <xsl:variable name="VariableName" select="yourCalculation" />

-          Use the Xpath builder to assist in the calculation writing.

Xpath calculation

-          In the calculation, use /dsQueryResponse/Rows/Row in order to go through all items.

-          If you are dealing with string values, add normalize-space to the calculation.

For our sample:

<xsl:variable name="CompletedCount" select="count (/dsQueryResponse/Rows/Row [normalize-space(@Status) = 'Completed'])" />

XSL calculation

Delete/ replace irrelevant tags

To select a tag, right click a tag name and choose select tag. Then, delete/ replace it.

On dvt_1 template:

-          Delete the <xsl:call-template name="dvt_1.body"> tag

-          Replace the <tr> tag with :

<tr  valign="top"> <td>  <!-- Graph Code -->   </td> </tr>

Out of dvt_1 template:

-          Delete <xsl:template name="dvt_1.body"> tag

-          Delete <xsl:template name="dvt_1.rowview"> tag

It should look like that:

XSL after delition

Step 3: modify visifire HTML

Link to the right resource

Modify the links to resources so they have the path to their location in your SharePoint library. For example:

src="Visifire2.js   >    src="../SiteResources/Visifire2.js"

Visifire2("SL.Visifire.Charts.xap" > Visifire2("../SiteResources/SL.Visifire.Charts.xap"

Add JS variables to connect between XSL and graph

All the variables that we created on step 2 calculations, have to be read by the graph JS. So we will “translate” it:

-          Under <script language="javascript" type="text/javascript"> line, add new variable for each calculation variable in the XSL. for example:

var VariableName = <xsl:value-of select="$XSLVariableName" />;

JS variables 

Put your variables into place

Replace the Yvalue with your new variables:

YValue="'15"     >     YValue="'+YourVariable+'"

Graph Values 

The whole code should look like that:

Graph final code

Insert modified code

-          Copy the modified HTML under the <!-- Graph Code --> in the data view XSL.

XSL and JS 

Step 4: E Viola!

-          Save and publish if needed

-          Your new graph is ready J

 

final graph      

 

Comments

jorge said:

great post, good work!

# May 27, 2009 10:01 AM

DavidBi said:

Elad, Great post and great solution. You are really the Macgyver of SharePoint

# May 27, 2009 10:07 AM

Chuka Arinze said:

Please advice how to create charts where you have very complex dataviews that have group column totals. your ideas will be highly appreciated.

# July 2, 2009 6:28 PM

Eladb said:

Hi Chuka,

1. In the second phase, create the basic variables as descibed ('do your calculations').

2.  create new variables that their value is a calculation between the existing ones.

hope it helps,

Elad

# July 19, 2009 6:37 PM

MichaellaS said:

tks for the effort you put in here I appreciate it!

# July 21, 2009 11:59 AM

Vartcrock said:

It took me 1 hour to create it, please rate it :)

www.youtube.com/watch

# October 28, 2009 3:10 AM

Mateacult said:

If you know someone around you who is being a little shady and you are getting uncomfortable around them, then maybe you might want to run a small background report on the person in question to make sure that they are 'who they say they are'.

Many people misrepresent themselves as the situation benefits them

His/her cellphone is often switched off when you are trying to get into contact.

Your spouse is particularly attentive or particularly inattentive towards you.

Your spouse tries to pick fights with you so that he/she can storm out of the house and disappear for a few hours.

If any of the above topics rings bell for you, its TIME for you to request us to find more about cheating spouse.

<a href=http://www.hirehackerz.com><u><b>www.hirehackerz.com</b></u></a>

# November 6, 2009 12:57 PM

alaccefneal said:

Found this great Christmas site and want to share it with you... has recipes, videos of christmas houses and lights, cooking how to videos for the holidays and a great selection of Christmas decorations and gifts for everyone.

The website is  <a href=>"http://www.christmas2you.com"</a>

Again that address is  www.christmas2you.com

I hope you enjoy it as much as I did... got most of my shopping knocked out in one night this year.

# November 19, 2009 11:56 AM

Spoopefricion said:

I've heard about this game but i don't know anything about it, can anybody tell me few words for it? Here is it for those who don't know what im talking about, <a href=http://www.mahjongclub.net>Mahjong</a>.

Thank you in advace, i'll appreciate every review about it!

# November 19, 2009 1:21 PM

tupeeteld said:

Did you see the new p.kg mp3 player? I got it playing at work (couldn't get other to work properly as I'm not allowed to install anything here).

# November 25, 2009 5:04 AM

Laurryrostuth said:

Hi!

I'm looking for http://www.michaelmceleney.com - Iowa City Homes

# December 8, 2009 7:38 PM

avoifyalalP said:

Hello.

I'm still looking for www.jlbuildingsupplies.com - Bay Window

Could you help me?

# December 9, 2009 3:50 PM

Insofsentinge said:

Hey there,

I've been following this forum for awhile and thought I'd sign up and see if I can contribute anything... I work in the <a href=www.strokeprevention.ie/>health screening</a> industry. Thanks!

Kindly,

Kylebolt

# December 9, 2009 9:36 PM

Famesteap said:

Altered zealand urban area, innocent appellation, principal someone is concerned townhouses, apartment, etc. Hard feelings network threats. Task evolve, http://www.atlantic-it.net - Outsourced IT Service,website design and requisite requests of any size. Developing projects with higher. Dio singular problem and collectors item.

# December 17, 2009 11:41 AM

MUGGAMILELD said:

Before your next dinner party or teakrefinishing.blogspot.com - teak restoration memorable companions arrives, we make your teak furniture look like new. Craft was in keen latin aqua throughout seven years and has been in brackish o looking for six years. But where you start depends on your budget and your tastes.

# December 19, 2009 2:29 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)