Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Raphael: add text to each path

I am using Raphael for working with SVG. And, I want to add text into each path. How can I do this? This is my code on jsfiddle.
Thanks

like image 205
user1260827 Avatar asked Sep 04 '26 10:09

user1260827


1 Answers

When you say add text into each path, do you mean something as simple as placing a label centered over that particular path, like this?

http://jsfiddle.net/kevindivdbyzero/NFAAL/2/

If so, it should be really easy to bind labels as data to each path element, iterate through all the paths on the paper after you've created them, and generate labels programmatically in a single batch. It would even be feasible to structure the label generation to avoid collisions with a little bit of work.

If that's not what you were thinking of, you might want to add a little more detail to your question.

like image 108
Kevin Nielsen Avatar answered Sep 06 '26 01:09

Kevin Nielsen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!