raphael-js

RaphaëlJS, painless coding, & Stinky Browsers (IE, mostly)

Need some advice about a best-approach for this problem: I've fallen madly in love with RaphaëlJS, as it has made SVG realizable for me and my coding since it has managed to bring IE into the fold. However, I don't like having to include a .js file for every SVG graphic I want to render on the page. So, I poked around on the internet ...

Zooming and panning svg images using raphael.js or some other js library

Hi there first off all thanks for looking , I am in need of a small script that will display an SVG (vector image) within a frame that has 2 functions; 1 - The image can be panned (moved around to look at different parts of the svg image with the cursor) simmilar to google maps. 2- The SVG image can be zoomed in and out on also simmil...

How can I stop elements overlapping using JavaScript and the Raphael JavaScript library

Hi there, I’m generating multiple, random sized, circular elements using the Raphael JavaScript library but because it’s random a lot of the circular elements being generate overlap or cover each other. What I wanted to know, is there any way with JavaScript to tell if one element is in already in particular position so to avoid the ove...

Performance of RaphaelJS with thousands of paths/rectangles

Hi, I really only care about Webkit, but in general, is Raphael JS expected to perform well when building thousands of rectangles? Additionally, I would need to be able to handle events on each of these rectangles (yipes). I've got a C++ solution which works but I'd rather use RaphaelJS. Thanks :) ...

SVG -- Replacement for Flash application

We are currently looking at developing flash based applications (using Flex) in a web application. We are now leaning towards to use SVG rapheljs for developing this components. The questions are: Is still SVG platform is widely adopted by browsers (without any plug-ins) are at least down the line of 8-10 months, any adoption is expect...

Raphael js drawing circles in all elements with specified class

Hi all, I've just discovered Raphael, and love it, but I am not much of a javascript-er. Right now I have three repeated sections of code to draw the same circle in three different divs. The default for making a canvas in Raphael finds an element by ID, but I want to have one set of variables to have circles drawn in all divs with clas...

Raphael js text positioning: centering text in a circle

Hey everyone, I am using Raphael js to draw circled numbers. The problem is that each number has a different width/height so using one set of coordinates to center the text isn't working. The text displays differently between IE, FF, and safari. Is there a dynamic way to find the height/width of the number and center it accordingly? He...

Attach text on path in Raphaël?

Does anyone know how to attach a text to a path in Raphaël? Something like http://www.w3.org/TR/SVG11/images/text/toap02.svg I know that jQuery SVG can do that, but I can't find an easy way to do this by using Raphaël js. I want to attacht this text to a bezier curve and move it. ...

Can RaphaelJS be object aware?

In the course of trying to figure out whether it's possible to contain text within the boundaries of a rectangle using RaphaelJS (and without doing what would seem to be a lot of work), I came across this question (and its answer) which intrigued me. I haven't seen--either before or since reading the answer--any indication that Raphael...

Detecting wether a point is inside or outside of a raphael.js shape

I have a raphael.js shape which I am plotting circle's on top of. I only want a circle to appear if the circle does not go off the boundary of the shape it is being plotted on to. To make this more clear, here is an example of what I do not want to happen: I want the circles outside of the grey area not to appear. How would I detect ...

Why does Raphael's framerate slow down on this code?

So I'm just doing a basic orbit simulator using Raphael JS, where I draw one circle as the "star" and another circle as the "planet". It seems to be working just fine, with the one snag that as the simulation continues, its framerate progressively slows down until the orbital motion no longer appears fluid. Here's the code (note: uses jQ...

Positioning SVG Elements

In the course of toying with SVG for the first time (using the Raphael library), I've run into a problem positioning dynamic elements on the canvas in such a way that they're completely contained within the canvas. What I'm trying to do is randomly position n words/short phrases. Since the text is variable, its position needs to be vari...

Raphael JS - Parsing an SVG on the fly

I found a neat SVG parser at http://bkp.ee/atirip/ which parses an SVG file and outputs it into javascript that uses the Raphael JS library (raphaeljs.com). You'll notice in the source code at http://bkp.ee/atirip/svg2rdemo.php : <script> jQuery(document).ready( function() { $("#c1").each(function(){ var c = Raphael(this, 19...

Antialiasing, web SVG and Raphaël.js

I'm using Raphaël.js to draw some small circles (2-4px radius), which is done through SVG on all browser except IE. The circles don't look smooth to me, so my question is: Is there some way to add antialiasing to Raphaël.js? Barring that, is there some way to antialias SVG objects? ...

How to use Date values in charts made with gRaphael?

A little premise: I'm on a diet and I'm trying to draw a chart of my weight loss. To do that, I'm using a little django app to store the weight readings, and gRaphael (http://g.raphaeljs.com/) charting library to draw the reports. You can see the wip here: http://www.totanus.net/weight/ At this time I'm printing dates in the X-axis usi...

Raphael JS and Java web app

I want to use the Raphael Javascript framework to create some charts based on dynamic data coming from my Java web application. Is the only way to access this data from my web application through the use of hidden fields on my page which I can then lookup inside the Rapahel JS code? ...

Gradient transparency of object in RaphaelJS

I'm trying to get a rectangle partly transparent where the left part is opaque while the right part is more transparent if you go into that direction. This works in Firefox, Chrome but not in Internet Explorer 7 or IE8. In IE all rectangles are displayed with the same transparent gradient. function drawTest(y, pct) { var recttest =...

SVG files in Raphael, can they be used?

I have an SVG file that I would like to display via Raphael (each svg file is a node in a tree I'm trying to draw, the actual connections of the tree will be made by raphael). I tried something like: var vector_image = paper.image("test.svg", 50,50,50,50); but no dice, seems only "real" image files like png or jpeg are accepted? I fi...

Coverting SVG Path from inkscape to Raphaeljs

In inkscape the coordinate system is bottom/top corner (meaning, 0,0 is left bottom corner). This is the same case with Adobe Illustrator. But, when I try to use this path string in raphael it use top/bottom (meaning, 0,0 is top/left corner) approach. How to convert this path string according to browser's coordinates or raphael's coordin...

Drag and dropping using Raphael js

Hi, I'm trying to build a puzzle game in javascript, using raphael to take care of the drag and drop and rotation of the pieces. The problem I'm facing is: Whenever I rotate an image, its coordinate system is rotated as well and the drag and drop doesn't work anymore as expected. Edit2: Here is a simple test case. Drag around the elli...