/* Already defined variable (Before the input) * * var chart_1_num_day = 5; * var chart_2_num_day = 15; * */ var pie_threshold = 0.05 var options = { series: { pie: { show: true, radius: 3/5, combine: { color: '#999', threshold: pie_threshold }, label: { show: true, radius: 1, formatter: labelFormatter, background: { opacity: 0.5, color: '#000' } } } }, grid: { hoverable: true, clickable: true }, legend: { show: false }, }; var plot_data_old = [] var plot_old = [] function labelFormatter(label, series) { return "
" + label + "
" + Math.round(series.percent) + "%
"; } function plot_top_graph(module_name, init){ /**** Pie Chart ****/ // moduleCharts is used the decide the url to request data var moduleCharts = "size" == module_name ? "providersChart" : ("num" == module_name ? "providersChart" : "moduleCharts"); var tot_sum = 0; // used to detect elements placed in 'Other' pie's part var data_other = []; // used to detect elements placed in 'Other' pie's part var createPie = $.getJSON($SCRIPT_ROOT+"/_"+moduleCharts+"?moduleName="+module_name+"&num_day="+chart_1_num_day, function(data) { var temp_data_pie = []; for(i=0; i 0 && data[0][1] < 7){ // If data is [1:6] day(s) old, put the panel in yellow $("#day-"+module_name).text(data[0][1] + " Day(s) ago "); $("#panel-"+module_name).removeClass("panel-green") $("#panel-"+module_name).addClass("panel-yellow") } else if (data[0][1] > 6) { // data old of more than 7 days, put the panel in red $("#day-"+module_name).text(data[0][1] + " Day(s) ago "); $("#panel-"+module_name).removeClass("panel-green") $("#panel-"+module_name).addClass("panel-red") } } else { temp_data_pie.push({label: data[i][0], data: data[i][1]}); tot_sum += data[i][1] } } for(i=0; i" + y+"") .css({padding: "2px", width: 'auto', 'background-color': 'white', 'border': "3px solid "+item.series.color}) .fadeIn(200); var plot_other = plot_data_old[0]; if (plot_other.length > 0){ var data_other = plot_other[0].data; for(i=0; i" + curr_data_other+"") .css({padding: "2px", width: 'auto', 'background-color': 'white', 'border': "3px solid "+item.series.color}) .fadeIn(200); for(i=0; i" + curr_data_other+"") .css({padding: "2px", width: 'auto', 'background-color': 'white', 'border': "3px solid "+item.series.color}) .fadeIn(200); for(i=0; i