2011-05-17 56 views
1

因此,我正在尝试创建一个条形图,每个条目具有三个不同的条形图,有多少人参加了测试,有多少次失败,还有多少次通过了,每次测试都一起进行。我的代码如下所示:创建包含数据组的条形图

for (i = 0; i < evolNumber; i++) { 
    if (chosenReports[i] == 1) { 
     reportAttemptSummary += '<td class="TableArea" style="width:20px" align="center" valign="bottom">' + 
     attemptTotal[i] + 
     '<div style="background:black;width:20px;height:' + 
     (attemptTotal[i] * 4) + 
     'px"> </div>'+ 
     '</td>' + 
     '<td class="TableArea" style="width:20px" align="center" valign="bottom">' +attemptPass[i]+ 
     '<div style="background:green;width:20px;height:' + 
     (attemptPass[i] * 4) + 
     'px"> </div>' + 
     '</td>' + 
     '<td class="TableArea" style="width:20px" align="center" valign="bottom">' + 
     attemptFail[i] + 
     '<div style="background:red;width:20px;height:' + 
     (attemptFail[i] * 4) + 
     'px"> </div>' + 
     '</td>'; 
    } 
} 

我如何获得这三个栏有他们三个人都在一个单一标题:

+1

你看过['JFreeChart'](http://www.jfree.org/jfreechart/samples.html)吗? – trashgod 2011-05-17 17:49:54

回答

3

既然你似乎outputing一个HTML表格,然后它创建的问题一排排直接跟着酒吧排。所以,如果你的意思是有一个横跨3条则跨越了单一标题:

<tr> 
    <td colspan="3">Your single title here</td> 
    </tr> 

会做的伎俩,如果你与杆的行后输出。