$brval[]=620; $brval[]=350; $brval[]=470; $brval[]=134; $brval[]=267; $brval[]=534; */ $tmp = 0; $d = array(); for ($i = 0; $i < $ii; $i++) { $tmp = new pie_value(intval($brval[$i]), ""); // // this slice would normally be light green // but we are overriding the colour here: // //$tmp->set_colour( '#'.$i.'F'.$i.'3C'.$i ); $tmp->set_label($br[$i], '#BFFF00', 10); $d[] = $tmp; // // here the colour cycle wraps and this gets the // first colour: // } $pie = new pie(); $pie->start_angle(35)->add_animation(new pie_fade())->add_animation(new pie_bounce(4))->gradient_fill()->tooltip('#val# of #total#<br>#percent# of 100%')->colours(array('#B8001F', '#4400A4', '#CD6600', '#E6FE00', '#007ED5', '#54E300')); $pie->set_values($d); $chart = new open_flash_chart(); $chart->set_title($title); $chart->add_element($pie); $chart->set_bg_colour('#AB4800'); echo $chart->toPrettyString();
/** * 工作耗时饼猪状图 *@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(); }
$brval[]=620; $brval[]=350; $brval[]=470; $brval[]=134; $brval[]=267; $brval[]=534; */ $tmp = 0; $d = array(); for ($i = 0; $i < $ii; $i++) { $tmp = new pie_value(intval($brval[$i]), ""); // // this slice would normally be light green // but we are overriding the colour here: // //$tmp->set_colour( '#'.$i.'F'.$i.'3C'.$i ); $tmp->set_label($br[$i] . " Bit", '#BFFF00', 10); $d[] = $tmp; // // here the colour cycle wraps and this gets the // first colour: // } $pie = new pie(); $pie->start_angle(35)->add_animation(new pie_fade())->add_animation(new pie_bounce(4))->gradient_fill()->tooltip('#val# of #total#<br>#percent# of 100%')->colours(array('#B8001F', '#4400A4', '#CD6600', '#E6FE00', '#007ED5', '#54E300')); $pie->set_values($d); $chart = new open_flash_chart(); $chart->set_title($title); $chart->add_element($pie); $chart->set_bg_colour('#AB4800'); echo $chart->toPrettyString();
} $uid = $_GET['uid']; $field = $_GET['fld']; $ttl = "Browser"; // echo $uid; // echo $field; // echo $ttl; // echo "SELECT ".$field.", COUNT( ".$field." ) AS total FROM tracker WHERE c_id = '".$uid."' and ".$dateRange." GROUP BY ".$field; include_once 'db.php'; $q = mysql_query("SELECT " . $field . ", COUNT( " . $field . " ) AS total FROM tracker WHERE c_id = '" . $uid . "' and " . $dateRange . " GROUP BY " . $field); include 'php-ofc-library/open-flash-chart.php'; $title = new title($ttl); $tmp = 0; while ($row = mysql_fetch_array($q)) { $tmp = new pie_value(intval($row['total']), ""); // // this slice would normally be light green // but we are overriding the colour here: // //$tmp->set_colour( '#'.$i.'F'.$i.'3C'.$i ); $tmp->set_label($row[$field], '#BFFF00', 10); $d[] = $tmp; } $pie = new pie(); $pie->start_angle(35)->add_animation(new pie_fade())->add_animation(new pie_bounce(4))->gradient_fill()->tooltip('#val# of #total#<br>#percent# of 100%')->colours(array('#B8001F', '#4400A4', '#CD6600', '#E6FE00', '#007ED5', '#54E300')); $pie->set_values($d); $chart = new open_flash_chart(); $chart->set_title($title); $chart->add_element($pie); $chart->set_bg_colour('#AB4800'); echo $chart->toPrettyString();