mysql - 来自mysql的Highcharts钻取数据
问题描述
我试图对我的图表使用类似于以下的钻取方法:https ://www.highcharts.com/demo/column-drilldown/sand-signika%5d%5b1%5d 。但我想深入了解年、月、周和日的数据。我该如何执行?这是我的代码:
$query = "SELECT sum(product_total) as total, YEAR(`date`) as year FROM confirm_order_product GROUP BY YEAR(date) ORDER BY date";
$result = $mysqli->query($query);
while($row = $result->fetch_array(MYSQLI_ASSOC))
{
$salestotal[] = $row['total'];
$sdate[] = $row['year'];
}
$salesdate = json_encode($sdate, JSON_NUMERIC_CHECK);
$sales = json_encode($salestotal, JSON_NUMERIC_CHECK);
容器:
$(function() {
$('#container').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Sales Report'
},
xAxis: {
categories: <?php echo $salesdate; ?>
},
yAxis: {
title: {
text: 'Value'
},
},
tooltip: {
valuePrefix: '₱'
},
series: [{
name: 'Sales',
colorByPoint: true,
data:<?php echo $sales; ?>,
}],
});
});
这仅每年显示。
解决方案
推荐阅读
- reactjs - 为什么它不将丢失的键保存到 translation.json (i18next)?
- mysql - 创建一个 MySQL 函数
- r - 自定义函数在 mutate dplyr 中无法正常工作
- docusignapi - DocuSign API - 列表模板不包括选项卡详细信息
- android - Environment.getExternalStorageDirectory() 已弃用。如何新建文件夹?
- apache-nifi - 如何迁移 NiFi 处理器的集群状态
- python - 正则表达式 re.sub 关于文件字体问题
- android - 错误:找不到资源 android:attr/ttcIndex。错误:链接引用失败
- reactjs - CircleCI 的 SonarCloud 错误:请检查属性 sonar.login 和 sonar.password
- android - 当 Date 项目为空时,Moshi 无法转换 Json