-1

我真的坚持从 1 周开始,任何人都可以帮助我创建一个数组,用于使用 php 从数据库动态创建 Highcharts 中的分组类别。这是一个表格示例

<pre><code>
   +-------+---------------+---------------------------+
   |BATCH  |   CATEGORY    |         GENDER            |
   +-------+---------------+---------------------------+
   | 2012  |    General    |   Male                    |
   | 2012  |    Test       |   Female                  |
   | 2013  |    General    |   Female                  |
   | 2013  |    Test       |   Male                    |
   +-------+---------------+---------------------------+
   </code></pre>

我希望这张桌子的结构是这样的

 <pre><code>
   Array ( [0] => 
            Array ( [name] => 2012 
                    [categories] => 
                    Array ( [0] => Array ( [name] => General 
                                           [categories] => Array ([0] => Male )) 
                            [1] => Array ( [name] => Test 
                                           [categories] => Array ([0] => Female )))) 
        [1] => 
            Array ( [name] => 2013 
                    [categories] => 
                    Array ( [0] => Array ( [name] => General 
                                           [categories] => Array ([0] => Female )) 
                            [1] => Array ( [name] => Test 
                                           [categories] => Array ([0] => Male )))) 
        )
   </code></pre>

请帮我.......

4

1 回答 1

1

添加用于 highcharts的分组类别插件,然后为图表创建一个 javascript 助手。

于 2013-11-28T06:51:23.460 回答