OXIESEC PANEL
- Current Dir:
/
/
home
/
cubot
/
docroot
/
showcase
/
js
/
D3
/
plugins
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/14/2022 11:05:22 AM
rwxr-xr-x
📄
Radar.js
8.86 KB
08/14/2022 11:05:21 AM
rw-r--r--
📄
bar.js
17.59 KB
08/14/2022 11:05:19 AM
rw-r--r--
📄
bullet.css
422 bytes
08/14/2022 11:05:19 AM
rw-r--r--
📄
bullet.js
10.65 KB
08/14/2022 11:05:20 AM
rw-r--r--
📄
calendar.js
16.63 KB
08/14/2022 11:05:19 AM
rw-r--r--
📄
calender.css
541 bytes
08/14/2022 11:05:20 AM
rw-r--r--
📄
combo.js
16.74 KB
08/14/2022 11:05:20 AM
rw-r--r--
📄
combo_2.js
17.91 KB
08/14/2022 11:05:19 AM
rw-r--r--
📄
combo_wip.js
16.61 KB
08/14/2022 11:05:18 AM
rw-r--r--
📄
commonFunc.js
25.28 KB
08/14/2022 11:05:20 AM
rw-r--r--
📄
customChart.js
577 bytes
08/14/2022 11:05:20 AM
rw-r--r--
📄
d3Charts.css
2.88 KB
08/14/2022 11:05:19 AM
rw-r--r--
📄
donut.js
5.67 KB
08/14/2022 11:05:19 AM
rw-r--r--
📄
filledAreaPercent.js
17.95 KB
08/14/2022 11:05:19 AM
rw-r--r--
📄
funnel.js
6.03 KB
08/14/2022 11:05:20 AM
rw-r--r--
📄
funnel.js_previous_o4aug17
5.86 KB
08/14/2022 11:05:20 AM
rw-r--r--
📄
gauged.js
15.3 KB
08/14/2022 11:05:20 AM
rw-r--r--
📄
groupbar.js
13.18 KB
08/14/2022 11:05:19 AM
rw-r--r--
📄
groupbar_23Aug2019.js
10.85 KB
08/14/2022 11:05:18 AM
rw-r--r--
📄
heatmap.js
9.77 KB
08/14/2022 11:05:20 AM
rw-r--r--
📄
html2canvas.min.js
161.47 KB
08/14/2022 11:05:19 AM
rw-r--r--
📄
makeJson.js
1.64 KB
08/14/2022 11:05:19 AM
rw-r--r--
📄
makeJsonmulti.js
3.75 KB
08/14/2022 11:05:18 AM
rw-r--r--
📄
multiLine.js
17.24 KB
08/14/2022 11:05:20 AM
rw-r--r--
📄
multipleDonut.js
5.29 KB
08/14/2022 11:05:19 AM
rw-r--r--
📄
pie.js
4.52 KB
08/14/2022 11:05:20 AM
rw-r--r--
📄
radar.js
6.49 KB
08/14/2022 11:05:19 AM
rw-r--r--
📄
saveSvgAsPng.js
14.62 KB
08/14/2022 11:05:21 AM
rw-r--r--
📄
stackedAreaDate.js
17.56 KB
08/14/2022 11:05:20 AM
rw-r--r--
📄
stackedAreaDate_bkup23Nov2020.js
17.56 KB
08/14/2022 11:05:20 AM
rw-r--r--
📄
stackedbar.js
10.72 KB
08/14/2022 11:05:20 AM
rw-r--r--
📄
stackedbar_bkup21Apr2020.js
10.72 KB
08/14/2022 11:05:20 AM
rw-r--r--
📄
stock.js
13.6 KB
08/14/2022 11:05:19 AM
rw-r--r--
📄
sun.js
7.59 KB
08/14/2022 11:05:20 AM
rw-r--r--
📄
sunburst.js
7.13 KB
08/14/2022 11:05:19 AM
rw-r--r--
📄
tableChart.js
11.54 KB
08/14/2022 11:05:21 AM
rw-r--r--
📄
tableChart_07Jan2020.js
6.7 KB
08/14/2022 11:05:19 AM
rw-r--r--
📄
tree.js
7.34 KB
08/14/2022 11:05:19 AM
rw-r--r--
📄
waterfall.js
9.17 KB
08/14/2022 11:05:21 AM
rw-r--r--
📄
zoomTree.js
7.59 KB
08/14/2022 11:05:19 AM
rw-r--r--
Editing: heatmap.js
Close
function drawHeatChart(data, divId, Title, Width, Height, Ndim, Nmeas, MeasFormats,dispObj,toolTip){ if(Ndim<2){ d3.select("#"+divId).html("<br><br><center><font color=red>Can't plot heat chart.<br>Two dimensions are required to plot heat chart.</font></center>"); return false; } d3.select("#"+divId).html('<div class="myChart"><div class="svgLegend"></div><div class="tipsy"><div class="tipsy-arrow"></div><div class="tipsy-inner"></div></div></div>'); d3.selectAll(".tipsy").style("display", "none"); var Data=[]; var json=makeJsonFromArrayNew(data, Ndim, Nmeas, MeasFormats, dispObj); makeParentsJson(json); resolveComputeMeasure(json, dispObj.RD.General.Measures); var svg = findSvgArea(Nmeas,dispObj,json, Width, Height, divId), measNum=1, Heading=data.slice(0,1); if(dispObj.getShowLegend()) makeLegend(svg,Nmeas,measNum,clickHeatRect,0,json,0,0, dispObj); var width=100, height=100, colors="", min=0, max=0, gridHeight="", gridWidth="", buckets=""; var curNode = json,cnc = curNode.children; clickHeatRect(measNum); function clickHeatRect(measNum){ svg[0].selectAll("g").remove(); svg[0].selectAll("text").remove(); svg[0].selectAll("rect").remove(); Data[0]=0; var i=1; (data.filter(function(d){ for(var i=0;i<cnc.length;i++) if(cnc[i].name == d[0]) return Data.push(d); })) dim1=new Array(); dim2=new Array(); for(var i=1; i<Data.length;i++){ dim1.push(Data[i][0]); dim2.push(Data[i][1].replace("&", "&")); Data[i][Ndim+measNum-1]=+Data[i][Ndim+measNum-1]; } /*for(var i=0;i<json.children.length;i++){ dim1[i] = json.children[i].name; for(var j=0;j<json.children[i].children.length;j++) dim2.push(json.children[i].children[j].name); }*/ if(Heading[0][0] == "Month") dim1=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; else dim1=sortNunique(dim1); if(Heading[0][1] == "Month") dim2=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; else dim2=sortNunique(dim2); var margin = { top: 20, right: 20, bottom: 50, left: 20 }; /*margin.left=d3.max(dim1, function (d) { return d.length; })*10; if(margin.left>150) margin.left=150;*/ height = svg[2] - margin.top-50; width = dispObj.getMultiAxes() ? svg[3]- margin.left - margin.right : svg[3] - margin.left - 30; svg[0].attr("transform", "translate(" + (margin.left+10) + "," + (margin.top+10) + ")"); if(MeasFormats[0].charAt(1) == "t"){ //colors = ["#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]; colors = ["#FFFFCC","#FFCCCC","#FF9999","#FF6666","#FF3333"]; // colors = ["#064dae33","#064dae66","#064dae99","#064daecc","#064dae"] min=0; max=getMaxFtime(Data, Ndim+measNum-1); } else{ //colors = ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]; //colors = ["#ffffd9","#c7e9b4","#41b6c4","#225ea8","#081d58"]; colors = ["#FFFFCC","#FFCCCC","#FF9999","#FF6666","#FF3333"]; //colors = ["#064dae33","#064dae66","#064dae99","#064daecc","#064dae"] min=d3.min(cnc,function(d){return d3.min(d.children,function(f){ return +f.size[measNum-1]}) }); max=d3.max(cnc,function(d){return d3.max(d.children,function(f){return +f.size[measNum-1] })}); if(min<0){ min=-4; colors=["red","#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]; //colors=["red","#ffffd9","#c7e9b4","#41b6c4","#225ea8","#081d58"]; } } gridHeight = Math.floor(height / (dim1.length)); gridWidth = Math.floor(width / (dim2.length)); buckets = dim2.length; for(i=1; i<Data.length; i++){ Data[i][Ndim+Nmeas]=returnPos(dim1, Data[i][0]); Data[i][Ndim+Nmeas+1]=returnPos(dim2, Data[i][1]); } var colorScale = d3.scale.quantile() .domain([Math.min(min,0), max]) .range(colors); if(dispObj.getShowLabel()){ var ytext = svg[0] .append("text") .attr("transform", "translate(" + -margin.left + "," + (height)/2 + ")rotate(-90)") .style("text-anchor", "middle") .attr("class", "label") .text(Heading[0][0]); var xtext = svg[0] .append("text") .attr("transform", "translate(" + (width)/2 + "," + -20 + ")") .style("text-anchor", "middle") .attr("class", "label") .text(Heading[0][1]); } /*var dayLabels = svg[0].selectAll(".dayLabel") .data(dim1) .enter().append("text") .text(function (d) { return d; }) .attr("x", 0) .attr("y", function(d, i) { return i * gridHeight; } ) .style("text-anchor", "end") .attr("transform", "translate(-6,"+gridHeight/1.5+")").call(wrapY,margin.left/2.5) .attr("class", "dayLabel mono axis axis-workweek");*/ if(width/dim2.length > 30){ var timeLabels = svg[0].selectAll(".timeLabel") .data(dim2) .enter().append("text") .text(function(d) { return d; }) .attr("x", function(d, i) { return i * gridWidth; }) .attr("y", 0) .style("text-anchor", "middle") .style("dominant-baseline", "middle") .attr("transform", "translate(" + gridWidth / 2 + ", -10)").call(wrapX,margin.top) .attr("class", "timeLabel mono axis axis-worktime"); } else{ /* svg[0].append("text") .attr("class", "title") .text(Heading[0][1].replace("%","%")) .attr("x", width/2) .attr("y", 0) .style("text-anchor", "middle") .attr("transform", "translate(" + gridWidth / 2 + ", -6)") .attr("class", "timeLabel mono axis axis-worktime"); */ } var j=0; var heatMap = svg[0].selectAll(".hour") .data(Data.slice(1)) .enter().append("rect") .attr("x", function(d,i) { return +d[Ndim+Nmeas+1] * gridWidth ; }) .attr("y", function(d,i) { return +d[Ndim+Nmeas] * gridHeight + totallines*6; }) //.attr("rx", 4) //.attr("ry", 4) .attr("class", "hour bordered") .attr("width", 0) .attr("height", 0) .style("fill", colors[0]) .on("mouseover",function (d,i){ for(var i=0;i<cnc.length;i++) if(cnc[i].name == d[0]) for(var j=0;j<cnc[i].children.length;j++) if(cnc[i].children[j].name == d[1]) showToolTips(divId, cnc[i].children[j], measNum,MeasFormats,true) }) .on("mouseout", function(d,i){hideToolTip(divId, d, i);}); heatMap.transition().duration(1000) //.style("fill", function(d) { return colorScale(+d[Ndim+measNum-1]); }); .style("fill", function(d) { var sum=0; for(var i=0;i<cnc.length;i++) if(cnc[i].name == d[0]) for(var j=0;j<cnc[i].children.length;j++) if(cnc[i].children[j].name == d[1]) sum=sum+ +cnc[i].children[j].size[measNum-1]; return colorScale(sum); }) .attr("width", gridWidth) .attr("height", gridHeight); var colgrad = svg[0].append("g").append("defs") .append("linearGradient") .attr("id","Mygradient"+divId) .selectAll("defs") .data(colors).enter() .append("stop") .attr("offset",function(d,i){return i*100/(colors.length-1)+"%"; }) .attr("stop-color",function(d){return d;}) svg[0].append("rect").attr("x",0) .attr("y", height+15) .attr("width",0) .attr("height",0) .attr("fill","white") .transition().duration(1000) .attr("fill",function(){ return "url(#Mygradient"+divId+")" }) .attr("width",width) .attr("height",13) svg[0].selectAll("collegend").data([0].concat(colorScale.quantiles()), function(d) {return d; }) .enter().append("text") .attr("class", "mono") .text(function(d) { if(d<=0 && min<0) return "< 0"; else return "> " + formatSmallScale(d, MeasFormats[measNum-1]); }) .attr("x", function(d, i) { return Math.floor(width/(colorScale.quantiles().length+1)) * i; }) .attr("y", height + 40); for(i=1; i<Data.length; i++){ Data[i].splice(Ndim+Nmeas,2); } } } function sortNunique(arr) { arr = arr.sort(); var ret = [arr[0]]; for (var i = 1; i < arr.length; i++) { if (arr[i-1] !== arr[i]) { ret.push(arr[i]); } } return ret; } function returnPos(arr, val){ for(var i=0; i<arr.length; i++) if(arr[i] == val) return i; } var totallines = 0; function wrapX(text, width) { text.each(function() { var text = d3.select(this), words = text.text().split(/\s+/).reverse(), words = words.filter(function(e){return e}), word, line = [], lineNumber = 0, lineHeight = 1, // ems x = text.attr("x"), y = text.attr("y"), //dy = parseFloat(text.attr("dy")), dy = 0.1, tspan = text.text(null).append("tspan").attr("x", x).attr("y", y).attr("dy", dy + "em"); while (word = words.pop()) { line.push(word); tspan.text(line.join(" ")); if (tspan.node().getComputedTextLength() > width) { line.pop(); tspan.text(line.join(" ")); line = [word]; console.log(line) tspan = text.append("tspan").attr("x", x).attr("y", y).attr("dy", lineNumber * lineHeight + dy + "em").text(word); } lineNumber++; if(totallines< lineNumber) totallines = lineNumber; } }); } function wrapY(text, width) { text.each(function() { var text = d3.select(this), words = text.text().trim().split(/\s+/).reverse(), words = words.filter(function(e){return e}), word, line = [], lineNumber = 0, lineHeight = 1, // ems x = text.attr("x"), y = text.attr("y"), //dy = parseFloat(text.attr("dy")), dy = 0.1, tspan = text.text(null).append("tspan").attr("x", x).attr("y", y).attr("dy", dy + "em"); while (word = words.pop()) { line.push(word); tspan.text(line.join(" ")); if(tspan.node().getComputedTextLength() > width && line.length > 1) { line.pop(); tspan.text(line.join(" ")); line = [word]; console.log(line) tspan = text.append("tspan").attr("x", x).attr("y", y).attr("dy", ++lineNumber * lineHeight + dy + "em").text(word); } //totallines = 1; } }); }