如何创建基于主题或电子邮件地址的条形图?

4urapxun  于 2021-06-23  发布在  Mysql
关注(0)|答案(0)|浏览(144)

我想用海图做邮件发送报告。这是我已经创建的图表。
18,19,20。。。是电子邮件的id。所以图表显示了所有的电子邮件报告。但我想显示每个电子邮件id的图表。
报表.php

<?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
     ]
]);

电子邮件控制器.php

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 
                 ]);
}

这是数据库
谢谢:)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题