[英]Raphael multiple charts on same page
I am creating a webpage using at least two Raphael charts. 我正在使用至少两个拉斐尔图表创建网页。
Any help would be greatly appreciated. 任何帮助将不胜感激。 I hope I have explained the problem appropriately.
我希望我已经适当地解释了这个问题。
<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>
The problem is in the g.pie.js file 问题出在g.pie.js文件中
You are doing this: 您正在执行此操作:
$("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());
});
What you "should" be doing is: 您“应该”要做的是:
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());
});
Hope this helps. 希望这可以帮助。 you were shoving an incorrect dataset into the pie chart.
您将错误的数据集推到了饼图中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.