Safari/Opera 中 Canvas 渲染出现问题

发布于 2024-09-04 15:44:50 字数 319 浏览 1 评论 0原文

一段时间以来我一直在努力解决这个问题,并认为我应该向专家寻求一些建议。

我制作了一个 jQuery 片段,它从表中获取值并将它们绘制在画布元素上的折线图中(也由 JS 生成)。 Firefox 和 Chrome 中一切正常,但 Safari 和 Opera 不显示绘制点。我已经检查了 Firebug、Web Inspector 调试器、JSLint,并使用 w3 验证器检查了标记,但仍然找不到任何明显明显的东西。我还尝试过在 HTML 中包含 canvas 元素,而不是动态生成它,以及用标签对替换我一直在使用的自关闭标签,但都无济于事。

你们中有谁可以帮助我吗?

谢谢!

Been banging my head against this one for a while, and figured I'd turn to the experts for some advice.

I've made a jQuery snippet that grabs the values from a table and plots them in a line graph on a canvas element (also generated by the JS). All's well in Firefox and Chrome, but Safari and Opera aren't displaying the plotted points. I've reviewed in Firebug, Web Inspector debugger, JSLint, and checked the markup with the w3 validator, but still can't find anything glaringly obvious. I've also tried including the canvas element in the HTML rather than generating it dynamically, as well as substituting a tag pair for the self-closing tag I've been using—all to no avail.

Any chance one of you guys could help me out?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

美羊羊 2024-09-11 15:44:50

我在 Safari 中画了很多线,所以我检查了我的代码,模式是...

beginPath
移至
行至
closePath 或中风

在您的代码中,moveTo 在 beginPath 之前,所以我在我的一个应用程序中切换了它,它停止了绘制,所以尝试切换它们。

I draw lots of lines in Safari so I checked my code and the pattern is...

beginPath
moveTo
lineTo(s)
closePath or stroke

In your code moveTo is before beginPath, so I switched that in one of my apps and it stopped drawing, so try switching those around.

謌踐踏愛綪 2024-09-11 15:44:50

我认为这是你调用中风()时的问题。尝试仅在 for 循环之后调用它,并尝试 closePath 调用的不同位置。

I think this is a problem of the time when you call stroke(). Try to call it only after the for loop, and try differents positions of the closePath call.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文