svg

svg: center of path

Hi I'm trying to draw a label on a polygon of an svg file. The problem I'm facing is to find out roughly the center of this polygon to place the label, as the path's coordinates are in svg format and need to be parsed. Is there an easier way to determine the center of an svg polygon (maybe someone can point out a javascript library or a...

Which would you prefer? SVG, HTML5 or regen'd-PNG for graphs & charts?

I'm developing a new site that graphs some operational metrics. As such about a dozen charts/graphs will be displayed on the site. I want to be able to have them dynamically scale down (within reason) based upon the size of the browser. I'm debating the pros/cons of generating these as one of these options: SVG. Great for scaling b...

How to transform a path in svg so that it is parallel to its original location?

Hi, I have a path defined in SVG. I would like to make two copies of the path and translate them so that one sits parallel to the original on one side, and the other sits parallel on the other side. The idea is to end up with 3 paths, all parallel to each other and not overlapping. I have tried simple translations such as transform="tr...

Using SVG, is it possible to add text to the centre of path and align horizontally?

Hi, as the question states, I want to add text to the centre of a path and align it horizontally, NOT align along the path. I have the following text running along the path at the centre, but I want to flip it so that it is horizontal, no matter what angle the path is heading. <text text-anchor="middle"> <textPath xlink:href="#Some...

Javascript Event Handlers supported on SVG by Firefox 3.5

Hi Guys, I have been wracking my brains for the whole day on this one. It appears that the SVG DOM manipulations supported by Firefox 3.5 are very limited. A few properties like this.style.cursor can be successfully manipulated with an onmouseover handler but interesting properties like this.style.fill or this.style.stroke cannot be! D...

PDF Generation with High Resultion SVG Images (suggestions needed!)

Hi Folks Can anyone suggest/recommend a product that can be used to dynamically produce PDFs that can contain high-res images? We're currently using a product called Highwire from a company called Corda to produce PDFs of our HTML pages. Highwire is crap at producing PDFs though becuase it does not conform to HTML standards (i.e. it r...

Mangling IDs and References to IDs in XML

I'm trying to compose xml elements into each other, and the problem I am having is when there's the same IDs. Basically what I need to do is mangle all the IDs in an xml file, as well as the references to them. (I'm doing this with SVGs to add a little context) Say I have: <bar id="foo"/> <baz ref="url(#foo)"/> <bar id="abc"/> <baz re...

SVG, text , font with fixed width/height

Hi all, I'm trying to get a SVG 'text' element fitting inside of a svg 'rect' element. e.g. In the example below, I used a monospace text of 5 chars with a font-size of 100px and I expected to have a bounding rectangle close to the text. But there is a blank gap at the right of the text. <svg xmlns="http://www.w3.org/2000/svg" height=...

Any differences between the way Bézier curves are interpreted by Cocoa and SVG?

I'm definetely new to any kind of graphics (maybe except taking photos :)) so please forgive if my explanation of problem I faced last night is not very precise and understable. I'm trying to generate code in Cocoa which would draw vectors on the base of SVG files. I've translated SVG commands into calls of NSBezierPath methods but rece...

Sending data to a script in a container page from a script running in an embedded page

Hi Guys, I have run into an interesting problem and am not sure if it can be resolved. I have a JS script (say script1) running in an SVG document with lots of rectangles which has collected user-entered information like which rectangle was clicked / data corresponding to the rectangle etc. This SVG document is embedded inside an HTML...

How to get handle to entries within SVG <g> group?

Within a document, I can use document.getElementById() to get a handle to a particular unique element. How can I do the same for a group, given as a parameter. <g id="right_hook"> <circle id="wheeltap" r="3" stroke-width="1" /> <path d="M 0 0 L 200 0 A 5,5 0 0,1 200,20" stroke-width="4" /> </g> If I pass this group to a functio...

Mono / Lighttpd - Garbage text added to SVG file returned via Response.Write()

I am developing a web application that manages a population of plants. One feature of the application is the ability to view relationships between plants as a graph. This visualisation is generated as a dot file, then turned into SVG using GraphViz. The resulting SVG markup is then rendered to the browser via an .aspx file, using the Res...

Ruby Support for SVG

Is there some library or helper to produce SVG graphics with Ruby? I googled a bit and found many, but all seem to be dusty and very incomplete… Does anyone know about some nice, reliable alternative? ...

Extracting path data from an SVG map to use in RaphaelJs

I'm trying to build an an interactive map using RaphaelJS (e.g. http://raphaeljs.com/australia.html). Please check the source. It requires map path data to input. There is no clear explanation anywhere about how to obtain this information, other than the fact that illustrator or inkscape are capable of doing it. I'm looking to obtain "S...

How do you convert an SVG image "paths" into separate PNG images?

Hi there, I've got an SVG image with 67 separate paths. Are there any libraries/tutorials out there that will create a separate raster image such as a PNG for each of those paths, and perhaps name them according to the path id? ...

How to load an external JavaScript script to (pure) SVG document?

I have fairly large script within an .svg file and I'd like to get it out of the CDATA section into an external file. How to achieve this? The HTML regular does not work: <script type="text/javascript" src="Track_animation.js" /> The documentation I have been able to find only concerns with JS embedded within the SVG itself. Is use o...

Default SVG style

What is the default SVG style ? for example, what is the default font of a new SVG document ? Is it described in the SVG spec ? <svg><text x="10" y="10">Hello</text></svg> Thanks ...

Render SVG stored in memory using JSR-226 (Blackberry)

I have code that generates a data-driven SVG graph and I'd like to display the graph directly. The method: javax.microedition.m2g.ScalableImage.createImage can take either a URI or an InputStream as the source data for the graph, what would be a good way to pass my graph data in? It's in String form in memory, so from what I can see ...

SVG Elliptical Arcs with Java

I recently wrote a java program transforming a SVG document to HTML/Canvas: It was easy to translate a path such as d="M 0 0 L 100 100 z" to something like GeneralPath L= new GeneralPath(); L.moveTo(0,0); L.lineTo(100,100); L.closePath(); However I don't know how to translate the Elliptical Arc command to Java/GeneralPath. For exa...

Text alignment in SVG

How to make text with proportional font but an equal number of characters per line fully justified in SVG text box? Preferably with an svg-code example if it's possible. ...