A couple days ago a coworker and I were working on JGraphX and Apache Batik to generate SVG graph for a defined workflow in our application.
During the implementation we came across a issue that our framework need width, height and viewbox parameters to show SVG file in browser.
Default Batik SVG generator is not adding these three attributes into the root element, I did Google to search a solution for this not unable to find complete solution.
I got couple of ideas to make it work. As a result I thought of writing this as a blog so this solution can be used by others as well.
Generate SVG Graph Image
Make sure that root element attribute value addition is done at the end, because it creates a root element if this is not available or skips other graph components during writing.