Hi all;
How can I set the width & height in inches? And how can I set the viewBox?
I want the <svg> element to have: width="2in" height="4in" viewBox="0 0 1828800 1828800"
The reason I need this is I know the size of my SVG object. And I am passing all units for all renders in EMUs (914400/inch). So I can create the SVG canvas size in EMUs, write all objects using EMUs. Then setting the viewBox makes that all map correctly. Setting the size in inches then takes that to the size of the final object I want.
thanks - dave
How do I set the width, height, & viewBox
-
- Posts: 106
- Joined: Fri May 27, 2005 7:44 pm
- Location: Boulder, CO
- Contact:
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: How do I set the width, height, & viewBox
The viewBox feature is missing, it has been raised by another user also:
https://github.com/jfree/jfreesvg/pull/4
I'll get this feature into the next release most likely.
https://github.com/jfree/jfreesvg/pull/4
I'll get this feature into the next release most likely.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- Posts: 106
- Joined: Fri May 27, 2005 7:44 pm
- Location: Boulder, CO
- Contact:
Re: How do I set the width, height, & viewBox
Please consider adding the ability to set the width/height in units too.david.gilbert wrote:I'll get this feature into the next release most likely.
thanks - dave
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: How do I set the width, height, & viewBox
I'll research that. I guess that if the units are specified then that will also need to be synchronised with a translation on the Graphics2D instance so that the drawing units are consistent. Or how do you see that working?
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- Posts: 106
- Joined: Fri May 27, 2005 7:44 pm
- Location: Boulder, CO
- Contact:
Re: How do I set the width, height, & viewBox
No, I just need to set it at the end. I render the entire SVG using EMUs for all coordinates and telling it the size in EMUs. But think of the entire rendering as occurring in arbitrary units.david.gilbert wrote:I'll research that. I guess that if the units are specified then that will also need to be synchronised with a translation on the Graphics2D instance so that the drawing units are consistent. Or how do you see that working?
Then when I'm done I use the viewBox to give the size of those arbitrary units and set the width/height to physical inches so it knows the viewBox -> physical scaling.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: How do I set the width, height, & viewBox
Hi David,
I just pushed some changes to GitHub that I hope will meet your requirements. Please take a look and let me know...if all is good I'll release version 3.2.
I just pushed some changes to GitHub that I hope will meet your requirements. Please take a look and let me know...if all is good I'll release version 3.2.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: How do I set the width, height, & viewBox
The viewBox feature is missing, it has been raised by another user also
Graduated from Soran University with First Class Degree with Honours in Computer Science