转换数组将在Javascript中用于Google的气泡图

时间:2014-01-17 16:28:35

标签: javascript php jquery arrays google-visualization

我有以下 PHP数组如下

Array ( [0] => Array ( [0] => Procedure [1] => Total Paid [2] => Total Charged [3] => Over Charged [4] => Amount % ) 
[1] => Array ( [0] => ALCOHOL/DRUG ABUSE OR DEPENDENCE W/O REHABILITATION THERAPY W/O MCC [1] => 161820812.00 [2] => 459327337.00 [3] => 64.77 [4] => 35.23 ) 
[2] => Array ( [0] => SPINAL FUSION EXCEPT CERVICAL W/O MCC [1] => 1804860128.00 [2] => 6130083182.00 [3] => 70.56 [4] => 29.44 ) 
[3] => Array ( [0] => OTHER KIDNEY & URINARY TRACT DIAGNOSES W MCC [1] => 273179578.00 [2] => 932268508.00 [3] => 70.70 [4] => 29.30 ) 
[4] => Array ( [0] => INFECTIOUS & PARASITIC DISEASES W O.R. PROCEDURE W MCC [1] => 1629325732.00 [2] => 5606250007.00 [3] => 70.94 [4] => 29.06 ) )

我已经将此数组用作

var five_drg_values = <?php echo json_encode($topFiveDrgValues); ?>;

我需要使用以下格式的JavaScript中的上述数组

       [['Procedure'    , 'Total Paid', 'Total Charged', 'Over Charged',     'Amount %'],
          ['ALCOHOL..',    161820812.00,             459327337.00,      '64.77',  35.23],
          ['ALCOHOL..',    161820812.00,             459327337.00,      '64.77',  35.23],
          ['ALCOHOL..',    161820812.00,             459327337.00,      '64.77',  35.23],
          ['ALCOHOL..',    161820812.00,             459327337.00,      '64.77',  35.23],
          ['ALCOHOL..',    161820812.00,             459327337.00,      '64.77',  35.23],
          ['ALCOHOL..',    161820812.00,             459327337.00,      '64.77',  35.23],
        ]);

five_drg_values的Var Dump给我这个

Procedure,Total Paid,Total Charged,Over Charged,Amount %, ALCOHOL/DRUG ABUSE OR DEPENDENCE W/O REHABILITATION THERAPY W/O MCC,161820812.00,459327337.00,64.77,35.23, SPINAL FUSION EXCEPT CERVICAL W/O MCC,1804860128.00,6130083182.00,70.56,29.44, OTHER KIDNEY & URINARY TRACT DIAGNOSES W MCC,273179578.00,932268508.00,70.70,29.30, INFECTIOUS & PARASITIC DISEASES W O.R. PROCEDURE W MCC,1629325732.00,5606250007.00,70.94,29.06

0 个答案:

没有答案