php - 如何根据主题或 email_id 创建条形图 highchart?
问题描述
我想使用 highchart 制作电子邮件发送报告。这是我已经创建的图表。
18,19, 20... 是 email_id。所以图表显示了所有的电子邮件报告。但我想显示每个 email_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
]);
}
谢谢 :)
解决方案
推荐阅读
- podman - Podman-compose 与 podman run 关于环境变量
- python - 正则表达式搜索 AutoCAD 图纸上的资产标签
- r - 从函数返回基础图和 ggplot
- python - Python,Google Places API - 在给定一组纬度/经度的情况下查找附近的地方
- .htaccess - 通过 htaccess 访问图像时,有什么方法可以打开另一个文件?
- reactjs - 组件定义缺少显示名称反应/显示名称错误
- python - 将 Pandas 数据框列中嵌套 Json 中的部分转换为另一个数据框
- laravel - 如何在 Laravel 中使用数字进行 ORDER BY?
- oracle - Oracle Apex 区域标题
- java - 你怎么能生成所有长度都没有重复的 ABC 排列?