gpt4 book ai didi

php - highcharts 从数据库表中提取数据

转载 作者:行者123 更新时间:2023-11-29 13:15:14 26 4
gpt4 key购买 nike

我正在使用的演示:http://jsfiddle.net/98Fuq/4/

我使用

在 x 轴上显示职位编号
$sql = "SELECT * FROM view_job_budgetreport";
$result = mysqli_query($dbc3, $sql);
while($row = mysqli_fetch_assoc($result)) {
$jobNum[] = $row['Job_Num'];
}

然后在我的代码中:

var colors = Highcharts.getOptions().colors,
categories = [<?php echo join($jobNum, ',') ?>], //I display the job nums here
name = '% of budgeted hours',
level = 0,
data = [{
y: 300,
color: colors[0],
drilldown: {
name: 'Job # Detailed Overview',
categories: ['Surfacing', 'Design', 'Details', 'Ejector', 'EDM', 'GD/BM', 'CNC', 'Mold Making', 'Spotting', 'Spotting Line', 'Handwork', 'Tryout' ],
level: 1,
data: [{
y: 30,
drilldown: {
level: 2,
name: 'Job # Machining Overview',
categories: ['CNC 1', 'CNC 2', 'CNC 3', 'CNC4', 'Gun Drill 1', 'Gun Drill 2', 'Boring Mill 1', 'Boring Mill 2', 'EDM 1', 'EDM 2', 'EDM 3'],
data: [23,54,47, 58, 42, 10, 34, 78, 10, 55, 25],
color: colors[3]
}
}, 40, 7.35, 2.41, 200, 100, 50, 75, 86, 95, 75, 25],
color: colors[2]
}
}

现在这部分工作得很好,但是我一生都无法弄清楚深入分析的第 2 层和第 3 层。我尝试使用与处理职位编号相同的方法。

表结构:

Table Structure

最佳答案

像这样更改你的 php,这样你就可以获得所需的所有值;

$sql = "SELECT * FROM view_job_budgetreport";
$result = mysqli_query($dbc3, $sql);
while($row = mysqli_fetch_assoc($result)) {
$jobNum[] = $row['Job_Num'];
$jobData[$row['Job_Num']] = $row['Job_Y'];
$jobDrillData[$row['Job_Num']][] = $row;
}

然后在 highcharts 中循环这些变量

关于php - highcharts 从数据库表中提取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21556778/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com