Skip to content

Commit

Permalink
complete nearly all except the time trend view
Browse files Browse the repository at this point in the history
  • Loading branch information
Lamentations committed May 28, 2016
1 parent ed78e8f commit 88a218c
Show file tree
Hide file tree
Showing 9 changed files with 1,625 additions and 151 deletions.
72 changes: 62 additions & 10 deletions code/static/js/impact.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,40 @@ function initResTime(){
plotLines:[{
color: '#FF0000',
value: 0.9,
width: 2
width: 2,
label:{
text:"90%",
x:-5
}
}]
},
xAxis:{
title: {
text: 'days',
align: 'low',
margin:0,
offset:20
}
},
tooltip:{
shared:true,
formatter:function(){
var s = '<b>' + this.y*100 + '%</b> Bugs Get Resolved in' ;
$.each(this.points, function () {
s += '<br/>' + this.series.name + ': ' +
this.x + 'days ';
});
var s = '<b>' + this.y*100 + '%</b> Bugs Get Resolved in<br/>'+ this.x + 'days ';
return s;
}
},
credits: {
enabled:false
},
series: []
series: [],
legend: {
labelFormatter: function () {
var text = this.name,
formatted = text.length > 25 ? text.substring(0, 25) + '...' : text;

return '<div class="js-ellipse" style="max-width:50px; overflow:hidden" title="' + text + '">' + formatted + '</div>';
},
useHTML:true
}
});
}
function initSelTran(){
Expand All @@ -57,7 +73,12 @@ function initResRate(){

$('#res-rate-wrap').highcharts({
chart: {
type: 'bar'
type: 'bar',
events: {
load: function (event) {
$('.js-ellipse').tooltip();
}
}
},
title: {
text: null,
Expand All @@ -82,6 +103,21 @@ function initResRate(){
offset:20
},
},
xAxis:{
categories:[],
labels: {
formatter: function () {
var text = this.value,
formatted = text.length > 25 ? text.substring(0, 25) + '...' : text;

return '<div class="js-ellipse" style="width:20px; overflow:hidden" title="' + text + '">' + formatted + '</div>';
},
style: {
width: '150px'
},
useHTML: true
}
},
legend: {
reversed: true,
verticalAlign: 'top',
Expand Down Expand Up @@ -142,6 +178,18 @@ function initResRate(){
}]
});
}
function parseSelectors(selectors){
var retStr = "";
for(var s in selectors){
if(s != "tranStr"){
retStr += selectors[s] + " ";
}
}
if(retStr == ""){
retStr = "All";
}
return retStr;
}
function drawResRate(){

initSelTran();
Expand Down Expand Up @@ -170,6 +218,9 @@ function drawResRate(){
}
}
}
var oldCat = chart.xAxis[0].categories;
oldCat.push(parseSelectors(selectors));
chart.xAxis[0].setCategories(oldCat)
chart.redraw();
},
"json"
Expand All @@ -183,7 +234,8 @@ function drawResTime(){
"/api/restime",
selectors,
function(data){
chart.addSeries({data:data});
var newName = parseSelectors(selectors);
chart.addSeries({data:data,name:newName});
},
"json"
);
Expand Down
24 changes: 19 additions & 5 deletions code/static/js/workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ function parseTree(d){
var tagDict = {
"NEW":"NEW","ASSIGNED":"ASS","UNCONFIRMED":"UNC","RESOLVED":"RES","VERIFIED":"VER","REOPENED":"REO","CLOSED":"CLO"
}
console.log(d);
//build a tree
var nodeId = 0;
var rr = {"child":{},"tag":"root",id:nodeId++};
Expand All @@ -16,6 +15,7 @@ function parseTree(d){
var endInd = tranArr.length - 1;
//iterate through a transition str
for (var i in tranArr){
i = parseInt(i);
var curTran = tranArr[i];
// check whether to merge the node
// find a node to merge
Expand All @@ -27,12 +27,26 @@ function parseTree(d){
oldGap = curNode["child"][curTran]["ts"];
newGap = tranAttr["ts"][i];
gapDiff = Math.abs(oldGap-newGap);
var newNextTS;
if(i < tranAttr["ts"].length-1){
newNextTS = tranAttr["ts"][i+1];
}
else{
newNextTS = 999999;
}
var nextNode = curNode["child"][curTran];
var oldNextTS = 999999;
for (var nextStr in nextNode.child){
if(nextStr != "END"){
oldNextTS = Math.min(nextNode.child[nextStr].ts,oldNextTS);
}
}
var nextMinTS = Math.min(oldNextTS,newNextTS);
if(tranStr == "ASSIGNED"){
console.log(gapDiff);
console.log(tranAttr);
console.log(nextMinTS);
}
// if the gap difference is small, merge
if(i < tranAttr["ts"].length-1 && gapDiff < tranAttr["ts"][i+1] * mergeThres){
if(gapDiff < nextMinTS * mergeThres){
break;
}
else{
Expand Down Expand Up @@ -520,7 +534,6 @@ function drawWorkFlow(d,svgAttr,svgId){
$(".nodeTrigger").mousedown(function(event){
if(event.button==0){
var nodeId = parseInt($(this).attr("id").substr(1));
//console.log($(this).attr("id"));
if($.inArray(nodeId, activeArr) < 0){
return;
}
Expand Down Expand Up @@ -566,6 +579,7 @@ function drawWorkFlow(d,svgAttr,svgId){
activeChildren(0);
});
$("#wf-cancel").click(function(){
selectors.tranStr = new Array();
recoverTree();
});
var oldColor = null;
Expand Down
3 changes: 1 addition & 2 deletions code/templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,7 @@ <h4 style="margin-top:5px">Resolve Time</h4>
var selectors = {};
var timeTotalData = {{ selInfo.totalNum|tojson|safe }};
var wfData = {{ workflowData|tojson|safe }};


console.log(wfData);
var svgWidth = parseInt($("#svg-wrap").css("width")) - parseInt($("#svg-wrap").css("padding-left")) - parseInt($("#svg-wrap").css("padding-right"));
var svgHeight = parseInt($("#svg-wrap").css("height")) - parseInt($("#svg-wrap").css("padding-bottom")) - parseInt($("#svg-wrap").css("padding-top"));

Expand Down
49 changes: 48 additions & 1 deletion code/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,54 @@
<script>
var chartHeight = (parseInt($('#fix-time-wrap').css("width")) * 0.7) + "px";
$('#fix-time-wrap').css("height",chartHeight);
var data = [[0,0],[809,0.1],[909,0.2],[1009,0.3],[1909,0.4],[10009,0.5],[11009,0.6],[12009,0.7],[13009,0.8],[14009,0.9],[14909,1]]
var data = [[0,0],[809,0.1],[909,0.2],[1009,0.3],[1909,0.4],[10009,0.5],[11009,0.6],[12009,0.7],[13009,0.8],[14009,0.9],[14909,1]];

$('#fix-time-wrap').highcharts({
chart:{type:"line"},
title: {
text:null,
margin:0
},
yAxis: {
title: {
enabled:false
},
labels: {
formatter: function() {
return ((this.value) * 100) + "%";
}
},
plotLines:[{
color: '#FF0000',
value: 0.9,
width: 2
}]
},
xAxis:{
title: {
text: 'days',
align: 'low',
margin:0,
offset:10
}
},
tooltip:{
shared:true,
formatter:function(){
var s = '<b>' + this.y*100 + '%</b> Bugs Get Resolved in' ;
$.each(this.points, function () {
s += '<br/>' + this.series.name + ': ' +
this.x + 'days ';
});
return s;
}
},
credits: {
enabled:false
},
series: [{data:[[1,2],[1,3]],name:"asdasdasdasdasdasdadadadadadad"}]
});


function addResolveSeries(newData,chart){
//add another line to the chart
Expand Down
4 changes: 2 additions & 2 deletions code/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ def processWFdata(rawD):

for tran,num in sizeList:
medianArr = [0,]
medianArr.extend([float(x/(divisor)) for x in medianDF[tran].values if x != -1])
medianArr.extend([(float(x) / divisor) for x in medianDF[tran].values if x != -1])
meanArr = [0,]
meanArr.extend([float(x/(divisor)) for x in meanDF[tran].values if x != -1])
meanArr.extend([(float(x) / divisor) for x in meanDF[tran].values if x != -1])
rtData[tran] = {"num":num,"ts":medianArr,"meants":meanArr}
curNum += num
curStr += 1
Expand Down
Loading

0 comments on commit 88a218c

Please sign in to comment.