function disk() { $disk_used = trim(shell_exec("df -h|grep /usr/data |awk '{print \$3}'")); $disk_available = trim(shell_exec("df -h|grep /usr/data |awk '{print \$4}'")); $title = new title("磁盘使用情况\n当前已使用 {$disk_used} ,剩余 {$disk_available}"); $title->set_style("{font-size: 12px; font-family: Times New Roman; font-weight: bold; color: #A2ACBA; text-align: center;}"); $used_percent = trim(shell_exec("df -h|grep /usr/data |awk '{print \$5}'")); $used_percent = substr($used_percent, 0, strlen($used_percent) - 1); settype($used_percent, 'float'); $available_percent = 100 - $used_percent; $pie = new pie(); $pie->set_alpha(0.7); $pie->set_start_angle(0); $pie->add_animation(new pie_fade()); $pie->set_tooltip('#val#%'); $pie->set_colours(array('#FF368D', '#1C9E05')); $d = array(); $d[] = new pie_value($used_percent, $used_percent . "%"); $d[] = new pie_value($available_percent, $available_percent . "%"); $pie->set_values($d); $chart = new open_flash_chart(); $chart->set_title($title); $chart->add_element($pie); $chart->set_bg_colour('#FFFFFF'); $chart->x_axis = null; header("Cache-Control: cache, must-revalidate"); header("Pragma: public"); echo $chart->toPrettyString(); }
function customizeChartProperties() { parent::customizeChartProperties(); $dataSetsToDisplay = $this->getDataSetsToDisplay(); if ($dataSetsToDisplay === false) { return; } $dataSetToDisplay = current($dataSetsToDisplay); // create the Pie $pie = new pie(); $pie->set_alpha("0.6"); $pie->set_start_angle(35); $pie->add_animation(new pie_fade()); $pie->set_label_colour('#142448'); $pie->set_colours(array('#3C5A69', '#679BB5', '#695A3C', '#B58E67', '#969696')); // create the Pie values $yValues = $this->yValues[$dataSetToDisplay]; $labelName = $this->yLabels[$dataSetToDisplay]; $unit = $this->yUnit; $sum = array_sum($yValues); $pieValues = array(); $i = 0; foreach ($this->xLabels as $label) { $value = (double) $yValues[$i]; $i++; // we never plot empty pie slices (eg. visits by server time pie chart) if ($value <= 0) { continue; } $pieValue = new pie_value($value, $label); $percentage = round(100 * $value / $sum); $pieValue->set_tooltip("{$label}<br>{$percentage}% ({$value}{$unit} {$labelName})"); $pieValues[] = $pieValue; } $pie->set_values($pieValues); $this->chart->add_element($pie); }
case "date": $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = $theValue != "" ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $title = new title(); $title->set_style("font-size:12px; font-weight:bold;"); $pie = new pie(); $pie->set_alpha(0.6); $pie->set_start_angle(32); $pie->add_animation(new pie_fade()); $pie->set_tooltip('#val# ' . $multilingual_project_hour); $pie->set_colours(array('#99C754', '#54C7C5', '#999999', '#996699', '#009900', '#77C600', '#ff7400', '#FF0000', '#4096ee', '#c79810')); $projectid = $_GET['recordID']; mysql_select_db($database_tankdb, $tankdb); $query_Recordset_sumtotal = sprintf("SELECT \n\t\t\t\t\t\t\tsum(csa_tb_manhour) as sum_hour \n\t\t\t\t\t\t\tFROM tk_task_byday \t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tWHERE csa_tb_backup2 = %s", GetSQLValueString($projectid, "text")); $Recordset_sumtotal = mysql_query($query_Recordset_sumtotal, $tankdb) or die(mysql_error()); $row_Recordset_sumtotal = mysql_fetch_assoc($Recordset_sumtotal); $t = $row_Recordset_sumtotal['sum_hour']; $sql = sprintf("SELECT * , sum(csa_tb_manhour) as summ1 FROM tk_task_byday \t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tinner join tk_task_tpye on tk_task_byday.csa_tb_backup4=tk_task_tpye.id\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tWHERE csa_tb_backup2 = %s GROUP BY csa_tb_backup4 ORDER BY summ1 DESC", GetSQLValueString($projectid, "text")); $query = mysql_query($sql, $tankdb) or die(mysql_error()); while ($row = mysql_fetch_assoc($query)) { $total = $row['summ1']; if (!empty($t)) { $v = round($total / $t, 2) * 100; } else {
/** * Build The Pie Gharph. * * @param array $params assoc array of name/value pairs * * @return object $chart object of open flash chart. * @static */ static function &pieChart(&$params) { $chart = null; if (empty($params)) { return $chart; } $allValues = CRM_Utils_Array::value('values', $params); if (!is_array($allValues) || empty($allValues)) { return $chart; } // get the required data. $values = array(); foreach ($allValues as $label => $value) { $values[] = new pie_value((double) $value, $label); } $graphTitle = CRM_Utils_Array::value('legend', $params) ? $params['legend'] : ts('Pie Chart'); //get the currency. require_once 'CRM/Utils/Money.php'; $config = CRM_Core_Config::singleton(); $symbol = $config->defaultCurrencySymbol; $pie = new pie(); $pie->radius(100); // call user define function to handle on click event. if ($onClickFunName = CRM_Utils_Array::value('on_click_fun_name', $params)) { $pie->on_click($onClickFunName); } $pie->set_start_angle(35); $pie->add_animation(new pie_fade()); $pie->add_animation(new pie_bounce(2)); // set the tooltip. $tooltip = CRM_Utils_Array::value('tip', $params, "Amount is {$symbol} #val# of {$symbol} #total# <br>#percent#"); $pie->set_tooltip($tooltip); // set colours. $pie->set_colours(self::$_colours); $pie->set_values($values); //create chart. $chart = new open_flash_chart(); // create chart title obj. $title = new title($graphTitle); $chart->set_title($title); $chart->add_element($pie); $chart->x_axis = null; return $chart; }
$title = new title( date("D M d Y") ); $ctype = new pie(); $result = perform_query($sql, $dbLink, $_SERVER['PHP_SELF']); if(num_rows($result) >= 1) { while ($line = fetch_array($result)) { $hosts[] = $line['host']; $pievalues[] = new pie_value(intval($line['count']), $line['host']); } } // Generate random pie colors for($i = 0; $i<=count($pievalues) ; $i++) { $colors[] = '#'.random_hex_color(); // 09B826 } $ctype->set_alpha(0.5); $ctype->add_animation( new pie_fade() ); $ctype->add_animation( new pie_bounce(5) ); // $ctype->start_angle( 270 ) $ctype->start_angle( 0 ); $ctype->set_tooltip( "#label#<br>#val# of #total#<br>#percent# of top $limit hosts" ); $ctype->radius(80); $ctype->set_colours( $colors ); $ctype->set_values( $pievalues ); $chart = new open_flash_chart(); // $chart->set_title( $title ); $chart->add_element( $ctype ); echo $chart->toPrettyString(); } // ------------------------------------------------------ // END Chart Generation
/** * 工作耗时饼猪状图 *@param $id 传入的项目ID *@examlpe */ public function buglevel($id) { $Public = A('Index', 'Public'); $App = A('App', 'Public'); Vendor('OpenFlash.open-flash-chart'); //main $Report = M('Report_table'); $id = intval($id); $color = array('#99C754', '#54C7C5', '#999999', '#996699', '#009900', '#77C600', '#ff7400', '#FF0000', '#4096ee', '#c79810'); $level = $App->getJson('yanzhongxing', '/Linkage'); $info = $Report->field('level,COUNT(id) as num')->where('pid=' . $id)->group('level')->order('level')->select(); //dump($info); $title = new title(); $title->set_style("font-size:13px; font-weight:bold;"); $pie = new pie(); $pie->set_alpha(0.8); $pie->start_angle(35); $pie->add_animation(new pie_fade()); $pie->add_animation(new pie_bounce(5)); $pie->gradient_fill(); $pie->set_tooltip('数量:#val#条, 占:#percent#'); $pie->set_colours($color); foreach ($info as $k => $t) { $obj = new pie_value(intval($t['num']), ''); $name = $Public->searchArr($level, 'id', $t['level']); $obj->set_label($name . ':' . $t['num'] . '条', $color[$k], 12); $dis_value[] = $obj; } //dump($dis_value); $pie->set_values($dis_value); $chart = new open_flash_chart(); $chart->set_title($title); $chart->add_element($pie); $chart->x_axis = null; $chart->bg_colour = '#FFFFFF'; echo $chart->toPrettyString(); }
function report_chart($data) { // Chart // // This is the MODEL section: // include 'open-flash-chart/php-ofc-library/open-flash-chart.php'; $title = new title("Availability Report "); $pie = new pie(); $pie->set_alpha(0.9); $pie->radius(90); //$pie->start_angle(100); $pie->add_animation(new pie_fade()); $pie->set_tooltip('#label#: #percent#<br>#val# of #total#<br>'); $status_colors = array(ok => '#77CC6D', critical => '#FF0000', warning => '#FFD40F', unknown => '#6D86CC', no_data => '#848484'); $status_name = array(ok => 'Ok', critical => 'Critical', warning => 'Warning', unknown => 'Unknown', no_data => 'No Data'); $col = array(); $d = array(); foreach ($data as $name => $value) { if ($value > 0) { $d[] = new pie_value($value * 1, "{$status_name[$name]}"); array_push($col, $status_colors[$name]); } } $pie->set_values($d); $pie->set_colours($col); $chart = new open_flash_chart(); $chart->set_title($title); $chart->add_element($pie); $chart->x_axis = null; $chart->set_bg_colour('#202020'); $title->set_style("{font-size: 16px; font-family: Times New Roman; font-weight: bold; color: #000; text-align: center;}"); $chart->set_bg_colour('#FFFFFF'); $chart->set_title($title); // This is the VIEW section: // Should print this first. // $heading = "\n <script type='text/javascript' src='open-flash-chart/js/json/json2.js'></script>\n <script type='text/javascript' src='open-flash-chart/js/swfobject.js'></script>\n <script type='text/javascript'>\n swfobject.embedSWF('open-flash-chart/open-flash-chart.swf', 'my_chart', '300', '300', '9.0.0');\n </script>\n\n <script type='text/javascript'>\n\n function open_flash_chart_data() {\n return JSON.stringify(data);\n }\n\n function findSWF(movieName) {\n if (navigator.appName.indexOf('Microsoft')!= -1) {\n return window[movieName];\n } else {\n return document[movieName];\n }\n }\n \n var data = " . $chart->toPrettyString() . "\n\n </script>\n\n\n <script type=\"text/javascript\">\n \n OFC = {};\n \n OFC.jquery = {\n name: 'jQuery',\n version: function(src) { return \$('#'+ src)[0].get_version() },\n rasterize: function (src, dst) { \$('#'+ dst).replaceWith(OFC.jquery.image(src)) },\n image: function(src) { return \"<img src='data:image/png;base64,\" + \$('#'+src)[0].get_img_binary() + \"' />\"},\n popup: function(src) {\n var img_win = window.open('', 'Charts: Export as Image')\n with(img_win.document) {\n write('<html><head><title>Charts: Export as Image<\\/title><\\/head><body>' + OFC.jquery.image(src) + '<\\/body><\\/html>') }\n // stop the 'loading...' message\n img_win.document.close();\n }\n }\n \n // Using_ an object as namespaces is JS Best Practice. I like the Control.XXX style.\n //if (!Control) {var Control = {}}\n //if (typeof(Control == \"undefined\")) {var Control = {}}\n if (typeof(Control == \"undefined\")) {var Control = {OFC: OFC.jquery}}\n \n \n // By default, right-clicking on OFC and choosing \"save image locally\" calls this function.\n // You are free to change the code in OFC and call my wrapper (Control.OFC.your_favorite_save_method)\n // function save_image() { alert(1); Control.OFC.popup('my_chart') }\n function save_image() { alert(\"Your image will be displayed in a new window\"); OFC.jquery.popup('my_chart') }\n </script>\n <div id='my_chart' style='float:left; margin-left:28px;'></div>\n "; return $heading; }
/** * public static function to generate two pie charts for the mailing reports * It was extracted because there are two graph in mailing for each mailing and general mailing which is the total * * @param array $results data needed for graph values */ public static function mailingPieChart($results) { $data = array(); //First Pie, Pie Chart for HTML/TEXT format $valuesFormat = array(); $pieHtmlValues = new pie_value((int) $results['html_sent'], _JNEWS_GRAPH_LBL_HTML); $pieTextValues = new pie_value((int) $results['text_sent'], _JNEWS_GRAPH_LBL_TEXT); $valuesFormat[] = $pieHtmlValues; $valuesFormat[] = $pieTextValues; if (empty($results['html_sent']) && empty($results['text_sent'])) { $data['pie1'] = 'empty'; } else { $css = '{font-size:15px;font-weight:bold;color:#0B55C4;}'; $title = new title(_JNEWS_GRAPH_TITLE_FORMAT); //Name of the newsletter $title->set_style($css); $pieMailing = new pie(); $pieMailing->set_alpha(0.6); $pieMailing->set_start_angle(35); $pieMailing->add_animation(new pie_fade()); $pieMailing->set_tooltip('#val#<br>#percent# of 100%'); $pieMailing->set_colours(array('#156cbd', '#368d03', '#f7941d', '#ed145a', '#92278f', '#156cbd', '#182972', '#3e5d2b', '#db4b19', '#9d0039', '#440e62')); $pieMailing->set_values($valuesFormat); $chartPie = new open_flash_chart(); $chartPie->set_title($title); $chartPie->add_element($pieMailing); $chartPie->set_bg_colour('#FFFFFF'); $data['pie1'] = $chartPie->toPrettyString(); } //Second chart, Pie chart for the status of mailing process $valuesProcess = array(); //$pieFailedlValues = new pie_value((int)$results['failed'], _JNEWS_MAILING_FAILED); //$pieBounceValues = new pie_value((int)$results['bounces'], _JNEWS_MAILING_BOUNCES); $piePendingValues = new pie_value((int) $results['pending'], _JNEWS_MAILING_PENDING); $pieSentValues = new pie_value((int) $results['sent'], _JNEWS_MAILING_SENT); //$valuesProcess[] = $pieFailedlValues; //$valuesProcess[] = $pieBounceValues; $valuesProcess[] = $piePendingValues; $valuesProcess[] = $pieSentValues; //if(!empty($results['failed']) && !empty($results['pending']) && !empty($results['bounces'])){ if (!empty($results['sent']) || !empty($results['pending'])) { $css = '{font-size:15px;font-weight:bold;color:#0B55C4;}'; $title = new title(_JNEWS_GRAPH_PIE_TITLE_MAIL); //Name of the newsletter $title->set_style($css); $pieMailing = new pie(); $pieMailing->set_alpha(0.6); $pieMailing->set_start_angle(35); $pieMailing->add_animation(new pie_fade()); $pieMailing->set_tooltip('#val#<br>#percent# of 100%'); $pieMailing->set_colours(array('#156cbd', '#368d03', '#f7941d', '#ed145a', '#92278f', '#156cbd', '#182972', '#3e5d2b', '#db4b19', '#9d0039', '#440e62')); $pieMailing->set_values($valuesProcess); $chartPie = new open_flash_chart(); $chartPie->set_title($title); $chartPie->add_element($pieMailing); $chartPie->set_bg_colour('#FFFFFF'); $data['pie2'] = $chartPie->toPrettyString(); } else { $data['pie2'] = 'empty'; } return $data; }
function report_chart($data) { $title = new title("Availability Report "); $pie = new pie(); $pie->set_alpha(0.9); $pie->radius(90); //$pie->start_angle(100); $pie->add_animation(new pie_fade()); $pie->set_tooltip('#label#: #percent#<br>#val# of #total#<br>'); $status_colors = array(free => '#77CC6D', assigned => '#FF0000', reserved => '#6D86CC', free2 => '#77CC6D', assigned2 => '#FF0000', reserved2 => '#6D86CC'); $status_name = array(free => 'FREE', assigned => 'ASSIGNED', reserved => 'RESERVED', free2 => 'FREE', assigned2 => 'ASSIGNED', reserved2 => 'RESERVED'); $col = array(); $d = array(); foreach ($data as $name => $value) { if ($value > 0) { $d[] = new pie_value($value * 1, "{$status_name[$name]}"); array_push($col, $status_colors[$name]); } } $pie->set_values($d); $pie->set_colours($col); $chart = new open_flash_chart(); $chart->set_title($title); $chart->add_element($pie); $chart->x_axis = null; $chart->set_bg_colour('#202020'); $title->set_style("{font-size: 16px; font-family: Times New Roman; font-weight: bold; color: #000; text-align: center;}"); $chart->set_bg_colour('#FFFFFF'); $chart->set_title($title); // This is the VIEW section: // Should print this first. // $heading = "\n <script type='text/javascript'>\n \n var data = " . $chart->toPrettyString() . "\n\n </script>\n\n\n <script type=\"text/javascript\">\n \n OFC = {};\n \n OFC.jquery = {\n name: 'jQuery',\n version: function(src) { return \$('#'+ src)[0].get_version() },\n rasterize: function (src, dst) { \$('#'+ dst).replaceWith(OFC.jquery.image(src)) },\n image: function(src) { return \"<img src='data:image/png;base64,\" + \$('#'+src)[0].get_img_binary() + \"' />\"},\n popup: function(src) {\n var img_win = window.open('', 'Charts: Export as Image')\n with(img_win.document) {\n write('<html><head><title>Charts: Export as Image<\\/title><\\/head><body>' + OFC.jquery.image(src) + '<\\/body><\\/html>') }\n // stop the 'loading...' message\n img_win.document.close();\n }\n }\n \n // Using_ an object as namespaces is JS Best Practice. I like the Control.XXX style.\n //if (!Control) {var Control = {}}\n //if (typeof(Control == \"undefined\")) {var Control = {}}\n if (typeof(Control == \"undefined\")) {var Control = {OFC: OFC.jquery}}\n \n \n // By default, right-clicking on OFC and choosing \"save image locally\" calls this function.\n // You are free to change the code in OFC and call my wrapper (Control.OFC.your_favorite_save_method)\n // function save_image() { alert(1); Control.OFC.popup('my_chart') }\n function save_image() { alert(\"Your image will be displayed in a new window\"); OFC.jquery.popup('my_chart') }\n </script>\n <div id='my_chart' style='float:left; margin-left:28px;'></div>\n "; return $heading; }
function get_graph($field, $args) { $defaults = array('ids' => false, 'colors' => array('#EF8C08', '#21759B', '#1C9E05'), 'grid_color' => '#f7e8bf', 'bg_color' => '#FFFFFF', 'odd' => false, 'truncate' => 40, 'truncate_label' => 15, 'response_count' => 10, 'user_id' => false, 'type' => 'default', 'x_axis' => false, 'data_type' => 'count', 'limit' => '', 'x_start' => '', 'x_end' => '', 'show_key' => false, 'min' => '', 'max' => '', 'include_zero' => false, 'width' => 400, 'height' => 400); $args = wp_parse_args($args, $defaults); $vals = $this->get_graph_values($field, $args); extract($args); extract($vals); $title = new title(preg_replace("/&#?[a-z0-9]{2,8};/i", "", FrmAppHelper::truncate($field->name, $truncate, 0))); $chart = new open_flash_chart(); $chart->set_title($title); $bar = new bar_glass(); $x = new x_axis(); $y = new y_axis(); $x_labels = new x_axis_labels(); if (in_array($field->type, array('select', 'checkbox', 'radio', '10radio', 'scale')) and (!isset($x_inputs) or !$x_inputs)) { $x_labels->rotate(340); //$x_labels->set_colour( '#A2ACBA' ); //$x->set_colour( '#A2ACBA' ); } else { if ($field->type == 'user_id') { if (!$pie) { $x_labels->rotate(340); } } else { $x_labels->rotate(340); } } $pie = $type == 'default' ? $pie : ($type == 'pie' ? true : false); if ($pie) { $bar = new pie(); $bar->set_alpha(0.6); $bar->set_start_angle(35); $bar->add_animation(new pie_fade()); $bar->set_tooltip('#val# (#percent#)'); $bar->set_colours($colors); $pie_values = array(); foreach ($values as $val_key => $val) { if ($val) { $pie_values[] = new pie_value($val, "{$labels[$val_key]} (" . round($val / $total_count * 100) . "%)"); } } $bar->set_values($pie_values); } else { $color = $odd ? current($colors) : next($colors); if (!$color) { $color = reset($colors); } if ($type == 'line') { $bar = new line(); } else { if ($type == 'hbar') { $bar = new hbar($color); } else { if ($type == 'area') { $bar = new area(); } else { if ($type == 'bar_flat') { $bar = new bar($color); } else { $bar = new bar_glass($color); } } } } $bar->set_colour($color); $bar->set_values($values); if ($show_key) { $bar->set_key(stripslashes($field->name), $show_key); } $x_labels->set_labels($labels); $x->set_labels($x_labels); $x->set_grid_colour($grid_color); $y->set_grid_colour($grid_color); if ($combine_dates and !strpos($width, '%') and count($labels) * 30 > (int) $width) { $x_labels->visible_steps(ceil(count($labels) * 30 / (int) $width)); } $set_max = $max; if (!empty($values) and empty($max)) { $max = abs(max($values) * 1.2); if ($max < 3) { $max = 3; } } foreach ($ids as $f_id) { $new_max = abs(max($f_values[$f_id]) * 1.2); if ($set_max != $max and $new_max > $max) { $max = $new_max; } unset($f_id); unset($new_max); } $bars = array(); foreach ($f_values as $f_id => $f_vals) { if ($type == 'line') { $bars[$f_id] = new line(); } else { if ($type == 'hbar') { $bars[$f_id] = new hbar($color); } else { if ($type == 'area') { $bars[$f_id] = new area(); } else { if ($type == 'bar_flat') { $bars[$f_id] = new bar(); } else { $bars[$f_id] = new bar_glass(); } } } } $color = next($colors); if (!$color) { $color = reset($colors); } $bars[$f_id]->set_colour($color); $bars[$f_id]->set_values($f_vals); if ($show_key) { $bars[$f_id]->set_key(stripslashes($fields[$f_id]->name), $show_key); } unset($f_id); } if (isset($max) and !empty($max)) { $step = ceil($max / 10); if (empty($min)) { $min = 0; } $y->set_range($min, $max, $step); } } $chart->add_element($bar); if (isset($bars) and !empty($bars)) { foreach ($bars as $f_bar) { $chart->add_element($f_bar); } } $chart->set_bg_colour($bg_color); if (!$pie) { $chart->set_y_axis($y); $chart->set_x_axis($x); } return $chart->toPrettyString(); }
$pie1->set_tooltip($toolTip); $pie1->set_colours(array('#D544A2', '#9408E0', '#E25374', '#269C16', '#9F0946', '#EC7E64', '#8F4F64', '#0AD5A5', '#F957BD', '#F4C377', '#0CEBC5', '#CCDE8B', '#F7FB8C', '#7CBF0C', '#799756', '#D5FFA2')); //Pie 2 $title2 = new title("Top Melodii"); $pie2 = new pie(); $pie2->set_alpha(0.6); $pie2->add_animation(new pie_bounce(8)); //$pie2->radius(100); $pie2->add_animation(new pie_fade()); $pie2->set_tooltip($toolTip); $pie2->set_colours(array('#D544A2', '#9408E0', '#E25374', '#269C16', '#9F0946', '#EC7E64', '#8F4F64', '#0AD5A5', '#F957BD', '#F4C377', '#0CEBC5', '#CCDE8B', '#F7FB8C', '#7CBF0C', '#799756', '#D5FFA2')); //Pie 3 $title3 = new title("Top Albume"); $pie3 = new pie(); $pie3->set_alpha(0.6); $pie3->add_animation(new pie_bounce(8)); //$pie3->radius(100); $pie3->add_animation(new pie_fade()); $pie3->set_tooltip($toolTipLabel); $pie3->set_colours(array('#D544A2', '#9408E0', '#E25374', '#269C16', '#9F0946', '#EC7E64', '#8F4F64', '#0AD5A5', '#F957BD', '#F4C377', '#0CEBC5', '#CCDE8B', '#F7FB8C', '#7CBF0C', '#799756', '#D5FFA2')); $pie3->set_no_labels(); //Pie 1 foreach ($topArtistArr->result() as $row) { $pieArr1[] = new pie_value(intval($row->artistCount), $row->artist); } //Pie 2 foreach ($topSongsArr->result() as $row) { $pieArr2[] = new pie_value(intval($row->trackIdCount), $row->trackName); } //Pie 3 foreach ($topAlbumsArr->result() as $row) {