var i,
result = [],
current,
propCounter,
content = [
{
"name": "5-HP-N/A-N/A-F8",
"node": {
"name": "5",
"id": 14
},
"timeline": {
"epc": null,
"m1": null,
"m2": null,
"m3": 1554087600000,
"m4": 1593572400000,
"m5": 1625108400000,
"m6": 1641006000000,
"m7": 1656644400000
},
"fab": {
"name": "F8",
"id": 1
}
},
{
"name": "7-HP-N/A-N/A-F8",
"node": {
"name": "7",
"id": 15
},
"timeline": {
"epc": null,
"m1": null,
"m2": null,
"m3": 1491015600000,
"m4": 1530414000000,
"m5": 1561950000000,
"m6": 1577847600000,
"m7": 1593572400000
},
"fab": {
"name": "F8",
"id": 1
}
},
{
"name": "5-XM-N/A-PLT-F8",
"node": {
"name": "5",
"id": 14
},
"timeline": {
"epc": null,
"m1": null,
"m2": null,
"m3": 1554087600000,
"m4": 1593572400000,
"m5": 1625108400000,
"m6": 1641006000000,
"m7": 1656644400000
},
"fab": {
"name": "F8",
"id": 1
}
},
{
"name": "40-LP-TFS-FSL-F7",
"node": {
"name": "40",
"id": 4
},
"timeline": {
"epc": 1349060400000,
"m1": null,
"m2": null,
"m3": 1262314800000,
"m4": 1301626800000,
"m5": 1333249200000,
"m6": 1341111600000,
"m7": 1357009200000
},
"fab": {
"name": "F7",
"id": 3
}
},
{
"name": "40-LP-SST-TI-F7",
"node": {
"name": "40",
"id": 4
},
"timeline": {
"epc": 1349060400000,
"m1": null,
"m2": null,
"m3": 1262314800000,
"m4": 1301626800000,
"m5": 1333249200000,
"m6": 1341111600000,
"m7": 1357009200000
},
"fab": {
"name": "F7",
"id": 3
}
},
{
"name": "28-LPQ-TN3-QCOM-F1",
"node": {
"name": "28",
"id": 2
},
"timeline": {
"epc": 1349060400000,
"m1": null,
"m2": null,
"m3": 1285902000000,
"m4": 1325386800000,
"m5": 1357009200000,
"m6": 1372647600000,
"m7": 1388545200000
},
"fab": {
"name": "F1",
"id": 2
}
}];
getMileStone = function(obj) {
propCounter = 1;
increase = 0;
for (increase = 0; increase <= 7; increase++) {
if (obj.timeline["m" + propCounter]) {
for (propCounter = 1; propCounter <= 7; propCounter++) {
if ((obj.timeline["m" + propCounter]) != null) {
return { key: "m" + propCounter, value: obj.timeline["m" + propCounter] };
}
//If has a value, return
//Else, increment
}//End of inner for loop
}
increase++;
}//End outer for loop
};//End of getMileStone function
//This Counter will allow for multiple entries in JSON library
for(i=0;i< content.length;i++) {
current = content[i];
firstMileStone = getMileStone(current);
endMileStone = getMileStone(current);
result.push({
'start': new Date(firstMileStone.value),
'end': new Date(endMileStone.value),
'content': firstMileStone.key,
'group' : current.name,
'className' : firstMileStone.key
});
}
And I need the following format exactly for the Chap-Links timeline to work. The start date should be the first milestone which is not null. The enddate should be the second milestone which is non-null. M7 is never a start date, but rather end milestone only. Only EPC, M1, and M2 may have null values.
My problem is: I cannot get the conditions or formatting just right. I can get a single event from each 'group', but these will be displayed inline, so I need an object from each fitting event. I have some Java experience but almost no web experience and so am learning. Also, how can I get the x-axis to float on top and remain visible when scrolling down? This done in CSS or javascript? I originally had other else statements too, but every one was throwing errors, especially when related to the date values.
http://almende.githu...s/timeline/doc/
var data = [];
data.push({
'start': new Date(2010, 7, 15),
'end': new Date(2010, 8, 2), // end is optional
'content': 'Trajectory A'
// Optional: a parameter 'group'
// Optional: a parameter 'className'
});

New Topic/Question
Reply


MultiQuote


|