corrected demo data as suggested by jacopo
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk/specialpurpose@604760 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -3,38 +3,38 @@
|
||||
|
||||
<!-- Resources -->
|
||||
<!-- Demo Employee1 -->
|
||||
<Party partyId="DemoEmployee1" partyTypeId="PERSON" statusId="PARTY_ENABLED" createdDate="2007-12-16 10:01:45.941" createdByUserLogin="admin" lastModifiedDate="2007-12-16 10:01:45.941" lastModifiedByUserLogin="admin" lastUpdatedStamp="2007-12-16 10:01:46.118" lastUpdatedTxStamp="2007-12-16 10:01:45.919" createdStamp="2007-12-16 10:01:46.118" createdTxStamp="2007-12-16 10:01:45.919"/>
|
||||
<Person partyId="DemoEmployee1" firstName="Peter" lastName="Manager" lastUpdatedStamp="2007-12-16 10:01:46.483" lastUpdatedTxStamp="2007-12-16 10:01:45.919" createdStamp="2007-12-16 10:01:46.483" createdTxStamp="2007-12-16 10:01:45.919"/>
|
||||
<UserLogin userLoginId="DemoEmployee1" currentPassword="47ca69ebb4bdc9ae0adec130880165d2cc05db1a" lastUpdatedStamp="2007-12-16 10:01:47.444" lastUpdatedTxStamp="2007-12-16 10:01:45.919" createdStamp="2007-12-16 10:01:47.444" createdTxStamp="2007-12-16 10:01:45.919" partyId="10010"/>
|
||||
<Party partyId="DemoEmployee1" partyTypeId="PERSON" statusId="PARTY_ENABLED" />
|
||||
<Person partyId="DemoEmployee1" firstName="Peter" lastName="Manager" />
|
||||
<UserLogin userLoginId="DemoEmployee1" partyId="DemoEmployee1" currentPassword="47ca69ebb4bdc9ae0adec130880165d2cc05db1a"/>
|
||||
<PartyRole partyId="DemoEmployee1" roleTypeId="EMPLOYEE"/>
|
||||
<PartyContactMech partyId="DemoEmployee1" contactMechId="9020" fromDate="2007-12-16 10:01:48.933" roleTypeId="EMPLOYEE" lastUpdatedStamp="2007-12-16 10:01:48.933" lastUpdatedTxStamp="2007-12-16 10:01:45.919" createdStamp="2007-12-16 10:01:48.933" createdTxStamp="2007-12-16 10:01:45.919"/>
|
||||
<PartyContactMech partyId="DemoEmployee1" contactMechId="9001" fromDate="2007-12-16 10:01:48.933" roleTypeId="EMPLOYEE" lastUpdatedStamp="2007-12-16 10:01:48.933" lastUpdatedTxStamp="2007-12-16 10:01:45.919" createdStamp="2007-12-16 10:01:48.933" createdTxStamp="2007-12-16 10:01:45.919"/>
|
||||
<PartyContactMech partyId="DemoEmployee1" contactMechId="9023" fromDate="2007-12-16 10:01:48.933" roleTypeId="EMPLOYEE" lastUpdatedStamp="2007-12-16 10:01:48.933" lastUpdatedTxStamp="2007-12-16 10:01:45.919" createdStamp="2007-12-16 10:01:48.933" createdTxStamp="2007-12-16 10:01:45.919"/>
|
||||
<PartyContactMech partyId="DemoEmployee1" contactMechId="9020" fromDate="2000-01-01 10:01:48.933" roleTypeId="EMPLOYEE" />
|
||||
<PartyContactMech partyId="DemoEmployee1" contactMechId="9001" fromDate="2000-01-01 10:01:48.933" roleTypeId="EMPLOYEE" />
|
||||
<PartyContactMech partyId="DemoEmployee1" contactMechId="9023" fromDate="2000-01-01 10:01:48.933" roleTypeId="EMPLOYEE" />
|
||||
<PartyRole partyId="DemoEmployee1" roleTypeId="PROVIDER_MANAGER"/>
|
||||
<!-- Demo Employee2 -->
|
||||
<Party partyId="DemoEmployee2" partyTypeId="PERSON" statusId="PARTY_ENABLED" createdDate="2007-12-16 10:01:45.941" createdByUserLogin="admin" lastModifiedDate="2007-12-16 10:01:45.941" lastModifiedByUserLogin="admin" lastUpdatedStamp="2007-12-16 10:01:46.118" lastUpdatedTxStamp="2007-12-16 10:01:45.919" createdStamp="2007-12-16 10:01:46.118" createdTxStamp="2007-12-16 10:01:45.919"/>
|
||||
<Person partyId="DemoEmployee2" firstName="Jo" lastName="Analist" lastUpdatedStamp="2007-12-16 10:01:46.483" lastUpdatedTxStamp="2007-12-16 10:01:45.919" createdStamp="2007-12-16 10:01:46.483" createdTxStamp="2007-12-16 10:01:45.919"/>
|
||||
<Party partyId="DemoEmployee2" partyTypeId="PERSON" statusId="PARTY_ENABLED" />
|
||||
<Person partyId="DemoEmployee2" firstName="Jo" lastName="Analist" />
|
||||
<UserLogin userLoginId="DemoEmployee2" partyId="DemoEmployee2" currentPassword="47ca69ebb4bdc9ae0adec130880165d2cc05db1a"/>
|
||||
<PartyRole partyId="DemoEmployee2" roleTypeId="EMPLOYEE"/>
|
||||
<UserLogin userLoginId="DemoEmployee2" currentPassword="47ca69ebb4bdc9ae0adec130880165d2cc05db1a" lastUpdatedStamp="2007-12-16 10:01:47.444" lastUpdatedTxStamp="2007-12-16 10:01:45.919" createdStamp="2007-12-16 10:01:47.444" createdTxStamp="2007-12-16 10:01:45.919" partyId="10010"/>
|
||||
<PartyContactMech partyId="DemoEmployee2" contactMechId="9020" fromDate="2007-12-16 10:01:48.933" roleTypeId="EMPLOYEE" lastUpdatedStamp="2007-12-16 10:01:48.933" lastUpdatedTxStamp="2007-12-16 10:01:45.919" createdStamp="2007-12-16 10:01:48.933" createdTxStamp="2007-12-16 10:01:45.919"/>
|
||||
<PartyContactMech partyId="DemoEmployee2" contactMechId="9001" fromDate="2007-12-16 10:01:48.933" roleTypeId="EMPLOYEE" lastUpdatedStamp="2007-12-16 10:01:48.933" lastUpdatedTxStamp="2007-12-16 10:01:45.919" createdStamp="2007-12-16 10:01:48.933" createdTxStamp="2007-12-16 10:01:45.919"/>
|
||||
<PartyContactMech partyId="DemoEmployee2" contactMechId="9023" fromDate="2007-12-16 10:01:48.933" roleTypeId="EMPLOYEE" lastUpdatedStamp="2007-12-16 10:01:48.933" lastUpdatedTxStamp="2007-12-16 10:01:45.919" createdStamp="2007-12-16 10:01:48.933" createdTxStamp="2007-12-16 10:01:45.919"/>
|
||||
<PartyContactMech partyId="DemoEmployee2" contactMechId="9020" fromDate="2000-01-01 10:01:48.933" roleTypeId="EMPLOYEE" />
|
||||
<PartyContactMech partyId="DemoEmployee2" contactMechId="9001" fromDate="2000-01-01 10:01:48.933" roleTypeId="EMPLOYEE" />
|
||||
<PartyContactMech partyId="DemoEmployee2" contactMechId="9023" fromDate="2000-01-01 10:01:48.933" roleTypeId="EMPLOYEE" />
|
||||
<PartyRole partyId="DemoEmployee2" roleTypeId="PROVIDER_ANALYST"/>
|
||||
<!-- Demo customer -->
|
||||
<PartyRole partyId="DemoCustomer" roleTypeId="CLIENT_MANAGER"/>
|
||||
|
||||
<!-- Demo project, phases and tasks -->
|
||||
<WorkEffort workEffortId="9000" workEffortTypeId="PROJECT" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 15:07:52.901" scopeEnumId="WES_PUBLIC" workEffortName="Demo Project" estimatedStartDate="2007-12-18 00:00:00.0" estimatedCompletionDate="2007-12-05 00:00:00.0" revisionNumber="2" createdDate="2007-12-14 15:07:52.901" createdByUserLogin="admin" lastModifiedDate="2007-12-15 07:47:57.609" lastModifiedByUserLogin="admin" lastUpdatedStamp="2007-12-15 07:47:57.615" lastUpdatedTxStamp="2007-12-15 07:47:57.175" createdStamp="2007-12-14 15:07:52.901" createdTxStamp="2007-12-14 15:07:52.435"/>
|
||||
<WorkEffort workEffortId="9001" workEffortTypeId="PHASE" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:14.226" workEffortParentId="9000" workEffortName="phase1" revisionNumber="1" createdDate="2007-12-14 16:45:14.226" createdByUserLogin="admin" lastModifiedDate="2007-12-14 16:45:14.226" lastModifiedByUserLogin="admin" lastUpdatedStamp="2007-12-14 16:45:14.226" lastUpdatedTxStamp="2007-12-14 16:45:13.956" createdStamp="2007-12-14 16:45:14.226" createdTxStamp="2007-12-14 16:45:13.956"/>
|
||||
<WorkEffort workEffortId="9002" workEffortTypeId="TASK" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:21.831" workEffortParentId="9001" scopeEnumId="WES_PUBLIC" workEffortName="task1" estimatedStartDate="2007-12-03 00:00:00.0" estimatedCompletionDate="2007-12-05 00:00:00.0" revisionNumber="2" createdDate="2007-12-14 16:45:21.831" createdByUserLogin="admin" lastModifiedDate="2007-12-14 17:15:47.898" lastModifiedByUserLogin="admin" lastUpdatedStamp="2007-12-14 17:15:47.9" lastUpdatedTxStamp="2007-12-14 17:15:47.659" createdStamp="2007-12-14 16:45:21.833" createdTxStamp="2007-12-14 16:45:21.827"/>
|
||||
<WorkEffort workEffortId="9003" workEffortTypeId="TASK" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:29.453" workEffortParentId="9001" scopeEnumId="WES_PUBLIC" workEffortName="task2" estimatedStartDate="2007-12-05 00:00:00.0" estimatedCompletionDate="2007-12-16 00:00:00.0" revisionNumber="2" createdDate="2007-12-14 16:45:29.453" createdByUserLogin="admin" lastModifiedDate="2007-12-14 17:16:01.752" lastModifiedByUserLogin="admin" lastUpdatedStamp="2007-12-14 17:16:01.754" lastUpdatedTxStamp="2007-12-14 17:16:01.539" createdStamp="2007-12-14 16:45:29.453" createdTxStamp="2007-12-14 16:45:29.25"/>
|
||||
<WorkEffort workEffortId="9004" workEffortTypeId="PHASE" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:35.939" workEffortParentId="9000" workEffortName="phase2" revisionNumber="1" createdDate="2007-12-14 16:45:35.939" createdByUserLogin="admin" lastModifiedDate="2007-12-14 16:45:35.939" lastModifiedByUserLogin="admin" lastUpdatedStamp="2007-12-14 16:45:35.939" lastUpdatedTxStamp="2007-12-14 16:45:35.935" createdStamp="2007-12-14 16:45:35.939" createdTxStamp="2007-12-14 16:45:35.935"/>
|
||||
<WorkEffort workEffortId="9005" workEffortTypeId="TASK" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:50.84" workEffortParentId="9004" scopeEnumId="WES_PUBLIC" workEffortName="task3" estimatedStartDate="2007-12-16 00:00:00.0" estimatedCompletionDate="2007-12-17 00:00:00.0" revisionNumber="2" createdDate="2007-12-14 16:45:50.84" createdByUserLogin="admin" lastModifiedDate="2007-12-14 17:16:11.232" lastModifiedByUserLogin="admin" lastUpdatedStamp="2007-12-14 17:16:11.233" lastUpdatedTxStamp="2007-12-14 17:16:11.218" createdStamp="2007-12-14 16:45:50.841" createdTxStamp="2007-12-14 16:45:50.559"/>
|
||||
<WorkEffort workEffortId="9006" workEffortTypeId="TASK" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:58.857" workEffortParentId="9004" scopeEnumId="WES_PUBLIC" workEffortName="task4" estimatedStartDate="2007-12-18 00:00:00.0" estimatedCompletionDate="2007-12-20 00:00:00.0" revisionNumber="2" createdDate="2007-12-14 16:45:58.857" createdByUserLogin="admin" lastModifiedDate="2007-12-14 17:16:24.359" lastModifiedByUserLogin="admin" lastUpdatedStamp="2007-12-14 17:16:24.36" lastUpdatedTxStamp="2007-12-14 17:16:24.143" createdStamp="2007-12-14 16:45:58.858" createdTxStamp="2007-12-14 16:45:58.846"/>
|
||||
<WorkEffort workEffortId="9000" workEffortTypeId="PROJECT" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 15:07:52.901" scopeEnumId="WES_PUBLIC" workEffortName="Demo Project" revisionNumber="1"/>
|
||||
<WorkEffort workEffortId="9001" workEffortTypeId="PHASE" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:14.226" workEffortParentId="9000" workEffortName="phase1" revisionNumber="1" />
|
||||
<WorkEffort workEffortId="9002" workEffortTypeId="TASK" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:21.831" workEffortParentId="9001" scopeEnumId="WES_PUBLIC" workEffortName="task1" estimatedStartDate="2007-12-03 00:00:00.0" estimatedCompletionDate="2007-12-05 00:00:00.0" revisionNumber="1" />
|
||||
<WorkEffort workEffortId="9003" workEffortTypeId="TASK" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:29.453" workEffortParentId="9001" scopeEnumId="WES_PUBLIC" workEffortName="task2" estimatedStartDate="2007-12-05 00:00:00.0" estimatedCompletionDate="2007-12-16 00:00:00.0" revisionNumber="1" />
|
||||
<WorkEffort workEffortId="9004" workEffortTypeId="PHASE" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:35.939" workEffortParentId="9000" workEffortName="phase2" revisionNumber="1"/>
|
||||
<WorkEffort workEffortId="9005" workEffortTypeId="TASK" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:50.84" workEffortParentId="9004" scopeEnumId="WES_PUBLIC" workEffortName="task3" estimatedStartDate="2007-12-16 00:00:00.0" estimatedCompletionDate="2007-12-17 00:00:00.0" revisionNumber="1"/>
|
||||
<WorkEffort workEffortId="9006" workEffortTypeId="TASK" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:58.857" workEffortParentId="9004" scopeEnumId="WES_PUBLIC" workEffortName="task4" estimatedStartDate="2007-12-18 00:00:00.0" estimatedCompletionDate="2007-12-20 00:00:00.0" revisionNumber="1"/>
|
||||
|
||||
<!-- task dependencies -->
|
||||
<WorkEffortAssoc workEffortIdFrom="9002" workEffortIdTo="9003" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" sequenceNum="0" fromDate="2007-12-15 07:48:47.856" lastUpdatedStamp="2007-12-15 07:48:47.857" lastUpdatedTxStamp="2007-12-15 07:48:47.636" createdStamp="2007-12-15 07:48:47.857" createdTxStamp="2007-12-15 07:48:47.636"/>
|
||||
<WorkEffortAssoc workEffortIdFrom="9003" workEffortIdTo="9005" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" sequenceNum="0" fromDate="2007-12-15 07:56:09.61" lastUpdatedStamp="2007-12-15 07:56:09.61" lastUpdatedTxStamp="2007-12-15 07:56:09.414" createdStamp="2007-12-15 07:56:09.61" createdTxStamp="2007-12-15 07:56:09.414"/>
|
||||
<WorkEffortAssoc workEffortIdFrom="9005" workEffortIdTo="9006" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" sequenceNum="0" fromDate="2007-12-15 07:56:18.588" lastUpdatedStamp="2007-12-15 07:56:18.588" lastUpdatedTxStamp="2007-12-15 07:56:18.556" createdStamp="2007-12-15 07:56:18.588" createdTxStamp="2007-12-15 07:56:18.556"/>
|
||||
<WorkEffortAssoc workEffortIdFrom="9002" workEffortIdTo="9003" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" sequenceNum="0" fromDate="2000-01-01 00:00:00.0"/>
|
||||
<WorkEffortAssoc workEffortIdFrom="9003" workEffortIdTo="9005" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" sequenceNum="0" fromDate="2000-01-01 00:00:00.0"/>
|
||||
<WorkEffortAssoc workEffortIdFrom="9005" workEffortIdTo="9006" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" sequenceNum="0" fromDate="2000-01-01 00:00:00.0"/>
|
||||
|
||||
</entity-engine-xml>
|
||||
@@ -1,324 +0,0 @@
|
||||
dojo.require("dojo.collections.Store");
|
||||
dojo.require("dojo.charting.Chart");
|
||||
dojo.require('dojo.json');
|
||||
dojo.require("dojo.date.common");
|
||||
dojo.require("dojo.event.*");
|
||||
dojo.require("dojo.io.*");
|
||||
|
||||
var interv = dojo.date.dateParts.DAY;
|
||||
|
||||
|
||||
// our sample data for our gantt chart.
|
||||
|
||||
var docData = null;
|
||||
var xml = {
|
||||
url: "/projectmgr/js/data.xml",
|
||||
mimetype: "text/xml",
|
||||
load: callBack,
|
||||
error: function(type, error){
|
||||
dojo.debug("type: " + type);
|
||||
dojo.debug("error: " + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
dojo.io.bind(xml);
|
||||
|
||||
/*
|
||||
function xml2json(dataNode, json){
|
||||
var taskNodes = dataNode.getDocumentElement();
|
||||
// Convert the xml data to json
|
||||
for(var i = 0; i < taskNodes.length; i++){
|
||||
var taskNode = taskNodes.item(i);
|
||||
if(taskNode.childNodes.length){
|
||||
json.push({high: taskNode.attributes["end"], low: taskNode.attributes["start"], task: taskNode.attribute["label"], type: "p"});
|
||||
//Recursive call to crawl the dom
|
||||
xml2json(taskNode);
|
||||
}else{
|
||||
var dtStart = new Date(taskNode.attributes["start"]);
|
||||
var dtEnd = new Date(taskNode.attributes["end"]);
|
||||
json.push({high: dtEnd.getTime(), low: dtStart.getTime(), task: taskNode.attributes["label"], type: taskNode.attributes["type"]});
|
||||
}
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
*/
|
||||
function callBack(type, xmlDom, httpreq){
|
||||
|
||||
var taskNodes = xmlDom.getElementsByTagName("task");
|
||||
var json = [];
|
||||
|
||||
// Convert the xml data to json
|
||||
for(var i = 0; i < taskNodes.length; i++){
|
||||
var taskNode = taskNodes.item(i);
|
||||
var dtStart = new Date(taskNode.getAttribute("start"));
|
||||
var dtEnd = new Date(taskNode.getAttribute("end"));
|
||||
if(taskNode.childNodes.length){
|
||||
json.push({high: dtEnd.getTime(), low: dtStart.getTime(), task: taskNode.getAttribute("label"), type: "p"});
|
||||
}else{
|
||||
json.push({high: dtEnd.getTime(), low: dtStart.getTime(), task: taskNode.getAttribute("label"), type: taskNode.getAttribute("type")});
|
||||
}
|
||||
}
|
||||
|
||||
//Parameters
|
||||
var chartStart = new Date(taskNodes.item(0).getAttribute("start")); //Origin of the chart
|
||||
var dtEnd = new Date(taskNodes.item(taskNodes.length - 1).getAttribute("end")); //End of the chart
|
||||
// var duration = 14; //Duration of the chart
|
||||
//Calculated parameters
|
||||
var nbDays = dojo.date.diff(chartStart, dtEnd, interv);
|
||||
|
||||
var store = new dojo.collections.Store();
|
||||
store.setData(json);
|
||||
|
||||
// define the chart.
|
||||
var s1 = new dojo.charting.Series({
|
||||
dataSource:store,
|
||||
bindings:{ id:"id", high:"high", low:"low", label:"task", type:"type" },
|
||||
label:"Project tasks"
|
||||
});
|
||||
|
||||
// test the evaluate
|
||||
/*
|
||||
var data = s1.evaluate();
|
||||
var a=[];
|
||||
for(var i=0; i<data.length; i++){
|
||||
a.push("{ high:"+data[i].high +", low:"+data[i].low + ", label:"+data[i].label + "}");
|
||||
}
|
||||
alert("Data evaluation:\n"+a.join("\n"));
|
||||
*/
|
||||
|
||||
//////////////////////
|
||||
var data = s1.evaluate();
|
||||
|
||||
|
||||
//create the y-axis with task labels
|
||||
var yB2 = new dojo.charting.Axis();
|
||||
//Range is calculated to nbTasks * 10
|
||||
yB2.range={upper:parseInt(data.length * 30),lower:0};
|
||||
yB2.origin="min";
|
||||
yB2.showTicks = true;
|
||||
yB2.showLines = true;
|
||||
|
||||
for(var i=data.length-1; i>=0; i--){
|
||||
yB2.labels.push({ label: data[i].label, value: parseInt((data.length - i)*30) });
|
||||
}
|
||||
|
||||
//create the first x-axis (day-based)
|
||||
var xB = new dojo.charting.Axis();
|
||||
xB.range={upper:dtEnd.getTime(), lower:chartStart.getTime()};
|
||||
//setting the origin to more than y-axis.upper cause it to appear above the chart
|
||||
xB.origin = parseInt(yB2.range.upper + 30);
|
||||
xB.showTicks = true;
|
||||
xB.showLines = false;
|
||||
|
||||
var dtStart = chartStart;
|
||||
for(var i = 0; i < nbDays; i++){
|
||||
xB.labels.push({ label: dateFormat(dtStart, '!ddd'), value: dtStart.getTime() });
|
||||
dtStart = dojo.date.add(dtStart, interv, 1);
|
||||
}
|
||||
|
||||
//create the second x-axis (week-based)
|
||||
var xB2 = new dojo.charting.Axis();
|
||||
//use the same range as first axis
|
||||
xB2.range = xB.range;
|
||||
xB2.origin="min";
|
||||
xB2.showTicks = true;
|
||||
xB2.showLines = true;
|
||||
|
||||
dtStart = chartStart;
|
||||
for(var i = 0; i < nbDays; i++){
|
||||
if(dateFormat(dtStart, '!ddd') == "Mon"){
|
||||
xB2.labels.push({ label: dateFormat(dtStart, '!dd/!mm'), value: dtStart.getTime() });
|
||||
}
|
||||
dtStart = dojo.date.add(dtStart, interv, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//gantt series
|
||||
//to display second axis and labels on same chart, we need a first Plot object
|
||||
var p2 = new dojo.charting.Plot(xB2, yB2);
|
||||
|
||||
//The second Plot object hold the data Series
|
||||
var p3 = new dojo.charting.Plot(xB, yB2);
|
||||
p3.renderType = dojo.charting.RenderPlotSeries.Grouped;
|
||||
p3.addSeries({ data:s1, plotter: dojo.charting.Plotters.Gantt });
|
||||
|
||||
var pa2 = new dojo.charting.PlotArea();
|
||||
//Add the 2 Plot to the PlotArea
|
||||
pa2.plots.push(p2);
|
||||
pa2.plots.push(p3);
|
||||
|
||||
//Calculate chart height & width
|
||||
var chartH = data.length * 30;
|
||||
var chartW = nbDays * 50;
|
||||
|
||||
pa2.size={width:chartW, height:chartH};
|
||||
pa2.padding={top:30, right:30, bottom:30, left:60 };
|
||||
|
||||
// auto assign colors, and increase the step
|
||||
s1.color = pa2.nextColor();
|
||||
|
||||
// Create the Chart and add the PlotArea
|
||||
var chart = new dojo.charting.Chart(null, "Test chart", "This is a potential description");
|
||||
chart.addPlotArea({ x:0,y:0, plotArea:pa2 });
|
||||
|
||||
|
||||
dojo.addOnLoad(function(){
|
||||
chart.node = dojo.byId("chartTest1");
|
||||
chart.render();
|
||||
document.getElementById("chartTest1").setAttribute("style", "width:" + chartW + "; height:" + chartH + ";");
|
||||
document.getElementById("plotLabels1").setAttribute("style", "width:" + chartW + "; height:" + chartH + ";");
|
||||
//Call PlotArea.render with the custom function
|
||||
pa2.render(s1, customPlot);
|
||||
|
||||
});
|
||||
dojo.debug("--end callBack");
|
||||
}
|
||||
dojo.event.connect(dojo, "loaded", "init")
|
||||
|
||||
function loadData(){
|
||||
var xml = {
|
||||
url: "/projectmgr/js/data.xml",
|
||||
mimetype: "text/xml",
|
||||
load: function(type, xmlDom, httpreq){
|
||||
docData = xmlDom;
|
||||
dojo.debug("load " + docData);
|
||||
|
||||
// var params = new Array();
|
||||
// var content = navTreeProc.getResultString(xmlDom, params, document);
|
||||
},
|
||||
error: function(type, error){
|
||||
dojo.debug("type: " + type);
|
||||
dojo.debug("error: " + error);
|
||||
}
|
||||
}
|
||||
dojo.io.bind(xml);
|
||||
}
|
||||
|
||||
function customPlot(node, srcObject){
|
||||
//First solution for custom labels
|
||||
//Display labels in a div elt overlapping the graph
|
||||
|
||||
var x = parseInt(node.getAttribute("x"));
|
||||
var y = parseInt(node.getAttribute("y"));
|
||||
var width = parseInt(node.getAttribute("width")) - 10;
|
||||
|
||||
|
||||
if(srcObject.type == "p"){
|
||||
node.setAttribute("y", y + 15);
|
||||
node.setAttribute("rx", "10");
|
||||
node.setAttribute("ry", "10");
|
||||
node.setAttribute("height", "5");
|
||||
node.setAttribute("type", "arc");
|
||||
node.setAttribute("style", "fill:#000000;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000");
|
||||
// dojo.debug(srcObject.type);
|
||||
}else if(srcObject.type == "j"){
|
||||
node.setAttribute("x", x + 15);
|
||||
node.setAttribute("y", y + 10);
|
||||
node.setAttribute("rx", "10");
|
||||
node.setAttribute("ry", "10");
|
||||
node.setAttribute("width", "10");
|
||||
node.setAttribute("height", "10");
|
||||
node.setAttribute("type", "arc");
|
||||
node.setAttribute("style", "fill:#00FF00;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000");
|
||||
// dojo.debug(srcObject.type);
|
||||
}else{
|
||||
node.setAttribute("height", "20");
|
||||
}
|
||||
|
||||
var div = document.createElement("div");
|
||||
if(srcObject.type != "p"){
|
||||
if(srcObject.type == "j"){
|
||||
div.setAttribute("class", "milestone-label");
|
||||
x += 15;
|
||||
}else{
|
||||
div.setAttribute("class", "bar-label");
|
||||
}
|
||||
div.setAttribute("style", "top:" + parseInt(y + 4) + "px; left:" + parseInt(x + 5) + "px; width:" + width + "px");
|
||||
div.appendChild(document.createTextNode(srcObject.task));
|
||||
document.getElementById("plotLabels1").appendChild(div);
|
||||
}
|
||||
//connect the mouseover event to the task label
|
||||
dojo.event.connect(div, "onmouseover", dj_global, "onMouseOver");
|
||||
|
||||
}
|
||||
|
||||
function onMouseOver(evt){
|
||||
logMe(evt);
|
||||
}
|
||||
|
||||
function logMe(evt){
|
||||
// FIXME: it appears that we're not actually getting this passed from IE!?!
|
||||
//if(!evt){ evt = window.event; }
|
||||
dojo.debug(evt.type + ' was fired');
|
||||
/*
|
||||
lastEvt = dump(evt);
|
||||
for(var x in evt){
|
||||
dojo.debug(x+": "+evt[x]);
|
||||
}
|
||||
*/
|
||||
dojo.debug("some event was fired");
|
||||
}
|
||||
|
||||
function dateFormat(aDate, displayPat){
|
||||
/********************************************************
|
||||
* Valid Masks:
|
||||
* !mmmm = Long month (eg. January)
|
||||
* !mmm = Short month (eg. Jan)
|
||||
* !mm = Numeric date (eg. 07)
|
||||
* !m = Numeric date (eg. 7)
|
||||
* !dddd = Long day (eg. Monday)
|
||||
* !ddd = Short day (eg. Mon)
|
||||
* !dd = Numeric day (eg. 07)
|
||||
* !d = Numeric day (eg. 7)
|
||||
* !yyyy = Year (eg. 1999)
|
||||
* !yy = Year (eg. 99)
|
||||
********************************************************/
|
||||
|
||||
intMonth = aDate.getMonth();
|
||||
intDate = aDate.getDate();
|
||||
intDay = aDate.getDay();
|
||||
intYear = aDate.getFullYear();
|
||||
|
||||
var months_long = new Array ('January','February','March','April',
|
||||
'May','June','July','August','September','October','November','December')
|
||||
var months_short = new Array('Jan','Feb','Mar','Apr','May','Jun',
|
||||
'Jul','Aug','Sep','Oct','Nov','Dec')
|
||||
var days_long = new Array('Sunday','Monday','Tuesday','Wednesday',
|
||||
'Thursday','Friday','Saturday')
|
||||
var days_short = new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat')
|
||||
|
||||
var mmmm = months_long[intMonth]
|
||||
var mmm = months_short[intMonth]
|
||||
var mm = intMonth < 9?'0'+ (1 + intMonth) + '':(1+intMonth)+'';
|
||||
var m = 1+intMonth+'';
|
||||
var dddd = days_long[intDay];
|
||||
var ddd = days_short[intDay];
|
||||
var dd = intDate<10?'0'+intDate+'':intDate+'';
|
||||
var d = intDate+'';
|
||||
var yyyy = intYear;
|
||||
|
||||
century = 0;
|
||||
while((intYear-century)>=100)
|
||||
century = century + 100;
|
||||
|
||||
var yy = intYear - century
|
||||
if(yy<10)
|
||||
yy = '0' + yy + '';
|
||||
|
||||
displayDate = new String(displayPat);
|
||||
|
||||
displayDate = displayDate.replace(/!mmmm/i,mmmm);
|
||||
displayDate = displayDate.replace(/!mmm/i,mmm);
|
||||
displayDate = displayDate.replace(/!mm/i,mm);
|
||||
displayDate = displayDate.replace(/!m/i,m);
|
||||
displayDate = displayDate.replace(/!dddd/i,dddd);
|
||||
displayDate = displayDate.replace(/!ddd/i,ddd);
|
||||
displayDate = displayDate.replace(/!dd/i,dd);
|
||||
displayDate = displayDate.replace(/!d/i,d);
|
||||
displayDate = displayDate.replace(/!yyyy/i,yyyy);
|
||||
displayDate = displayDate.replace(/!yy/i,yy);
|
||||
|
||||
return displayDate;
|
||||
}
|
||||
Reference in New Issue
Block a user