[英]Raphael multiple charts on same page
我正在使用至少两个拉斐尔图表创建网页。
任何帮助将不胜感激。 我希望我已经适当地解释了这个问题。
<th scope="row">Perl</th>
<td>3%</td>
</tr>
<tr>
<th scope="row">C++</th>
<td>2%</td>
</tr>
<tr>
<th scope="row">Java</th>
<td>2%</td>
</tr>
<tr>
<th scope="row">Objective-C</th>
<td>2%</td>
</tr>
</tbody>
</table>
</div>
问题出在g.pie.js文件中
您正在执行此操作:
$("tr").each(function () {
// this loops throught all TR tags in the document, which contains two tables...
values.push(parseInt($("td", this).text(), 10));
labels.push($("th", this).text());
});
您“应该”要做的是:
var table = $("#holder");
// only select the tr rows that are inside your "holder" div
$("tr", table).each(function () {
values.push(parseInt($("td", this).text(), 10));
labels.push($("th", this).text());
});
希望这可以帮助。 您将错误的数据集推到了饼图中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.