Php 如何根据主题或电子邮件id创建条形图高度图?
我想使用highchart制作电子邮件发送报告 18,19,20。。。是电子邮件id。因此图表显示了所有电子邮件报告。但我想显示每个电子邮件id的图表 report.phpPhp 如何根据主题或电子邮件id创建条形图高度图?,php,mysql,highcharts,yii2,chart.js,Php,Mysql,Highcharts,Yii2,Chart.js,我想使用highchart制作电子邮件发送报告 18,19,20。。。是电子邮件id。因此图表显示了所有电子邮件报告。但我想显示每个电子邮件id的图表 report.php <?php use dosamigos\highcharts\HighCharts; use backend\models\Email; $this->title = 'Megablast Statistics'; foreach($dreport as $values) { $a[0]= ($v
<?php
use dosamigos\highcharts\HighCharts;
use backend\models\Email;
$this->title = 'Megablast Statistics';
foreach($dreport as $values) {
$a[0]= ($values['email_id']);
$c[]= ($values['email_id']);
$b[]= array('type'=> 'column', 'name' =>$values['email_id'], 'data' => array((int)$values['number_of_recipient'],
(int)$values['number_of_delivery'],(int)$values['number_of_open'], (int)$values['number_of_click'], (int)$values['number_of_complain'], (int)$values['number_of_bounces']) );
}
echo
Highcharts::widget([
'clientOptions' => [
'chart'=>[
'type'=>'pie'
],
'title' => ['text' => 'Megablast Statistics'],
'xAxis' => [
'categories' => ['number_of_recipient', 'number_of_delivery', 'number_of_open', 'number_of_click', 'number_of_complain', 'number_of_bounces']
],
'yAxis' => [
'title' => ['subject' => '']
],
'series' => $b
]
]);
谢谢:)您没有提供任何与条形图相关的信息,HighChart小部件的代码在哪里?很抱歉,我已经编辑了:)@MuhammadOmerAslamIt因为您将整个系列数组设置为
系列
图表配置对象中的键,但是,您只需要从数组中分配一个序列,例如通过检查它的电子邮件\u id
。如何通过检查电子邮件\u id来定义序列@daniel_Syu您正在为所有电子邮件在for each循环中一起设置序列,如果您想根据电子邮件显示图表,您应该过滤掉电子邮件并单独显示它们的图表,$dreport
中有什么?
public function actionReport()
{
$data = Yii::$app->db->createCommand('select email_id,
number_of_recipient,
number_of_delivery,
number_of_open,
number_of_click,
number_of_complain,
number_of_bounces
from email
group by email_id')->queryAll();
//print_r($data);
return $this->render('report', [
'dreport' => $data
]);
}