开发者

Trouble with Canvas rendering in Safari/Opera

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!


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜