bachelor-thesis/pgBadger/pgreport_querymatview1/12/pgbadger.min.js

3 lines
5.3 KiB
JavaScript
Raw Normal View History

2024-11-03 14:37:21 +01:00
function create_download_button(a,b){if(b==undefined){b="btn btn-info"}document.writeln('<button type="button" id="download'+a+'" class="'+b+'">Download</button>')}function add_download_button_event(a,b){jQuery("#download"+a).click(function(){$("#pgbadgerModal img").attr("src",$("#"+b).jqplotToImageStr({}));$("#pgbadgerModal").modal("toggle")})}function create_linegraph(e,c,d,a,b){return $.jqplot(e,b,{seriesColors:["#6e9dc9","#f4ab3a","#ac7fa8","#8dbd0f","#958c12","#953579","#4b5de4","#d8b83f","#ff5800","#0085cc"],seriesDefaults:{markerOptions:{show:false},lineWidth:1},grid:{borderWidth:1,background:"#ffffff"},title:c,series:a,axes:{xaxis:{renderer:$.jqplot.DateAxisRenderer,tickOptions:{angle:-30,textColor:"#333"}},yaxis:{renderer:$.jqplot.LogAxisRenderer,labelRenderer:$.jqplot.CanvasAxisLabelRenderer,tickRenderer:$.jqplot.CanvasAxisTickRenderer,tickOptions:{textColor:"#333",formatter:function(g,f){return pretty_print_number(f,0,d)}}}},legend:{show:true,location:"nw"},cursor:{show:true,zoom:true,showTooltip:false,looseZoom:true,followMouse:true},highlighter:{show:true,tooltipContentEditor:function(m,f,j,k){var h=new Date(k.data[f][j][0]);var l="<div>On "+h.toString();for(var g=0;g<k.data.length;g++){l+='<br><span class="mfigure">'+pretty_print_number(k.data[g][j][1],2,k.series[g].label)+" <small>"+k.series[g].label+"</small></span>"}l+="</div>";return l}}})}function create_piechart(c,b,a){return $.jqplot(c,[a],{seriesColors:["#6e9dc9","#f4ab3a","#ac7fa8","#8dbd0f","#958c12","#953579","#4b5de4","#d8b83f","#ff5800","#0085cc","#4bb2c5","#c5b47f","#EAA228","#579575","#839557","#498991","#C08840","#9F9274","#546D61","#646C4A","#6F6621","#6E3F5F","#4F64B0","#A89050","#C45923","#187399","#945381","#959E5C","#C7AF7B","#478396","#907294"],grid:{borderWidth:1,background:"#ffffff"},title:b,seriesDefaults:{renderer:$.jqplot.PieRenderer,rendererOptions:{showDataLabels:true}},legend:{show:true,location:"e"},highlighter:{show:true,tooltipLocation:"sw",useAxesFormatters:false,tooltipContentEditor:function(h,d,e,f){var g="<div>";g+='<span class="mfigure">'+format_number(f.data[0][e][1])+" <small>"+f.data[0][e][0]+"</small></span>";g+="</div>";return g}}})}function create_bargraph(e,d,a,c,b){return $.jqplot(e,c,{grid:{borderWidth:1,background:"#ffffff"},title:d,seriesDefaults:{rendererOptions:{barPadding:4,barMargin:5}},seriesColors:["#6e9dc9","#8dbd0f","#f4ab3a","#ac7fa8","#958c12","#953579","#4b5de4","#d8b83f","#ff5800","#0085cc"],series:[{renderer:$.jqplot.BarRenderer,label:a},{yaxis:"y2axis",label:b,markerOptions:{show:false},lineWidth:1}],axes:{xaxis:{renderer:$.jqplot.CategoryAxisRenderer,drawMajorGridlines:false,drawMajorTickMarks:false,tickRenderer:$.jqplot.CanvasAxisTickRenderer,tickOptions:{angle:-30,textColor:"#333",formatString:"%H:%M",fontFamily:"Helvetica",fontSize:"8pt"}},yaxis:{autoscale:true,labelRenderer:$.jqplot.CanvasAxisLabelRenderer,tickOptions:{textColor:"#333"},tickRenderer:$.jqplot.CanvasAxisTickRenderer,tickOptions:{textColor:"#333",formatter:function(g,f){return pretty_print_number(f,1,a)},fontFamily:"Helvetica",fontSize:"8pt"},label:a},y2axis:{autoscale:true,labelRenderer:$.jqplot.CanvasAxisLabelRenderer,tickRenderer:$.jqplot.CanvasAxisTickRenderer,tickOptions:{textColor:"#8dbd0f",formatter:function(g,f){return pretty_print_number(f,1,b)},fontFamily:"Helvetica",fontSize:"8pt"},rendererOptions:{alignTicks:true},label:b}},highlighter:{show:true,tooltipLocation:"ne",useAxesFormatters:false,tooltipContentEditor:function(l,f,h,j){var k='<div style="z-index: 99;">At '+j.data[0][h][0];for(var g=0;g<j.data.length;g++){k+='<br><span class="mfigure">'+pretty_print_number(j.data[g][h][1],2,j.series[g].label)+" <small>"+j.series[g].label+"</small></span>"}k+="</div>";return k}}})}function pretty_print_number(c,b,a){if((b==undefined)||((b==0)&&(c!=0))){b=1}if(a!=undefined){a=a.toLowerCase();if(a.search("size")>=0){if(Math.abs(c)>=1125899906842624){c=(c/1125899906842624);return c.toFixed(b)+" PiB"}else{if(Math.abs(c)>=1099511627776){c=(c/1099511627776);return c.toFixed(b)+" TiB"}else{if(Math.abs(c)>=1073741824){c=(c/1073741