javascript - 使用 Highcharts 使用 Mysql DB 通过 PhP 的数据创建风玫瑰
问题描述
我已将气象数据存储在 MySQL 数据库中;我想使用风表检索和显示风数据。查看 Highcharts (windrose) 的示例,我注意到数据需要按基本方向组织(每个风向都是一个查询)。所以我创建了一个查询,准确地提供风向的频率,如下所示:
速度航向频率
0-5 N 154
10-15 N 81
15-20 N 91
20-30 牛 35
30-40 牛 1
5-10 牛 100
0 北东 1
0-5 NNE 295
10-15 NNE 48
15-20 NNE 18
20-30 NNE 6
5-10 NNE 86
0 东北 1 … …</p>
0-5 西北偏北 86
10-15 NNW 96
15-20 西北 55
20-30 NNW 11
5-10 NNW 89
您对如何在下面的示例中用 sql 查询替换数据数组有任何建议或示例吗?下面是 Highcharts 上可用示例的摘录频率是硬编码的,所以没关系。数据部分应读取查询。任何帮助都非常受欢迎,在此先感谢 Giancarlo
<script src="../../code/highcharts.js"></script>
<script src="../../code/highcharts-more.js"></script>
<script src="../../code/modules/data.js"></script>
<script src="../../code/modules/exporting.js"></script>
<script src="../../code/modules/export-data.js"></script>
<div id="container"></div>
<div style="display:none">
<!-- Source: http://or.water.usgs.gov/cgi-bin/grapher/graph_windrose.pl -->
<table id="freq" border="0" cellspacing="0" cellpadding="0">
<tr nowrap bgcolor="#CCCCFF">
<th colspan="9" class="hdr">Table of Frequencies (percent)</th>
</tr>
<tr nowrap bgcolor="#CCCCFF">
<th class="freq">Direction</th>
<th class="freq">< 0.5 m/s</th>
<th class="freq">0.5-2 m/s</th>
<th class="freq">2-4 m/s</th>
<th class="freq">4-6 m/s</th>
<th class="freq">6-8 m/s</th>
<th class="freq">8-10 m/s</th>
<th class="freq">> 10 m/s</th>
<th class="freq">Total</th>
</tr>
<tr nowrap>
<td class="dir">N</td>
<td class="data">1.81</td>
<td class="data">1.78</td>
<td class="data">0.16</td>
<td class="data">0.00</td>
<td class="data">0.00</td>
<td class="data">0.00</td>
<td class="data">0.00</td>
<td class="data">3.75</td>
</tr>```
解决方案
推荐阅读
- python - 如何在 Python 中关联两个音频事件(检测它们是否相似)
- c# - 如何获取 SQL Server 数据库文件连接字符串以在 Visual Studio 2013 中部署项目?
- javascript - 异步等待承诺待处理
- google-apps-script - 如何修改此功能以对每个选项卡使用多个选项卡和列?
- c# - 评估嵌套在 foreach 中的值和国际象棋中的 if 方法
- python - 一起使用过采样和 cross_validation 函数的方法是什么?
- ionic-framework - 如果要大写的文本在 ionic3 中为大写,则大写不起作用
- python-3.x - 在部分输出上评估 keras 模型
- c# - while 循环从 SQL 表返回空异常
- python - yf.Tickers 从 yfinance 下载多个代码的信息并动态访问每个代码