Firefox 中的 raphaël 旋转()错误
我用 g.raphael 画了一个折线图。我用自己的值制作了自定义 x 轴。现在我希望这些值旋转 90 度,因此它们是垂直的而不是水平的。
为此,我使用 raphaelsrotate() 函数。这在 IE (8) 和 Opera 中都能完美运行。但在 Firefox 中什么也没有发生,Firebug 打印了这个错误,
Unexpected value rotate(90 NaN Infinity) parsing transform attribute.
我在其他地方找不到任何关于这个错误的信息,而且我看不出它是如何不正确的。更重要的是,我发现它在其他浏览器中工作非常奇怪。
有人对此有任何线索吗?
我的代码 - 其中 xcoor 是值 0-30 的简单 int 列表:
for (var i in xcoor) {
var dato = new Date();
dato.setDate(new Date().getDate() - i);
var xTxt = r.text(30 + (i * (725 / 30)), 315, dato.getDate() + '/' + (dato.getMonth() + 1)).rotate(90);
}
I've drawn a linechart with g.raphael. I've made a custom x-axis with my own values. And now I want these values to be rotated 90 degrees, so they're vertical instead of horizontal.
To do that, I'm using raphaels rotate() function. And this works perfectly in both IE (8) and Opera. But in Firefox nothing happens, and Firebug prints this error
Unexpected value rotate(90 NaN Infinity) parsing transform attribute.
I can't find anything about this error elsewhere, and I can't see how it isn't correct. And even more so, I find it extremely weird that it works in the other browsers.
Anybody have a clue about this?
My code - where xcoor is a simple int list of values 0-30:
for (var i in xcoor) {
var dato = new Date();
dato.setDate(new Date().getDate() - i);
var xTxt = r.text(30 + (i * (725 / 30)), 315, dato.getDate() + '/' + (dato.getMonth() + 1)).rotate(90);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,经过几个小时的谷歌搜索、阅读和更多的谷歌搜索,我终于找到了解决方案。
我仍然不明白为什么第一个不起作用。但尽管如此,我找到了一种适用于所有浏览器的方法:
旋转功能有更多不同的版本。其中之一是其中
Degrees 表示项目应旋转的度数,x,y 表示项目应旋转的点的坐标。
将 x,y 值设置为与将项目放在第一位的值相同可以得到想要的结果。
耶!
Well, after hours of googling, reading and more googling, I finally found a solution.
I still don't get why the first one doesn't work. But none the less I figured out a way that works in all the browsers:
The rotate-function comes in more different version. One of them is this
Where degrees represents the number of degrees the item should rotate and x, y represents the coordinates of the point around which the item should be rotated.
Setting the x,y values to the same as the ones placing the item in the first place gives me the wanted result.
Yay!