OXIESEC PANEL
- Current Dir:
/
/
home
/
cubot
/
docroot
/
showcase
/
js
/
SVG
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
12/31/2022 06:53:36 AM
rwxr-xr-x
📄
SVGAll.js
43.74 KB
08/14/2022 11:05:25 AM
rw-r--r--
📄
app2.css
6.71 KB
08/14/2022 11:05:26 AM
rw-r--r--
📄
appanimate.js
7.62 KB
08/14/2022 11:05:25 AM
rw-r--r--
📄
appcharts.js
33.33 KB
08/14/2022 11:05:25 AM
rw-r--r--
📄
appcontroller.js
20.15 KB
08/14/2022 11:05:25 AM
rw-r--r--
📄
appmodel.js
1.41 KB
08/14/2022 11:05:26 AM
rw-r--r--
📄
arundata2.js
1.33 KB
08/14/2022 11:05:26 AM
rw-r--r--
📄
charts_svg.js
622 bytes
08/14/2022 11:05:26 AM
rw-r--r--
📄
d3.v2.js
234.06 KB
08/14/2022 11:05:26 AM
rw-r--r--
📄
d3.v3.js
253.25 KB
08/14/2022 11:05:25 AM
rw-r--r--
📄
spec.js
3.77 KB
08/14/2022 11:05:25 AM
rw-r--r--
Editing: appanimate.js
Close
/*Step Chart Animation*/ function animate1(chobj){ obj = chobj.chart; obj.on("mouseover", function(d,i) { d3.select(this).transition().duration(500) .attr("height", function(d) { console.log((chartobj.height - chartobj.yScale(eval(chartobj.ycol)))/100000); return (chartobj.height - chartobj.yScale(eval(chartobj.ycol)));}) }) .on("mouseout", function(d,i) { d3.select(this).transition().duration(500) .attr("height", function(d) { return 2; }) }); //.on("click", function(d,i) {alert(this);}); } /*Bar/Bubble Chart Animation*/ function animate2(chobj){ toolTip(chobj); return; /* var obj = chobj.chart; obj.on("mouseover", function(d,i) { d3.select(this).transition().duration(300).attr("r","8"); }) .on("mouseout", function(d,i) { if(d3.select(this).attr("class").indexOf("nofill")<0) d3.select(this).transition().duration(300).attr("r","3"); });*/ obj.on("click", function(d,i) { var a = d3.select(this.parentNode); var b = a.select("#val"); b.remove(); var pos = d3.mouse(this); var grp = a.append("g").attr("id", "val"); var addDel="Add"; var datanode = d3.select(this).attr("ycol") ; var newclass=d3.select(this).attr("class"); if(newclass.indexOf("nofill")>0){ newclass=newclass.replace("-nofill",""); addDel="Del"; } else{ newclass=newclass+"-nofill"; addDel="Add"; } d3.select(this).attr("class", newclass) ; /*var o2 = grp.datum(d) .append("rect") .attr("id", "rect") .attr("class", "note") .attr("x", function(d) { return pos[0]; }) .attr("y", function(d) { return pos[1]; }) .attr("width", function(d) { return 200;}) .attr("height", function(d) { return 70 }); var t1 = grp.append("svg:text") .attr("id", "val") .text( d3.select(chobj.spec.xscale.name).title+ ":" +d[0] ) .attr("x", pos[0]+30) .attr("y", pos[1]+15) .attr("class", "note-text-x"); var t2 = grp.append("svg:text") .attr("id", "val") .text(chobj.spec.title+":" + eval(datanode)) .attr("x", pos[0]+30) .attr("y", pos[1]+25) .attr("class", "note-text-y"); */ var er = new eventResponse(); er.chart = obj; er.chartno = d3.select(this.parentNode).attr("chartno"); er.data = d; er.rowindex = i; er.colindex = datanode; er.operation = addDel; er.eventname = this.event; var callback = d3.select(this.parentNode).attr("callback") ; if (callback != 'undefined'){ /*If there is callback function, send event details to it*/ eval(callback)(er); } }); /*.on("mouseout", function(d,i) { d3.select(this).transition().duration(100) .attr("r", function(d) { return (d3.select(this) .attr("r")/2); }) var a = d3.select(this.parentNode); var b = a.select("#val"); //b.transition().duration(1500).remove(); });*/ } /*Tool tip generation code*/ function toolTip(chobj){ var obj = chobj.chart; if(typeof obj == 'undefined') return; obj.on("mouseover", function(d,i){ d3.select(this).transition().duration(300).attr("r","8"); var p = d3.select("#"+chobj.spec.divId).select(".myChart").select(".tipsy"); p.style("visibility", "visible"); var xtitle = chobj.spec.xscale.title; var ytitle = chobj.spec.title; var xt_text = eval(chobj.spec.xscale.col); //var yt_text = eval(chobj.spec.yscale.col); var yt_text = eval(chobj.spec.ycol); p.html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>') .select(".tipsy-inner").html(xtitle + " : " + xt_text + "<br>" + ytitle + " : " + formatToolTipValue(yt_text.toString(), chobj.spec.fmt)); var arrowClass = p.select(".tipsy-arrow"); var svg = d3.select("#"+chobj.spec.divId).select(".myChart").select(".svgchart")[0][0]; var svgLeft = svg.offsetLeft, svgTop = svg.offsetTop, svgHeight = svg.offsetHeight, svgWidth = svg.offsetWidth; var mouseLeft = d3.event.pageX, mouseTop = d3.event.pageY; var tooltipHeight = p[0][0].clientHeight, tooltipWidth = p[0][0].clientWidth; var top = 0, left = 0, pad=20; if(( svgLeft + tooltipWidth/2 < mouseLeft ) && (mouseTop + tooltipHeight + pad < svgTop + svgHeight )){ //North p.attr("class", "tipsy tipsy-n"); arrowClass.attr("class", "tipsy-arrow tipsy-arrow-n"); top = mouseTop + pad ; left = mouseLeft - tooltipWidth/2 ; } else if((svgLeft + tooltipWidth/2 < mouseLeft ) && (mouseTop - tooltipHeight - pad > svgTop)){ //South p.attr("class", "tipsy tipsy-s"); arrowClass.attr("class", "tipsy-arrow tipsy-arrow-s"); top = mouseTop - tooltipHeight -pad ; left = mouseLeft - tooltipWidth/2 ; } else if( mouseTop + tooltipHeight/2 > svgTop ){ if( svgLeft + tooltipWidth + pad < mouseLeft ){// East p.attr("class", "tipsy tipsy-e"); arrowClass.attr("class", "tipsy-arrow tipsy-arrow-e"); top = mouseTop - tooltipHeight/2; left = mouseLeft - tooltipWidth - pad; } else if(mouseLeft + tooltipWidth < svgLeft + svgWidth){ // West p.attr("class", "tipsy tipsy-w"); arrowClass.attr("class", "tipsy-arrow tipsy-arrow-w"); top = mouseTop - tooltipHeight/2; left = mouseLeft + pad; } } p.style("left", left + "px"); p.style("top", top + "px"); }) .on("mouseout", function(d,i) { if(d3.select(this).attr("class").indexOf("nofill")<0) d3.select(this).transition().duration(300).attr("r","3"); var a = d3.select(this.parentNode); //var b = a.select(".tipsy"); var b = d3.select("#"+chobj.spec.divId).select(".myChart").select(".tipsy"); //b.transition().style("opacity", 0).duration(2000).delay(100); b.style("visibility", "hidden"); }) .on("click", function(d,i) { var a = d3.select(this.parentNode); var b = a.select("#val"); b.remove(); var pos = d3.mouse(this); var grp = a.append("g").attr("id", "val"); var addDel="Add"; var datanode = d3.select(this).attr("ycol") ; var newclass=d3.select(this).attr("class"); if(newclass.indexOf("nofill")>0){ newclass=newclass.replace("-nofill",""); addDel="Del"; } else{ newclass=newclass+"-nofill"; addDel="Add"; } d3.select(this).attr("class", newclass) ; var er = new eventResponse(); er.chart = obj; er.chartno = d3.select(this.parentNode).attr("chartno"); er.data = d; er.rowindex = i; er.colindex = datanode; er.operation = addDel; er.eventname = this.event; var callback = d3.select(this.parentNode).attr("callback") ; if (callback != 'undefined'){ /*If there is callback function, send event details to it*/ eval(callback)(er); } }); } function formatToolTipValue(val,formatter){ if(typeof formatter == "undefined" || formatter.length<1) return val; var Gsym=','; var dec='.'; var precesion = formatter.indexOf("p"); var precesionVal=''; if(precesion >= 0) precesionVal = formatter.substr(precesion + 1, 1); var prefix = formatter.indexOf("P"); var prefixval = ''; if(prefix>=0) prefixval = formatter.substr(prefix + 1, 1); var suffix = formatter.indexOf("S"); var suffixval = ''; if(suffix >= 0) suffixval = formatter.substr(suffix + 1, 1); if (formatter.charAt(1) == "e") { Gsym='.'; dec=','; } val = formatMeasureValues(val, prefixval, suffixval, precesionVal, dec, Gsym); return val; } function formatMeasureValues(m,a,b,c, d, t){ var n = m, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0; return a+""+s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "")+b; }