Create svg with 100% width height

A discussion forum for JFreeSVG (a fast, lightweight, SVG generator for the Java platform).

Create svg with 100% width height

Postby min9ox2 » Tue Oct 18, 2016 4:09 am

Is there anyway I can pass width height as percentage when creating SVGGraphics2D? I couldn't find percentage in SVGUnits neither.
Or is there anyway to change width & height later after elements are placed? I'm getting the elements from the database and it would be great if I could define width & height after finding out left most & right most coordinates of my elements.
min9ox2
 
Posts: 1
Joined: Fri Oct 14, 2016 8:21 am

Re: Create svg with 100% width height

Postby david.gilbert » Mon Oct 24, 2016 10:03 pm

Do you just want to scale your image in a web page? Maybe the following post is helpful:

https://css-tricks.com/scale-svg/

I have to admit I didn't realise that % is a valid unit in the SVG width and height attributes so I need to spend a little more time looking at this. For sure you can't specify percentage using the current version of SVG, but maybe the viewBox attribute will do what you need.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11647
Joined: Fri Mar 14, 2003 10:29 am


Return to JFreeSVG

Who is online

Users browsing this forum: No registered users and 1 guest