raphael

Is Protovis supposed to work on IE 7, 8, and 9 like RaphaelJS does?

眉间皱痕 提交于 2019-12-31 03:19:07
问题 I thought Protovis might work on IE 7 and 8, or at least on IE 9... but to my surprise, I tried it on all 3 and it doesn't work on any (for those example pages... is it a temporary JS bug?)... is it supposed to work on IE at all, like Raphael does? (even on IE 6, amazing...) I can't find any list of supported browsers on the Protovis website. 回答1: Protovis requires SVG and IE 6 - 8 do not support SVG. IE 9 does support SVG, so Protovis should work fine on IE 9. In order to work on IE 6-8 it

Snap.svg determine drag distance along a path

血红的双手。 提交于 2019-12-31 00:34:07
问题 As referenced here and updated for use with Snap.svg here, I'd like to better understand how the provided gradSearch function actually works (it's a bit over my head), and whether there are any good alternatives to this approach? gradSearch = function (l0, pt) { l0 = l0 + totLen; var l1 = l0, dist0 = dist(path.getPointAtLength(l0 % totLen), pt), dist1, searchDir; if (dist(path.getPointAtLength((l0 - searchDl) % totLen), pt) > dist(path.getPointAtLength((l0 + searchDl) % totLen), pt)) {

Triggering Raphael events externally

被刻印的时光 ゝ 提交于 2019-12-30 09:47:08
问题 My app is using Raphaël to drop a collection of objects onto a page, each with a click handler bound that uses data attached to the object when it was loaded in via JSON. That’s all working fine. I now am trying to add in some test coverage using Cucumber (yes, I know I should have built the tests in first, I will do next time). I need to trigger a click on the first object to test that that object’s associated page loads. I’ve tried finding the appropriate SVG path for that object and

Rendering SVG polygons in Raphael Javascript library

╄→尐↘猪︶ㄣ 提交于 2019-12-30 03:16:10
问题 As far as I know, there is currently no way to display SVG polygons in the Raphael Javascript library. I'm building an application that needs to read in SVGs and them display them in Raphael, however, many of these SVGs use polygons. For example, I'm reading in an SVG with a polygon in this format: <polygon points="260.5,627.75 259.563,628.313 258.625,628.563 258.25... So, I'm wondering...is there a way to convert the polygon points into a path which I could draw in Raphael? I've seen a few

raphael.js - converting pie graph to donut graph

微笑、不失礼 提交于 2019-12-30 00:41:06
问题 I'm trying to use a raphael.js example located here: http://raphaeljs.com/pie.html but I want to convert the pie graph into a donut graph (have a hole in the middle of all the slices). Currently, each slice is being created with the following code: function sector(cx, cy, r, startAngle, endAngle, params) { //console.log(params.fill); var x1 = cx + r * Math.cos(-startAngle * rad), x2 = cx + r * Math.cos(-endAngle * rad), y1 = cy + r * Math.sin(-startAngle * rad), y2 = cy + r * Math.sin(

How do I rotate or scale (transform) an SVG path relative to its center point?

五迷三道 提交于 2019-12-29 08:50:50
问题 I'm trying to rotate and scale shapes within an SVG around their center point. I've looked into several libraries, including Jquery, Greensock, D3, RaphaelJS, but I haven't been able to find any that provide a straightforward way to accomplish this. Each animates the shape from the origin point (which I understand is the default). I want to be able to spin a shape around its center point or scale it up or down from the center point. Here are a couple examples using Greensock and D3 that

Programmatically creating an SVG image element with javascript

半世苍凉 提交于 2019-12-28 09:39:15
问题 Like my title says, I'm trying to programmatically creating an SVG image element in a HTML page using javascript. For some reason my basic javascript code isn't working, however if I use the raphaeljs library it works fine. So there's obviously a problem with my js - I just can't seem to figure out what it is. (note: the target browser is FF4+) Here is the basic page with an html version of what I'm trying to achieve up the top: <html> <head> <script type="text/javascript" src="http:/

how to replace text inside an svg using js?

懵懂的女人 提交于 2019-12-25 18:26:57
问题 in this code I am trying to load an svg file into snap paper and then convert it to a group by : replacing <svg with <g and </svg> with </g> ? how can I fix this to work please? var s1 = Snap('#svg1'); Snap.load( "https://dl.dropboxusercontent.com/u/140225334/bicycle.svg", function( frag ) { var maing = s1.g(); maing.append(frag); maing.attr({id: 'maing' }); // city_name=city_name.replace(/ /gi,'_'); var maing = maing.replace("<svg", "<maing").replace("</svg>", "</maing>"); // how this can be

Finding the coordinates of a rotated image in Raphael

我是研究僧i 提交于 2019-12-25 18:15:23
问题 I have a page with a rectangular image. The user can rotate the image to any angle and move it to any position on the paper. Without the rotation I can just use the getBBox() method to find the corners but with rotation it doesn't work. How can I find the corners of a rotated image in Raphael? 回答1: You can use the x and y functions on the Matrix object to find the image corner coordinates after transformation. http://raphaeljs.com/reference.html#Matrix.x All 4 corners of image: var paper =

animateAlong function is not defined in Raphael javascript?

ⅰ亾dé卋堺 提交于 2019-12-25 09:48:29
问题 im trying out raphael js examples from http://www.irunmywebsite.com/raphael/additionalhelp.php#pagetop. i took the example of animateAlong and tried, but im getting an error of animateAlong function is not defined. Also made sure that my code is inside window.onload . My Raphaël version 2.0.1 Thanks 回答1: It's been removed from Raphael2. See this link for a possible solution. (Haven't checked it out myself, so your mileage may vary...) 来源: https://stackoverflow.com/questions/8295371