Sign in to follow this  
sami.khan

Problem while accessing the SharePoint List items in Fusion charts

Recommended Posts

Dear All,

I am using SharePoint 2007 with quest web parts for SharePoint. I hav made a Gantt chart based on the task list of the SharePoint.The chart gets displayed fine for the first four enteries in the list...But when it comes to the fifth recored, the fifth recored is skipped and the it picks the sixth one.For the sixth recored it picks the seventh one and so on...Here is the code which i have written ....

<script type="text/javascript">
var StartDate;
var EndDate;
var Task;
var found=false;
var myData = new Array();
var i=0;
var x=0;
var myData1= new Array();
var j=0;
var k=0;
var l=0;
var found2=false;
var strXML="<chart dateFormat='dd/mm/yyyy' caption='Project Gantt' subCaption='From 1st Jan 2009 - 31st Dec 2009' palette='3'>";
strXML=strXML+ "<categories>";
strXML=strXML+ "<category start='01/01/2009' end='01/02/2009' label='Jan' />";
strXML=strXML+ "<category start='01/02/2009' end='01/03/2009' label='Feb' />";
strXML=strXML + "<category start='01/03/2009' end='01/04/2009' label='Mar' />";
strXML=strXML + "<category start='01/04/2009' end='01/05/2009' label='Apr' />";
strXML=strXML + " <category start='01/05/2009' end='01/06/2009' label='May' />";
strXML=strXML + "<category start='01/06/2009' end='01/07/2009' label='Jun' />";
strXML=strXML + " <category start='01/07/2009' end='01/08/2009' label='Jul' />";
strXML=strXML + "<category start='01/08/2009' end='01/09/2009' label='Aug' />";
strXML=strXML + "<category start='01/09/2009' end='01/10/2009' label='Sep' />";
strXML=strXML + "<category start='01/10/2009' end='01/11/2009' label='Oct' />";
strXML=strXML + "<category start='01/11/2009' end='01/12/2009' label='Nov' />";
strXML=strXML + "<category start='01/12/2009' end='31/12/2009' label='Dec' />";
strXML=strXML+ "</categories>";


StartDate="<%Start Date%>";
EndDate="<%Due Date%>";
Task= "<%Title%>";
for(x in myData)
{
if(myData[x][0] == StartDate && !found)
{
myData[x][1]=EndDate;
found=true;
}
}
if(!found)
{
myData[i]=new Array();
myData[i][0]=StartDate;
myData[i][1]= EndDate;
i++;
}
found=false;
for(j in myData1)
{
if (myData[j] == Task && !found2)
{
myData1[j]= Task;
found2=true;
}
}
if(!found2)
{
myData1[k]= new Array();
myData1[k]=Task;
k++;
}
found2=false;


strXML=strXML+ "<processes fontSize='12' isBold='1' align='left' headerText='Tasks' headerAlign='left' headerFontSize='14'>";
for(j in myData1)
{
strXML=strXML+ "<process label='"+ myData1[j]+"' />";
}
strXML=strXML+ "</processes>";
strXML=strXML+ "<tasks>";
for (l in myData)
{
strXML=strXML+ "<task start='"+myData[l][0]+"' end='"+myData[l][1]+"' />";
}
strXML=strXML+ "</tasks>";
strXML=strXML+ "</chart>";
</script>

[/Code]

Could anyone of you please reply to me stating why it doesn't picks the proper recored.

Thanks

Sami

Share this post


Link to post
Share on other sites

Thanks Rahul for the reply.I have correted my code and is working fine ...Here the issue was...

Code with fault:

for(x in myData)

{

if(myData[x][0] == StartDate && !found)

{

myData[x][1]=EndDate;

found=true;

}

}

 

Correct Code:

for(x in myData)

{

if((myData[x][0] == StartDate && myData[x][1] == EndDate) && !found)

{

myData[x][0]=myData[x][0]+1;

myData[x][1]=myData[x][1]+1;

 

found=true;

}

}

 

Sami.

Share this post


Link to post
Share on other sites
Guest Rajroop

Hello all,

 

We proudly announce the release of FusionCharts for SharePoint in beta. FusionCharts for SharePoint helps you create interactive & data-driven charts in SharePoint, without having to write a line of code. The charts are created using a wizard and can connect to various data sources such as SharePoint Lists, CSV, MS SQL, Oracle, Excel & BDC. You can add drill-down and export capabilities to each chart and configure both cosmetic and functional aspects.

 

 

You can download the fully-functional version from www.fusioncharts.com/sharepoint - we would love to have your feedback on this.

 

Please post your suggestions and any bugs as replies to the forum thread at:

FusionCharts for SharePoint beta impression

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this