You need to sign in to do that
Don't have an account?
JeffSR
Gantt chart showing multiple projects
I was trying to do this on Smartsheet but it will only create a gantt chart for a specific opportunity or account, etc.
How do you create a gantt chart that displays multiple opportunities? Essentially linking fields such as Opportunity Name, Start Date, Finish Date and % Complete of multiple opportunities in one gantt chart to show an operations schedule.
How do you create a gantt chart that displays multiple opportunities? Essentially linking fields such as Opportunity Name, Start Date, Finish Date and % Complete of multiple opportunities in one gantt chart to show an operations schedule.
Here is an example of two custom objects called Project and another called Milestone
Visualforce Pages
<apex:page standardController="PPM_Project__c" extensions="ganttChart" showHeader="false"> <img src="http://chart.apis.google.com/chart?cht=bhs&chs=800x200&chtt=Project Milestone Gantt Chart&chco=F3F3EC,000000,00FF00,FF0000,0000FF,FF6600&chd=t:{!WhiteData}|{!MilestoneData}&chdl=|Draft|Active|Completed|Cancelled|On-Hold&chxt=x,y&chxl=0:{!ProjectDateRange}1:{!MilestoneNames}&chf=bg,s,F3F3EC" /> </apex:page>
APEX CLASS
public class ganttChart {
public PPM_Project__c thisProject;
public List<Milestone__c> milestones;
public String projectId;
public ganttChart(ApexPages.Standardcontroller std)
{
projectId = std.getId();
thisProject = [select Id, Project_Start_Date__c, Project_End_Date__c from PPM_Project__c where Id = :projectId];
milestones = [select Id, Name, Project__c, Milestone_Start_Date__c, Milestone_End_Date__c, Milestone_Status__c from Milestone__c where Project__c = :projectId order by Milestone_Start_Date__c ASC];
}
public String getMilestoneData()
{
String milestoneData = '';
Integer counter = 0;
String draftData = '';
String activeData = '';
String completeData = '';
String cancelData = '';
String holdData = '';
for (Milestone__c m : milestones)
{
counter++;
Integer daysBetween = 2*m.Milestone_Start_Date__c.daysBetween(m.Milestone_End_Date__c);
if(m.Milestone_Status__c == 'Draft')
{
draftData += daysBetween;
activeData += '0';
completeData += '0';
cancelData += '0';
holdData += '0';
}
else if(m.Milestone_Status__c == 'Active')
{
draftData += '0';
activeData += daysBetween;
completeData += '0';
cancelData += '0';
holdData += '0';
}
else if(m.Milestone_Status__c == 'Completed')
{
draftData += '0';
activeData += '0';
completeData += daysBetween;
cancelData += '0';
holdData += '0';
}
else if(m.Milestone_Status__c == 'Cancelled')
{
draftData += '0';
activeData += '0';
completeData += '0';
cancelData += daysBetween;
holdData += '0';
}
else if(m.Milestone_Status__c == 'On-Hold')
{
draftData += '0';
activeData += '0';
completeData += '0';
cancelData += '0';
holdData += daysBetween;
}
if(counter != milestones.size())
{
draftData += ',';
activeData += ',';
completeData += ',';
cancelData += ',';
holdData += ',';
}
}
milestoneData = draftData + '|' + activeData + '|' + completeData + '|' + cancelData + '|' + holdData;
return milestoneData;
}
public String getWhiteData()
{
String whiteData = '';
Integer counter = 0;
for (Milestone__c m : milestones)
{
counter++;
Integer whiteSpace = 2*thisProject.Project_Start_Date__c.daysBetween(m.Milestone_Start_Date__c);
whiteData += whitespace;
if(counter != milestones.size())
{
whiteData += ',';
}
}
return whiteData;
}
public String getProjectDateRange()
{
String dateString = '|';
Integer projectDays = thisProject.Project_Start_Date__c.daysBetween(thisProject.Project_End_Date__c);
Integer interval = projectDays / 10;
Date tempDate = thisProject.Project_Start_Date__c;
for(Integer x = 1; x <= 10; x++)
{
dateString += tempDate.month() + '/' + tempDate.day() + '|';
tempDate = tempDate.addDays(interval);
}
dateString += thisProject.Project_End_Date__c.month() + '/' + thisProject.Project_End_Date__c.day() + '|';
return dateString;
}
public String getMilestoneNames()
{
String milestoneNames = '|';
for(Integer back = milestones.size() - 1; back >= 0; back--)
{
milestoneNames += milestones.get(back).Name + '|';
}
return milestoneNames;
}
}
How to increase height & width of Google Chat