本文整理汇总了PHP中chart_color函数的典型用法代码示例。如果您正苦于以下问题:PHP chart_color函数的具体用法?PHP chart_color怎么用?PHP chart_color使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了chart_color函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: local_date
/*------------------------------------------------------ */
//-- 显示统计信息
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'list') {
/* 赋值查询时间段 */
$smarty->assign('start_time', local_date('Y-m-d', $start_time));
$smarty->assign('end_time', local_date('Y-m-d', $end_time));
/* 赋值统计数据 */
$xml = "<chart caption='' xAxisName='%s' showValues='0' decimals='0' formatNumberScale='0'>%s</chart>";
$set = "<set label='%s' value='%s' />";
$i = 0;
$data_count = '';
$data_amount = '';
foreach ($data_list as $data) {
$data_count .= sprintf($set, $data['period'], $data['order_count'], chart_color($i));
$data_amount .= sprintf($set, $data['period'], $data['order_amount'], chart_color($i));
$i++;
}
$smarty->assign('data_count', sprintf($xml, '', $data_count));
// 订单数统计数据
$smarty->assign('data_amount', sprintf($xml, '', $data_amount));
// 销售额统计数据
$smarty->assign('data_count_name', $_LANG['order_count_trend']);
$smarty->assign('data_amount_name', $_LANG['order_amount_trend']);
/* 根据查询类型生成文件名 */
if ($query_type == 'year') {
$filename = date('Y', $start_time) . "_" . date('Y', $end_time) . '_report';
} else {
$filename = date('Ym', $start_time) . "_" . date('Ym', $end_time) . '_report';
}
$smarty->assign('action_link', array('text' => $_LANG['down_sales_stats'], 'href' => 'sale_general.php?act=download&filename=' . $filename . '&query_type=' . $query_type . '&start_time=' . $start_time . '&end_time=' . $end_time));
示例2: while
while ($val = $db->fetchRow($res)) {
$keyword[$val['keyword']] = 1;
$searchengine[$val['searchengine']][$val['keyword']] = $val['count'];
}
$general_xml .= "<categories>";
foreach ($keyword as $key => $val) {
$key = str_replace('&', '&', $key);
$key = str_replace('>', '>', $key);
$key = str_replace('<', '<', $key);
$key = htmlspecialchars($key);
$general_xml .= "<category label='" . str_replace('\'', '', $key) . "' />";
}
$general_xml .= "</categories>\n";
$i = 0;
foreach ($searchengine as $key => $val) {
$general_xml .= "<dataset seriesName='{$key}' color='" . chart_color($i) . "' showValues='0'>";
foreach ($keyword as $k => $v) {
$count = 0;
if (!empty($searchengine[$key][$k])) {
$count = $searchengine[$key][$k];
}
$general_xml .= "<set value='{$count}' />";
}
$general_xml .= "</dataset>";
$i++;
}
$general_xml .= '</chart>';
/* 模板赋值 */
$smarty->assign('ur_here', $_LANG['searchengine_stats']);
$smarty->assign('general_data', $general_xml);
$searchengines = array('ecshop' => false, 'MSLIVE' => false, 'BAIDU' => false, 'GOOGLE' => false, 'GOOGLE CHINA' => false, 'CT114' => false, 'SOSO' => false);
示例3: sale_trend
function sale_trend()
{
require_once SYS_PATH_ADMIN . 'inc/common.php';
// 取得查询类型和查询时间段
if (empty($_POST['query_by_year']) && empty($_POST['query_by_month'])) {
// 默认当年的月走势
$query_type = 'month';
$start_time = strtotime(date('Y') . '-1');
$end_time = mktime();
} else {
if (isset($_POST['query_by_year'])) {
// 年走势
$query_type = 'year';
$start_time = strtotime($_POST['year_beginYear'] . '-01-01');
$end_time = strtotime($_POST['year_endYear'] . '-' . date('m-d', mktime()));
} else {
// 月走势
$query_type = 'month';
$start_time = intval(strtotime($_POST['month_beginYear'] . "-" . $_POST['month_beginMonth']));
$end_time = intval(strtotime($_POST['month_endYear'] . "-" . $_POST['month_endMonth']));
}
}
// 分组统计订单数和销售额:已发货时间为准
$format = $query_type == 'year' ? '%Y' : '%Y-%m';
$sql = "SELECT DATE_FORMAT(FROM_UNIXTIME(add_time), '{$format}') AS period, COUNT(*) AS order_count, SUM(goods_amount + shipping_fee) AS order_amount FROM `{$this->App->prefix()}goods_order_info` WHERE add_time BETWEEN '{$start_time}' AND '{$end_time}' AND order_status='2' AND pay_status='1' GROUP BY period";
$data_list = $this->App->find($sql);
// 赋值统计数据
$xml = "<chart caption='' xAxisName='%s' showValues='0' decimals='0' formatNumberScale='0'>%s</chart>";
$set = "<set label='%s' value='%s' />";
$i = 0;
$data_count = '';
$data_amount = '';
if (!empty($data_list)) {
foreach ($data_list as $data) {
$data_count .= sprintf($set, $data['period'], $data['order_count'], chart_color($i));
$data_amount .= sprintf($set, $data['period'], $data['order_amount'], chart_color($i));
$i++;
}
}
$rt['order_data'] = sprintf($xml, '', $data_count);
// 订单数统计数据
$rt['sale_data'] = sprintf($xml, '', $data_amount);
// 销售额统计数据
$years = array(date('Y') - 5 => date('Y') - 5, date('Y') - 4 => date('Y') - 4, date('Y') - 3 => date('Y') - 3, date('Y') - 2 => date('Y') - 2, date('Y') - 1 => date('Y') - 1, date('Y') => date('Y'), date('Y') + 1 => date('Y') + 1, date('Y') + 2 => date('Y') + 2, date('Y') + 3 => date('Y') + 3, date('Y') + 4 => date('Y') + 4, date('Y') + 5 => date('Y') + 5);
$months = array();
for ($i = 1; $i < 13; $i++) {
$months[] = $i;
}
$this->set('years', $years);
$this->set('months', $months);
$this->set('rt', $rt);
$this->template('sale_trend');
}
示例4: foreach
} else {
$category[$date][$val['referer_domain']] = 1;
}
}
$from_xml = "<chart palette='2' caption='{$_LANG['from_stats']}' shownames='1' showvalues='0' numberPrefix='' useRoundEdges='1' legendBorderAlpha='0' outCnvBaseFontSize='13' baseFontSize='13'>";
$from_xml .= '<categories>';
foreach ($domain_arr as $k => $v) {
$from = $k == '' ? $_LANG['input_url'] : $k;
$from_xml .= "<category label='{$from}'/>";
}
$from_xml .= '</categories>';
$key = 0;
foreach ($start_date_arr as $val) {
++$key;
$date = local_date('Y-m', $val);
$from_xml .= "<dataset seriesName='{$date}' color='" . chart_color($key) . "' showValues='0'>";
foreach ($domain_arr as $k => $v) {
if (isset($category[$date][$k])) {
$from_xml .= "<set value='" . $category[$date][$k] . "'/>";
} else {
$from_xml .= "<set value='0'/>";
}
}
$from_xml .= '</dataset>';
}
$from_xml .= '</chart>';
}
/* 模板赋值 */
$smarty->assign('ur_here', $_LANG['flow_stats']);
$smarty->assign('general_data', $general_xml);
$smarty->assign('area_data', $area_xml);
示例5: sort_flag
/* 排序标记 */
$sort_flag = sort_flag($logdb['filter']);
$smarty->assign($sort_flag['tag'], $sort_flag['img']);
make_json_result($smarty->fetch('keyword_list.htm'), '', array('filter' => $logdb['filter'], 'page_count' => $logdb['page_count']));
} elseif ($_REQUEST['act'] == 'view') {
$id = intval($_GET['id']);
$sql = "SELECT * FROM " . $ecs->table('keyword') . " WHERE searchengine='ecshop' AND w_id='{$id}'";
$kw = $db->getRow($sql);
$area_xml = '';
$area_xml .= "<graph caption='" . sprintf($_LANG['tagword_area'], $kw['word']) . "' shownames='1' showvalues='1' decimalPrecision='2' outCnvBaseFontSize='13' baseFontSize='13' pieYScale='45' pieBorderAlpha='40' pieFillAlpha='70' pieSliceDepth='15' pieRadius='100' bgAngle='460'>";
$sql = "SELECT COUNT(*) AS access_count, area FROM " . $ecs->table('keyword_area') . " WHERE w_id = '{$id}' " . " GROUP BY area ORDER BY access_count DESC LIMIT 20";
$res = $db->query($sql);
$key = 0;
while ($val = $db->fetchRow($res)) {
$area = empty($val['area']) ? 'unknow' : $val['area'];
$area_xml .= "<set name='{$area}' value='{$val['access_count']}' color='" . chart_color($key) . "' />";
$key++;
}
$area_xml .= '</graph>';
$smarty->assign('ur_here', $_LANG['tab_area']);
$smarty->assign('area_data', $area_xml);
$smarty->assign('action_link', array('text' => $_LANG['keywords_list'], 'href' => 'keyword.php?act=list&' . list_link_postfix()));
assign_query_info();
$smarty->display('keyword_area.htm');
} elseif ($_REQUEST['act'] == 'toggle_show') {
$id = intval($_POST['id']);
$val = intval($_POST['val']);
$sql = "UPDATE " . $ecs->table('keyword') . " SET status = '{$val}' WHERE w_id = '{$id}'";
$db->query($sql);
make_json_result($val);
} elseif ($_REQUEST['act'] == 'batch_drop') {