可以让标签在 raphael.js 条形图上工作
当我尝试获取拉斐尔图表标签时,我收到此错误:
bars[i * (multi || 1) + j] is undefined http://localhost:8080/en/plugins/SocialConversationPlugin/js/g.bar-min.js Line 149
行:
L = paper.g.text(bars[i * (multi || 1) + j].x, isBottom ? y + height - barvgutter / 2 : bars[i * (multi || 1) + j].y - 10, label).insertBefore(covers[i * (multi || 1) + j]);
我的代码:
$$("#activityTab td.month").each(function (s) {
labels.push(s.innerHTML);
});
var r = Raphael("holder",1000,260),
data2 = [ligne1, ligne2, ligne3],
fin = function () {
this.flag = r.g.popup(this.bar.x, this.bar.y, this.bar.value || "0").insertBefore(this);
},
fout = function () {
this.flag.animate({opacity: 0}, 300, function () {this.remove();});
};
r.g.txtattr.font = "12px 'Fontin Sans', Fontin-Sans, sans-serif";
r.g.text(562, 250, "Multiple Series Stacked Chart");
r.g.barchart(150, 10, 700, 220, data2, {stacked:false, type: "soft"})
.hover(fin, fout)
.label(labels);
图表已绘制,但我只是获取绘制到图表的第一个标签的第一个字母。
When i'm trying to get my raphael chart labels, I get this error :
bars[i * (multi || 1) + j] is undefined http://localhost:8080/en/plugins/SocialConversationPlugin/js/g.bar-min.js Line 149
the line :
L = paper.g.text(bars[i * (multi || 1) + j].x, isBottom ? y + height - barvgutter / 2 : bars[i * (multi || 1) + j].y - 10, label).insertBefore(covers[i * (multi || 1) + j]);
My code :
$("#activityTab td.month").each(function (s) {
labels.push(s.innerHTML);
});
var r = Raphael("holder",1000,260),
data2 = [ligne1, ligne2, ligne3],
fin = function () {
this.flag = r.g.popup(this.bar.x, this.bar.y, this.bar.value || "0").insertBefore(this);
},
fout = function () {
this.flag.animate({opacity: 0}, 300, function () {this.remove();});
};
r.g.txtattr.font = "12px 'Fontin Sans', Fontin-Sans, sans-serif";
r.g.text(562, 250, "Multiple Series Stacked Chart");
r.g.barchart(150, 10, 700, 220, data2, {stacked:false, type: "soft"})
.hover(fin, fout)
.label(labels);
The chart is drawn but I'm just getting the first letter of the first label drawn to my chart.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为这个问题。
可以通过使用此 github 存储库 中的 g.bar.js 文件来解决。
It is because of this issue.
Can be solved by using the g.bar.js file from this github repository.