public function freshChart() { $db = new MoboDB(); $bug1 = $db->selectBugOandC1(); $bug2 = $db->selectBugOandC2(); $db = null; $data = array(array(), array()); foreach ($bug1 as $bug) { $abc = array("name" => $bug["name"], "y" => (int) $bug["y"], "color" => $bug["color"]); array_push($data[0], $abc); } foreach ($bug2 as $bug) { $name = $bug["name"] . $bug["y"] . "个"; $abc = array("name" => $name, "y" => (int) $bug["y"], "color" => $bug["color"]); array_push($data[1], $abc); } $data123["series"] = array(array("name" => "Bug数", "size" => "60%", "dataLabels" => array("distance" => -30)), array("name" => "Bug数", "size" => "80%", "innerSize" => "62%")); $data123["series"][0]["data"] = $data[0]; $data123["series"][1]["data"] = $data[1]; return $data123; }
/** * 从其他数据源获取数据 */ public function freshChart() { $db = new MoboDB(); $bug1 = $db->selectBugOandC1(); $bug2 = $db->selectBugOandC2(); $db = null; $this->chart->data["series"][0]["data"] = array(); $this->chart->data["series"][1]["data"] = array(); foreach ($bug1 as $bug) { $abc = array("name" => $bug["name"], "y" => (int) $bug["y"], "color" => $bug["color"]); array_push($this->chart->data["series"][0]["data"], $abc); } foreach ($bug2 as $bug) { $name = $bug["name"] . $bug["y"] . "个"; $abc = array("name" => $name, "y" => (int) $bug["y"], "color" => $bug["color"]); array_push($this->chart->data["series"][1]["data"], $abc); } $this->chart->improve(); return $this->chart->getChartJson(); }