|
|
|
| Есть код:
if(isset($_POST['fromdate'])){
$fromdate = $_POST['fromdate'];
$todate=$_POST['todate'];
}else{
// $fromdate='01/'.date('m/Y');
// $todate=date('d/m/Y');
echo "No results found";
exit;
}
$countries="SELECT ord.customers_country, cn.countries_id";
$from=" from ".TABLE_ORDERS. " ord, ".TABLE_COUNTRIES. " cn ";
$where="WHERE ord.date_purchased BETWEEN '".guion($fromdate)."' AND '".guion($todate)."' AND ord.customers_country=cn.countries_name";
$query=Tep_db_query($countries.$from.$where);
while ($country =Tep_db_fetch_array ($query)){
if(isset($temp[$country['customers_country']])){
$temp[$country['customers_country']]['num_orders']++;
}else{
$temp[$country['customers_country']]=array('countries_id'=>$country['countries_id'],
'num_orders'=>1);
}
}
|
require (DIR_WS_CLASSES.'/libchart/classes/libchart.php');
$chart= new VerticalBarChart(sizeof($temp)*50,250);
$chart1=new PieChart(800,500);
$dataSet=new XYDataSet();
//$dataSet1=new XYDataSet();
foreach($temp as $country_name=> $array){
//$dataSet1->addPoint(new Point($country_name($array[num_orders])));
$dataSet->addPoint(new Point($country_name,$array[num_orders]));
}
$chart->setDataSet($dataSet);
$chart1->setDataSet($dataSet);
//display chart
$chart->setTitle("");
$chart->render(DIR_WS_IMAGES.'graphs/libchart/stats_countries.png');
$chart1->setTitle("");
$chart1->render(DIR_WS_IMAGES.'graphs/libchart/stats_countries1.png');
//print_r($chart1);
|
Подскажите,как сортировать? | |
|
|
|
|
|
|
|
|
для: kaya
(28.03.2010 в 11:53)
| | По-моему, здесь автор либо многое скрывает, либо наоборот приводит чересчур много кода, не относящегося к проблеме. | |
|
|
|