raphael

raphael.js - converting pie graph to donut graph

删除回忆录丶 提交于 2019-11-30 04:07:05
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(-endAngle * rad); return paper.path(["M", cx, cy, "L", x1, y1, "A", r, r, 0, +(endAngle - startAngle > 180), 0

Why won't my Raphael JS animation loop?

醉酒当歌 提交于 2019-11-30 03:32:37
问题 Hi there I've made this animation using the Raphael framework. I want the star (logoStar) to spin indefinitely but it only runs once. Can anyone help? Thanks window.onload = function () { buildLogo(); } var buildLogo = function () { var logo = Raphael("title",800,236); var logoStar = logo.path("M12.245 131.057L16.039 138.743L24.521 139.974L18.383 145.958L19.832 154.406L12.245 150.418L4.658 154.406L6.108 145.958L-0.03 139.974L8.452 138.743").attr({fill:"#fff",stroke:"none"}); var starSpin =

how to change svg text tag using javascript innerHTML

徘徊边缘 提交于 2019-11-30 01:07:32
问题 i was using raphaeljs , and i want to show html(not only text) in svg, so i use this code : var r = Raphael("holder", 200, 300); var t = r.text(10, 10, "ssdwqdwq"); t.node.innerHTML='dddd' but i cant change the svg's content , so i console it in firebug , console.log(t.node) it show this : <text x="10" y="13.5" text-anchor="middle" style="font: 10px "Arial";" font="10px "Arial"" stroke="none" fill="#000000"> so how to change the text using javscript on svg thanks 回答1: SVG nodes don't have a

how to call raphael methods on jquery objects?

て烟熏妆下的殇ゞ 提交于 2019-11-30 00:14:54
问题 I'm creating some circles using Raphael. When a user clicks a button, I want to animate these circles (by growing their radius). How do I do this? For example, here's my example code: <!DOCTYPE html> <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="raphael.js"></script> <script type="text/javascript"> $(function() { var paper = new Raphael("canvas_container", 300, 150); paper.circle(50, 75, 30); paper.circle(150, 75, 30); $("button")

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

大憨熊 提交于 2019-11-29 23:29:12
问题 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 jQuery only to initialize the page): $(function() { var paper = Raphael(document.getElementById('canvas'), 640, 480); var star = paper.circle(320, 240, 10); var

Using jQuery with Raphael

雨燕双飞 提交于 2019-11-29 22:06:14
问题 I have created an image map with Raphael. I want the div containing the Raphael canvas to fade out using jQuery when one of the paths in the image map (path10 in the example below) is clicked. The code below does not work, but am I on the right track? <script type="text/javascript" charset="utf-8"> window.onload = function () { var R = Raphael("canvas", 1050, 550); var attr = { fill: "#bbb", "fill-opacity": 1, stroke: "#222", "stroke-width": 0.3, "stroke-linejoin": "round" }; path10 = R.path(

Raphael JS and Text positioning?

痞子三分冷 提交于 2019-11-29 20:35:47
I'm trying to position text within the SVG canvas, by supplying x, y coordinates var t = paper.text(50, 50, "Raphaël\nkicks\nbutt!"); but does not position the text like all other objects... x, y coordinates specify the center of the object! Not the "left and top most" pixel! I would like to "left align" the text along a line, same as standard HTML. Help would be very much appreciated. Text-anchor property for text method is set to 'middle' by default. If you want to left align it then change text-anchor in attributes for the object: var t = paper.text(50, 50, "Raphaël\nkicks\nbutt!").attr({

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

限于喜欢 提交于 2019-11-29 20:28:05
I am in need of a small script that will display an SVG (vector image) within a frame that has 2 functions; The image can be panned (moved around to look at different parts of the svg image with the cursor) simmilar to google maps. The SVG image can be zoomed in and out on also simmilar to google maps except there will be no need to load new imagery as the image is a vector. For a simmilar script i have seen that works with normal image formats see http://jibbering.com/routeplanner/ If someone is still interested: I just found this implementation of Pan and Zoom for Raphael. Still a very young

Combining Raphael and jQuery to achieve browser compatibility

白昼怎懂夜的黑 提交于 2019-11-29 18:07:21
问题 Having discovered that IE does not handle javascript onmouseout , I'm determined to use jQuery instead so the cross-browser compatibility would be taken care of automatically. I am making an area defined by an svg path light up when the mouse hovers over it, and I adapted the code provided on the Raphael website from the Australia example. In this code, each state of Australia is defined by a Raphael path, for example Tasmania: aus.tas = R.path("...").attr(attr); This path ('st') is then

Raphaeljs: Copy element or set to another paper

半腔热情 提交于 2019-11-29 17:07:38
Is there a possibility of adding an element or set that exists within a paper to another paper, without creating each element twice from scratch? Background for this: I visualize a large node graph and want to create an "overview map" in a separate paper. Raphael don't allow to move element from one paper to another directly. So it is better to create a new element with same property in the target paper. I have created following sample method. you can add the code in your page and use cloneToPaper function to clone a element or a set to another paper. function extractJSON(element) { var attr =