/* -------------------- Check Browser --------------------- */ jQuery(document).ready(function(){ /* ---------- Acivate Functions ---------- */ template_functions(); sparkline_charts(); charts(); calendars(); growlLikeNotifications(); widthFunctions(); if(jQuery.browser.version.substring(0, 2) == "8.") { //disable jQuery Knob } else { circle_progess(); } }); /* ---------- Like/Dislike ---------- */ function retina(){ retinaMode = (window.devicePixelRatio > 1); return retinaMode; } /* ---------- Chart ---------- */ /* ---------- Masonry Gallery ---------- */ /* ---------- Numbers Sepparator ---------- */ function numberWithCommas(x) { x = x.toString(); var pattern = /(-?\d+)(\d{3})/; while (pattern.test(x)) x = x.replace(pattern, "jQuery1.jQuery2"); return x; } /* ---------- Template Functions ---------- */ function template_functions(){ /* ---------- ToDo List Action Buttons ---------- */ } /* ---------- Circle Progess Bars ---------- */ function circle_progess() { var divElement = jQuery('div'); //log all div elements if (retina()) { jQuery(".whiteCircle").knob({ 'min':0, 'max':100, 'readOnly': true, 'width': 240, 'height': 240, 'bgColor': 'rgba(255,255,255,0.5)', 'fgColor': 'rgba(255,255,255,0.9)', 'dynamicDraw': true, 'thickness': 0.2, 'tickColorizeValues': true }); jQuery(".circleStat").css('zoom',0.5); jQuery(".whiteCircle").css('zoom',0.999); } else { jQuery(".whiteCircle").knob({ 'min':0, 'max':100, 'readOnly': true, 'width': 120, 'height': 120, 'bgColor': 'rgba(255,255,255,0.5)', 'fgColor': 'rgba(255,255,255,0.9)', 'dynamicDraw': true, 'thickness': 0.2, 'tickColorizeValues': true }); } jQuery(".circleStatsItemBox").each(function(){ var value = jQuery(this).find(".value > .number").html(); var unit = jQuery(this).find(".value > .unit").html(); var percent = jQuery(this).find("input").val()/100; countSpeed = 2300*percent; endValue = value*percent; jQuery(this).find(".count > .unit").html(unit); jQuery(this).find(".count > .number").countTo({ from: 0, to: endValue, speed: countSpeed, refreshInterval: 50 }); //jQuery(this).find(".count").html(value*percent + unit); }); } /* ---------- Calendars ---------- */ function calendars(){ } /* ---------- Sparkline Charts ---------- */ function sparkline_charts() { //generate random number for charts randNum = function(){ //return Math.floor(Math.random()*101); return (Math.floor( Math.random()* (1+40-20) ) ) + 20; } var chartColours = ['#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff']; //sparklines (making loop with random data for all 7 sparkline) i=1; for (i=1; i<9; i++) { var data = [[1, 3+randNum()], [2, 5+randNum()], [3, 8+randNum()], [4, 11+randNum()],[5, 14+randNum()],[6, 17+randNum()],[7, 20+randNum()], [8, 15+randNum()], [9, 18+randNum()], [10, 22+randNum()]]; placeholder = '.sparkLineStats' + i; if (retina()) { jQuery(placeholder).sparkline(data, { width: 160,//Width of the chart - Defaults to 'auto' - May be any valid css width - 1.5em, 20px, etc (using a number without a unit specifier won't do what you want) - This option does nothing for bar and tristate chars (see barWidth) height: 80,//Height of the chart - Defaults to 'auto' (line height of the containing tag) lineColor: '#ffffff',//Used by line and discrete charts to specify the colour of the line drawn as a CSS values string fillColor: 'rgba(255,255,255,0.2)',//Specify the colour used to fill the area under the graph as a CSS value. Set to false to disable fill spotColor: '#ffffff',//The CSS colour of the final value marker. Set to false or an empty string to hide it maxSpotColor: '#ffffff',//The CSS colour of the marker displayed for the maximum value. Set to false or an empty string to hide it minSpotColor: '#ffffff',//The CSS colour of the marker displayed for the mimum value. Set to false or an empty string to hide it spotRadius: 2,//Radius of all spot markers, In pixels (default: 1.5) - Integer lineWidth: 1//In pixels (default: 1) - Integer }); jQuery(placeholder).css('zoom',0.5); } else { if(jQuery.browser.msie && parseInt(jQuery.browser.version, 10) === 8) { jQuery(placeholder).sparkline(data, { width: 80,//Width of the chart - Defaults to 'auto' - May be any valid css width - 1.5em, 20px, etc (using a number without a unit specifier won't do what you want) - This option does nothing for bar and tristate chars (see barWidth) height: 40,//Height of the chart - Defaults to 'auto' (line height of the containing tag) lineColor: '#ffffff',//Used by line and discrete charts to specify the colour of the line drawn as a CSS values string fillColor: '#ffffff',//Specify the colour used to fill the area under the graph as a CSS value. Set to false to disable fill spotColor: '#ffffff',//The CSS colour of the final value marker. Set to false or an empty string to hide it maxSpotColor: '#ffffff',//The CSS colour of the marker displayed for the maximum value. Set to false or an empty string to hide it minSpotColor: '#ffffff',//The CSS colour of the marker displayed for the mimum value. Set to false or an empty string to hide it spotRadius: 2,//Radius of all spot markers, In pixels (default: 1.5) - Integer lineWidth: 1//In pixels (default: 1) - Integer }); } else { jQuery(placeholder).sparkline(data, { width: 80,//Width of the chart - Defaults to 'auto' - May be any valid css width - 1.5em, 20px, etc (using a number without a unit specifier won't do what you want) - This option does nothing for bar and tristate chars (see barWidth) height: 40,//Height of the chart - Defaults to 'auto' (line height of the containing tag) lineColor: '#ffffff',//Used by line and discrete charts to specify the colour of the line drawn as a CSS values string fillColor: 'rgba(255,255,255,0.2)',//Specify the colour used to fill the area under the graph as a CSS value. Set to false to disable fill spotColor: '#ffffff',//The CSS colour of the final value marker. Set to false or an empty string to hide it maxSpotColor: '#ffffff',//The CSS colour of the marker displayed for the maximum value. Set to false or an empty string to hide it minSpotColor: '#ffffff',//The CSS colour of the marker displayed for the mimum value. Set to false or an empty string to hide it spotRadius: 2,//Radius of all spot markers, In pixels (default: 1.5) - Integer lineWidth: 1//In pixels (default: 1) - Integer }); } } } if(jQuery(".boxchart")) { if (retina()) { jQuery(".boxchart").sparkline('html', { type: 'bar', height: '120', // Double pixel number for retina display barWidth: '8', // Double pixel number for retina display barSpacing: '2', // Double pixel number for retina display barColor: '#ffffff', negBarColor: '#eeeeee'} ); jQuery(".boxchart").css('zoom',0.5); } else { jQuery(".boxchart").sparkline('html', { type: 'bar', height: '60', barWidth: '4', barSpacing: '1', barColor: '#ffffff', negBarColor: '#eeeeee'} ); } } } /* ---------- Charts ---------- */ function charts() { function randNum(){ return ((Math.floor( Math.random()* (1+40-20) ) ) + 20)* 1200; } function randNum2(){ return ((Math.floor( Math.random()* (1+40-20) ) ) + 20) * 500; } function randNum3(){ return ((Math.floor( Math.random()* (1+40-20) ) ) + 20) * 300; } function randNum4(){ return ((Math.floor( Math.random()* (1+40-20) ) ) + 20) * 100; } /* ---------- Chart with points ---------- */ if(jQuery("#stats-chart2").length) { var pageviews = [[1, 5+randNum()], [1.5, 10+randNum()], [2, 15+randNum()], [2.5, 20+randNum()],[3, 25+randNum()],[3.5, 30+randNum()],[4, 35+randNum()],[4.5, 40+randNum()],[5, 45+randNum()],[5.5, 50+randNum()],[6, 55+randNum()],[6.5, 60+randNum()],[7, 65+randNum()],[7.5, 70+randNum()],[8, 75+randNum()],[8.5, 80+randNum()],[9, 85+randNum()],[9.5, 90+randNum()],[10, 85+randNum()],[10.5, 80+randNum()],[11, 75+randNum()],[11.5, 80+randNum()],[12, 75+randNum()],[12.5, 70+randNum()],[13, 65+randNum()],[13.5, 75+randNum()],[14,80+randNum()],[14.5, 85+randNum()],[15, 90+randNum()], [15.5, 95+randNum()], [16, 5+randNum()], [16.5, 15+randNum()], [17, 15+randNum()], [17.5, 10+randNum()], [18, 15+randNum()], [18.5, 20+randNum()],[19, 25+randNum()],[19.5, 30+randNum()],[20, 35+randNum()],[20.5, 40+randNum()],[21, 45+randNum()],[21.5, 50+randNum()],[22, 55+randNum()],[22.5, 60+randNum()],[23, 65+randNum()],[23.5, 70+randNum()],[24, 75+randNum()],[24.5, 80+randNum()],[25, 85+randNum()],[25.5, 90+randNum()],[26, 85+randNum()],[26.5, 80+randNum()],[27, 75+randNum()],[27.5, 80+randNum()],[28, 75+randNum()],[28.5, 70+randNum()],[29, 65+randNum()],[29.5, 75+randNum()],[30,80+randNum()]]; var visits = [[1, randNum2()-10], [2, randNum2()-10], [3, randNum2()-10], [4, randNum2()],[5, randNum2()],[6, 4+randNum2()],[7, 5+randNum2()],[8, 6+randNum2()],[9, 6+randNum2()],[10, 8+randNum2()],[11, 9+randNum2()],[12, 10+randNum2()],[13,11+randNum2()],[14, 12+randNum2()],[15, 13+randNum2()],[16, 14+randNum2()],[17, 15+randNum2()],[18, 15+randNum2()],[19, 16+randNum2()],[20, 17+randNum2()],[21, 18+randNum2()],[22, 19+randNum2()],[23, 20+randNum2()],[24, 21+randNum2()],[25, 14+randNum2()],[26, 24+randNum2()],[27,25+randNum2()],[28, 26+randNum2()],[29, 27+randNum2()], [30, 31+randNum2()]]; var visitors = [[1, 5+randNum3()], [2, 10+randNum3()], [3, 15+randNum3()], [4, 20+randNum3()],[5, 25+randNum3()],[6, 30+randNum3()],[7, 35+randNum3()],[8, 40+randNum3()],[9, 45+randNum3()],[10, 50+randNum3()],[11, 55+randNum3()],[12, 60+randNum3()],[13, 65+randNum3()],[14, 70+randNum3()],[15, 75+randNum3()],[16, 80+randNum3()],[17, 85+randNum3()],[18, 90+randNum3()],[19, 85+randNum3()],[20, 80+randNum3()],[21, 75+randNum3()],[22, 80+randNum3()],[23, 75+randNum3()],[24, 70+randNum3()],[25, 65+randNum3()],[26, 75+randNum3()],[27,80+randNum3()],[28, 85+randNum3()],[29, 90+randNum3()], [30, 95+randNum3()]]; var newVisitors = [[1, randNum4()-10], [2, randNum4()-10], [3, randNum4()-10], [4, randNum4()],[5, randNum4()],[6, 4+randNum4()],[7, 5+randNum4()],[8, 6+randNum4()],[9, 6+randNum4()],[10, 8+randNum4()],[11, 9+randNum4()],[12, 10+randNum4()],[13,11+randNum4()],[14, 12+randNum4()],[15, 13+randNum4()],[16, 14+randNum4()],[17, 15+randNum4()],[18, 15+randNum4()],[19, 16+randNum4()],[20, 17+randNum4()],[21, 18+randNum4()],[22, 19+randNum4()],[23, 20+randNum4()],[24, 21+randNum4()],[25, 14+randNum4()],[26, 24+randNum4()],[27,25+randNum4()],[28, 26+randNum4()],[29, 27+randNum4()], [30, 31+randNum4()]]; var plot = jQuery.plot(jQuery("#stats-chart2"), [ { data: visitors, label: "Visits", lines: { show: true, fill: false, lineWidth: 2 }, shadowSize: 0 }, { data: pageviews, bars: { show: true, fill: false, barWidth: 0.1, align: "center", lineWidth: 5, } } ], { grid: { hoverable: true, clickable: true, tickColor: "rgba(255,255,255,0.05)", borderWidth: 0 }, legend: { show: false }, colors: ["rgba(255,255,255,0.8)", "rgba(255,255,255,0.6)", "rgba(255,255,255,0.4)", "rgba(255,255,255,0.2)"], xaxis: {ticks:15, tickDecimals: 0, color: "rgba(255,255,255,0.8)" }, yaxis: {ticks:5, tickDecimals: 0, color: "rgba(255,255,255,0.8)" }, }); /* [ { data: visitors, label: "Visits"}], { series: { lines: { show: true, lineWidth: 2 }, points: { show: true, lineWidth: 2 }, shadowSize: 0 }, grid: { hoverable: true, clickable: true, tickColor: "rgba(255,255,255,0.025)", borderWidth: 0 }, legend: { show: false }, colors: ["rgba(255,255,255,0.8)", "rgba(255,255,255,0.6)", "rgba(255,255,255,0.4)", "rgba(255,255,255,0.2)"], xaxis: {ticks:15, tickDecimals: 0}, yaxis: {ticks:5, tickDecimals: 0}, }); */ function showTooltip(x, y, contents) { jQuery('
' + contents + '
').css( { position: 'absolute', display: 'none', top: y + 5, left: x + 5, border: '1px solid #fdd', padding: '2px', 'background-color': '#dfeffc', opacity: 0.80 }).appendTo("body").fadeIn(200); } var previousPoint = null; jQuery("#stats-chart2").bind("plothover", function (event, pos, item) { jQuery("#x").text(pos.x.toFixed(2)); jQuery("#y").text(pos.y.toFixed(2)); if (item) { if (previousPoint != item.dataIndex) { previousPoint = item.dataIndex; jQuery("#tooltip").remove(); var x = item.datapoint[0].toFixed(2), y = item.datapoint[1].toFixed(2); showTooltip(item.pageX, item.pageY, item.series.label + " of " + x + " = " + y); } } else { jQuery("#tooltip").remove(); previousPoint = null; } }); } function randNumFB(){ return ((Math.floor( Math.random()* (1+40-20) ) ) + 20); } /* ---------- Chart with points ---------- */ if(jQuery("#facebookChart").length) { var likes = [[1, 5+randNumFB()], [2, 10+randNumFB()], [3, 15+randNumFB()], [4, 20+randNumFB()],[5, 25+randNumFB()],[6, 30+randNumFB()],[7, 35+randNumFB()],[8, 40+randNumFB()],[9, 45+randNumFB()],[10, 50+randNumFB()],[11, 55+randNumFB()],[12, 60+randNumFB()],[13, 65+randNumFB()],[14, 70+randNumFB()],[15, 75+randNumFB()],[16, 80+randNumFB()],[17, 85+randNumFB()],[18, 90+randNumFB()],[19, 85+randNumFB()],[20, 80+randNumFB()],[21, 75+randNumFB()],[22, 80+randNumFB()],[23, 75+randNumFB()],[24, 70+randNumFB()],[25, 65+randNumFB()],[26, 75+randNumFB()],[27,80+randNumFB()],[28, 85+randNumFB()],[29, 90+randNumFB()], [30, 95+randNumFB()]]; var plot = jQuery.plot(jQuery("#facebookChart"), [ { data: likes, label: "Fans"} ], { series: { lines: { show: true, lineWidth: 2, fill: true, fillColor: { colors: [ { opacity: 0.5 }, { opacity: 0.2 } ] } }, points: { show: true, lineWidth: 2 }, shadowSize: 0 }, grid: { hoverable: true, clickable: true, tickColor: "#f9f9f9", borderWidth: 0 }, colors: ["#3B5998"], xaxis: {ticks:6, tickDecimals: 0}, yaxis: {ticks:3, tickDecimals: 0}, }); function showTooltip(x, y, contents) { jQuery('
' + contents + '
').css( { position: 'absolute', display: 'none', top: y + 5, left: x + 5, border: '1px solid #fdd', padding: '2px', 'background-color': '#dfeffc', opacity: 0.80 }).appendTo("body").fadeIn(200); } var previousPoint = null; jQuery("#facebookChart").bind("plothover", function (event, pos, item) { jQuery("#x").text(pos.x.toFixed(2)); jQuery("#y").text(pos.y.toFixed(2)); if (item) { if (previousPoint != item.dataIndex) { previousPoint = item.dataIndex; jQuery("#tooltip").remove(); var x = item.datapoint[0].toFixed(2), y = item.datapoint[1].toFixed(2); showTooltip(item.pageX, item.pageY, item.series.label + " of " + x + " = " + y); } } else { jQuery("#tooltip").remove(); previousPoint = null; } }); } function randNumTW(){ return ((Math.floor( Math.random()* (1+40-20) ) ) + 20); } /* ---------- Chart with points ---------- */ if(jQuery("#twitterChart").length) { var followers = [[1, 5+randNumTW()], [2, 10+randNumTW()], [3, 15+randNumTW()], [4, 20+randNumTW()],[5, 25+randNumTW()],[6, 30+randNumTW()],[7, 35+randNumTW()],[8, 40+randNumTW()],[9, 45+randNumTW()],[10, 50+randNumTW()],[11, 55+randNumTW()],[12, 60+randNumTW()],[13, 65+randNumTW()],[14, 70+randNumTW()],[15, 75+randNumTW()],[16, 80+randNumTW()],[17, 85+randNumTW()],[18, 90+randNumTW()],[19, 85+randNumTW()],[20, 80+randNumTW()],[21, 75+randNumTW()],[22, 80+randNumTW()],[23, 75+randNumTW()],[24, 70+randNumTW()],[25, 65+randNumTW()],[26, 75+randNumTW()],[27,80+randNumTW()],[28, 85+randNumTW()],[29, 90+randNumTW()], [30, 95+randNumTW()]]; var plot = jQuery.plot(jQuery("#twitterChart"), [ { data: followers, label: "Followers"} ], { series: { lines: { show: true, lineWidth: 2, fill: true, fillColor: { colors: [ { opacity: 0.5 }, { opacity: 0.2 } ] } }, points: { show: true, lineWidth: 2 }, shadowSize: 0 }, grid: { hoverable: true, clickable: true, tickColor: "#f9f9f9", borderWidth: 0 }, colors: ["#1BB2E9"], xaxis: {ticks:6, tickDecimals: 0}, yaxis: {ticks:3, tickDecimals: 0}, }); function showTooltip(x, y, contents) { jQuery('
' + contents + '
').css( { position: 'absolute', display: 'none', top: y + 5, left: x + 5, border: '1px solid #fdd', padding: '2px', 'background-color': '#dfeffc', opacity: 0.80 }).appendTo("body").fadeIn(200); } var previousPoint = null; jQuery("#twitterChart").bind("plothover", function (event, pos, item) { jQuery("#x").text(pos.x.toFixed(2)); jQuery("#y").text(pos.y.toFixed(2)); if (item) { if (previousPoint != item.dataIndex) { previousPoint = item.dataIndex; jQuery("#tooltip").remove(); var x = item.datapoint[0].toFixed(2), y = item.datapoint[1].toFixed(2); showTooltip(item.pageX, item.pageY, item.series.label + " of " + x + " = " + y); } } else { jQuery("#tooltip").remove(); previousPoint = null; } }); } if(jQuery("#activeUsers").length) { var d1 = []; for (var i = 0; i <= 160; i += 1) { d1.push([i, parseInt(Math.random() * 123123)]); } var stack = 0, bars = true, lines = false, steps = false; function plotWithOptions2() { jQuery.plot(jQuery("#activeUsers"), [ d1 ], { series: { bars: { show: bars, fill: true, barWidth: 0.1, align: "center", lineWidth: 5, fillColor: { colors: [ { opacity: 1 }, { opacity: 0.5 } ] } }, }, grid: { hoverable: true, clickable: true, tickColor: "#f6f6f6", borderWidth: 0, }, colors: ["#CBE968"], xaxis: {ticks:0, tickDecimals: 0, tickFormatter: function(v, a) {return v }}, yaxis: {ticks:5, tickDecimals: 0, tickFormatter: function (v) { return v }}, }); } plotWithOptions2(); } /* ---------- Chart with points ---------- */ if(jQuery("#stats-chart").length) { var visitors = [[1, randNum()-10], [2, randNum()-10], [3, randNum()-10], [4, randNum()],[5, randNum()],[6, 4+randNum()],[7, 5+randNum()],[8, 6+randNum()],[9, 6+randNum()],[10, 8+randNum()],[11, 9+randNum()],[12, 10+randNum()],[13,11+randNum()],[14, 12+randNum()],[15, 13+randNum()],[16, 14+randNum()],[17, 15+randNum()],[18, 15+randNum()],[19, 16+randNum()],[20, 17+randNum()],[21, 18+randNum()],[22, 19+randNum()],[23, 20+randNum()],[24, 21+randNum()],[25, 14+randNum()],[26, 24+randNum()],[27,25+randNum()],[28, 26+randNum()],[29, 27+randNum()], [30, 31+randNum()]]; var plot = jQuery.plot(jQuery("#stats-chart"), [ { data: visitors, label: "visitors" } ], { series: { lines: { show: true, lineWidth: 3, fill: true, fillColor: { colors: [ { opacity: 0.5 }, { opacity: 0.2 } ] } }, points: { show: true }, shadowSize: 2 }, grid: { hoverable: true, clickable: true, tickColor: "#eee", borderWidth: 0, }, colors: ["#b1d3d4"], xaxis: {ticks:11, tickDecimals: 0}, yaxis: {ticks:11, tickDecimals: 0}, }); function showTooltip(x, y, contents) { jQuery('
' + contents + '
').css( { position: 'absolute', display: 'none', top: y + 5, left: x + 5, border: '1px solid #fdd', padding: '2px', 'background-color': '#dfeffc', opacity: 0.80 }).appendTo("body").fadeIn(200); } var previousPoint = null; jQuery("#stats-chart").bind("plothover", function (event, pos, item) { jQuery("#x").text(pos.x.toFixed(2)); jQuery("#y").text(pos.y.toFixed(2)); if (item) { if (previousPoint != item.dataIndex) { previousPoint = item.dataIndex; jQuery("#tooltip").remove(); var x = item.datapoint[0].toFixed(2), y = item.datapoint[1].toFixed(2); showTooltip(item.pageX, item.pageY, item.series.label + " of " + x + " = " + y); } } else { jQuery("#tooltip").remove(); previousPoint = null; } }); jQuery("#sincos").bind("plotclick", function (event, pos, item) { if (item) { jQuery("#clickdata").text("You clicked point " + item.dataIndex + " in " + item.series.label + "."); plot.highlight(item.series, item.datapoint); } }); } /* ---------- Chart with points ---------- */ if(jQuery("#sincos").length) { var sin = [], cos = []; for (var i = 0; i < 14; i += 0.5) { sin.push([i, Math.sin(i)/i]); cos.push([i, Math.cos(i)]); } var plot = jQuery.plot(jQuery("#sincos"), [ { data: sin, label: "sin(x)/x"}, { data: cos, label: "cos(x)" } ], { series: { lines: { show: true, lineWidth: 2, }, points: { show: true }, shadowSize: 2 }, grid: { hoverable: true, clickable: true, tickColor: "#dddddd", borderWidth: 0 }, yaxis: { min: -1.2, max: 1.2 }, colors: ["#FA5833", "#2FABE9"] }); function showTooltip(x, y, contents) { jQuery('
' + contents + '
').css( { position: 'absolute', display: 'none', top: y + 5, left: x + 5, border: '1px solid #fdd', padding: '2px', 'background-color': '#dfeffc', opacity: 0.80 }).appendTo("body").fadeIn(200); } var previousPoint = null; jQuery("#sincos").bind("plothover", function (event, pos, item) { jQuery("#x").text(pos.x.toFixed(2)); jQuery("#y").text(pos.y.toFixed(2)); if (item) { if (previousPoint != item.dataIndex) { previousPoint = item.dataIndex; jQuery("#tooltip").remove(); var x = item.datapoint[0].toFixed(2), y = item.datapoint[1].toFixed(2); showTooltip(item.pageX, item.pageY, item.series.label + " of " + x + " = " + y); } } else { jQuery("#tooltip").remove(); previousPoint = null; } }); jQuery("#sincos").bind("plotclick", function (event, pos, item) { if (item) { jQuery("#clickdata").text("You clicked point " + item.dataIndex + " in " + item.series.label + "."); plot.highlight(item.series, item.datapoint); } }); } /* ---------- Flot chart ---------- */ if(jQuery("#flotchart").length) { var d1 = []; for (var i = 0; i < Math.PI * 2; i += 0.25) d1.push([i, Math.sin(i)]); var d2 = []; for (var i = 0; i < Math.PI * 2; i += 0.25) d2.push([i, Math.cos(i)]); var d3 = []; for (var i = 0; i < Math.PI * 2; i += 0.1) d3.push([i, Math.tan(i)]); jQuery.plot(jQuery("#flotchart"), [ { label: "sin(x)", data: d1}, { label: "cos(x)", data: d2}, { label: "tan(x)", data: d3} ], { series: { lines: { show: true }, points: { show: true } }, xaxis: { ticks: [0, [Math.PI/2, "\u03c0/2"], [Math.PI, "\u03c0"], [Math.PI * 3/2, "3\u03c0/2"], [Math.PI * 2, "2\u03c0"]] }, yaxis: { ticks: 10, min: -2, max: 2 }, grid: { tickColor: "#dddddd", borderWidth: 0 }, colors: ["#FA5833", "#2FABE9", "#FABB3D"] }); } /* ---------- Stack chart ---------- */ if(jQuery("#stackchart").length) { var d1 = []; for (var i = 0; i <= 10; i += 1) d1.push([i, parseInt(Math.random() * 30)]); var d2 = []; for (var i = 0; i <= 10; i += 1) d2.push([i, parseInt(Math.random() * 30)]); var d3 = []; for (var i = 0; i <= 10; i += 1) d3.push([i, parseInt(Math.random() * 30)]); var stack = 0, bars = true, lines = false, steps = false; function plotWithOptions() { jQuery.plot(jQuery("#stackchart"), [ d1, d2, d3 ], { series: { stack: stack, lines: { show: lines, fill: true, steps: steps }, bars: { show: bars, barWidth: 0.6 }, }, colors: ["#FA5833", "#2FABE9", "#FABB3D"] }); } plotWithOptions(); jQuery(".stackControls input").click(function (e) { e.preventDefault(); stack = jQuery(this).val() == "With stacking" ? true : null; plotWithOptions(); }); jQuery(".graphControls input").click(function (e) { e.preventDefault(); bars = jQuery(this).val().indexOf("Bars") != -1; lines = jQuery(this).val().indexOf("Lines") != -1; steps = jQuery(this).val().indexOf("steps") != -1; plotWithOptions(); }); } /* ---------- Device chart ---------- */ var data = [ { label: "Desktop", data: 73}, { label: "Mobile", data: 27} ]; /* ---------- Donut chart ---------- */ if(jQuery("#deviceChart").length) { jQuery.plot(jQuery("#deviceChart"), data, { series: { pie: { innerRadius: 0.6, show: true } }, legend: { show: true }, colors: ["#FA5833", "#2FABE9", "#FABB3D", "#78CD51"] }); } var data = [ { label: "iOS", data: 20}, { label: "Android", data: 7}, { label: "Linux", data: 11}, { label: "Mac OSX", data: 14}, { label: "Windows", data: 48} ]; /* ---------- Donut chart ---------- */ if(jQuery("#osChart").length) { jQuery.plot(jQuery("#osChart"), data, { series: { pie: { innerRadius: 0.6, show: true } }, legend: { show: true }, colors: ["#FA5833", "#2FABE9", "#FABB3D", "#78CD51"] }); } /* ---------- Pie chart ---------- */ var data = [ { label: "Internet Explorer", data: 12}, { label: "Mobile", data: 27}, { label: "Safari", data: 85}, { label: "Opera", data: 64}, { label: "Firefox", data: 90}, { label: "Chrome", data: 112} ]; if(jQuery("#piechart").length) { jQuery.plot(jQuery("#piechart"), data, { series: { pie: { show: true } }, grid: { hoverable: true, clickable: true }, legend: { show: false }, colors: ["#FA5833", "#2FABE9", "#FABB3D", "#78CD51"] }); function pieHover(event, pos, obj) { if (!obj) return; percent = parseFloat(obj.series.percent).toFixed(2); jQuery("#hover").html(''+obj.series.label+' ('+percent+'%)'); } jQuery("#piechart").bind("plothover", pieHover); } /* ---------- Donut chart ---------- */ if(jQuery("#donutchart").length) { jQuery.plot(jQuery("#donutchart"), data, { series: { pie: { innerRadius: 0.5, show: true } }, legend: { show: false }, colors: ["#FA5833", "#2FABE9", "#FABB3D", "#78CD51"] }); } // we use an inline data source in the example, usually data would // be fetched from a server var data = [], totalPoints = 300; function getRandomData() { if (data.length > 0) data = data.slice(1); // do a random walk while (data.length < totalPoints) { var prev = data.length > 0 ? data[data.length - 1] : 50; var y = prev + Math.random() * 10 - 5; if (y < 0) y = 0; if (y > 100) y = 100; data.push(y); } // zip the generated y values with the x values var res = []; for (var i = 0; i < data.length; ++i) res.push([i, data[i]]) return res; } // setup control widget var updateInterval = 30; jQuery("#updateInterval").val(updateInterval).change(function () { var v = jQuery(this).val(); if (v && !isNaN(+v)) { updateInterval = +v; if (updateInterval < 1) updateInterval = 1; if (updateInterval > 2000) updateInterval = 2000; jQuery(this).val("" + updateInterval); } }); /* ---------- Realtime chart ---------- */ if(jQuery("#serverLoad").length) { var options = { series: { shadowSize: 1 }, lines: { show: true, lineWidth: 3, fill: true, fillColor: { colors: [ { opacity: 0.9 }, { opacity: 0.9 } ] }}, yaxis: { min: 0, max: 100, tickFormatter: function (v) { return v + "%"; }}, xaxis: { show: false }, colors: ["#FA5833"], grid: { tickColor: "#f9f9f9", borderWidth: 0, }, }; var plot = jQuery.plot(jQuery("#serverLoad"), [ getRandomData() ], options); function update() { plot.setData([ getRandomData() ]); // since the axes don't change, we don't need to call plot.setupGrid() plot.draw(); setTimeout(update, updateInterval); } update(); } if(jQuery("#serverLoad2").length) { var options = { series: { shadowSize: 1 }, lines: { show: true, lineWidth: 2, fill: true, fillColor: { colors: [ { opacity: 0.9 }, { opacity: 0.9 } ] }}, yaxis: { min: 0, max: 100, tickFormatter: function (v) { return v + "%"; }, color: "rgba(255,255,255,0.8)"}, xaxis: { show: false, color: "rgba(255,255,255,0.8)" }, colors: ["rgba(255,255,255,0.95)"], grid: { tickColor: "rgba(255,255,255,0.15)", borderWidth: 0, }, }; var plot = jQuery.plot(jQuery("#serverLoad2"), [ getRandomData() ], options); function update() { plot.setData([ getRandomData() ]); // since the axes don't change, we don't need to call plot.setupGrid() plot.draw(); setTimeout(update, updateInterval); } update(); } if(jQuery("#realtimechart").length) { var options = { series: { shadowSize: 1 }, lines: { fill: true, fillColor: { colors: [ { opacity: 1 }, { opacity: 0.1 } ] }}, yaxis: { min: 0, max: 100 }, xaxis: { show: false }, colors: ["#F4A506"], grid: { tickColor: "#dddddd", borderWidth: 0 }, }; var plot = jQuery.plot(jQuery("#realtimechart"), [ getRandomData() ], options); function update() { plot.setData([ getRandomData() ]); // since the axes don't change, we don't need to call plot.setupGrid() plot.draw(); setTimeout(update, updateInterval); } update(); } } function growlLikeNotifications() { } /* ---------- Additional functions for data table ---------- */ /* ---------- Page width functions ---------- */ function widthFunctions(e) { }