SVG Generator - How to get the stream directly (w/out going

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Tom Mazzotta

SVG Generator - How to get the stream directly (w/out going

Post by Tom Mazzotta » Thu Jan 30, 2003 1:54 am

I'm using the example outlined in the documentation on how to convert a JFreeChart into an SVG file. This is all working fine (excellent documentation!).

What I'd like to do is a slight variation on this... Instead of writing the SVG stream to a file, I'd like to simply return it as a a Java String (to be used directly). This string will then be added to a bigger XML document /etc. I know I can have the stream written to a file and then read this file back in, but I'd like to avoid this if possible..


//This works, but it writes the stream to a file
boolean useCSS = true; //we want to use CSS style attribute
Writer out = new OutputStreamWriter(new FileOutputStream(new File("NewFile.svg")),"UTF-8");
svgGenerator.stream(out,useCSS);


//This doesn't work right - all the text that is found in "NewFile.svg" is not in s
StringWriter strOut = new StringWriter();
svgGenerator.stream(strOut,useCSS);
String s = strOut.toString(); // this doesn't return all the text in the stream


Net Question: How can I get an SVG text stream from a JFreeChart withOUT going thru a file?

Thanks in advance!

David Gilbert

Re: SVG Generator - How to get the stream directly (w/out go

Post by David Gilbert » Thu Jan 30, 2003 9:35 pm

At a glance, I would expect that to have worked. If I get a chance I'll try it out, but time is limited at present...

Regards,

Dave Gilbert

garth braithwaite

Re: SVG Generator - How to get the stream directly (w/out go

Post by garth braithwaite » Fri Jan 31, 2003 7:31 am

Tom, here's the code that works for me:

DOMImplementation domImp = GenericDOMImplementation.getDOMImplementation();
Document document = domImp.createDocument(null, "svg", null);
SVGGraphics2D svgGraphicsEnvironment = new SVGGraphics2D(document);
chart.draw(svgGraphicsEnvironment, new Rectangle2D.Double(0,0,400,300), null);

java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream( 8192 );
java.io.Writer svgOutput = new java.io.OutputStreamWriter( baos, "UTF-8" );
svgGraphicsEnvironment.stream( svgOutput, true );
String myString = baos.toString();

Hope that helps...

Tom Mazzotta

Re: SVG Generator - How to get the stream directly (w/out go

Post by Tom Mazzotta » Fri Jan 31, 2003 7:25 pm

Garthe - thanks... I'm still not getting the two to match though...

Below is what I get from doing it the 2 different ways... What I'm seeing is the 2 match up until the part that has 'id="genericDefs"' ... the direct stream just finishes there.. yet the file has a whole bunch of stuff in it (that actually has the information on how to render the graph - important stuff I presume :).

any thoughts?
----------------------
1. with the direct stream, myString has:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 'http://www.w3.org/TR/2001/REC-SVG-20010 ... /svg10.dtd'>
<svg xmlns:xlink="http://www.w3.org/1999/xlink" style="fill-opacity:1; color-interpolation:auto; color-rendering:auto; text-rendering:auto; stroke:black; stroke-linecap:square; stroke-miterlimit:10; stroke-opacity:1; shape-rendering:auto; fill:black; stroke-dasharray:none; font-weight:normal; stroke-width:1; font-family:&apos;Arial&apos;; font-style:normal; stroke-linejoin:miter; font-size:12; image-rendering:auto; stroke-dashoffset:0;" xmlns="http://www.w3.org/2000/svg">
<!--Generated by the Batik Graphics2D SVG Generator--> <defs id="genericDefs" /> <g /> </svg>

2. when I tell to write it directly to an SVG file, I see in the SVG File:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 'http://www.w3.org/TR/2001/REC-SVG-20010 ... /svg10.dtd'>
<svg xmlns:xlink="http://www.w3.org/1999/xlink" style="fill-opacity:1; color-interpolation:auto; color-rendering:auto; text-rendering:auto; stroke:black; stroke-linecap:square; stroke-miterlimit:10; stroke-opacity:1; shape-rendering:auto; fill:black; stroke-dasharray:none; font-weight:normal; stroke-width:1; font-family:&apos;Arial&apos;; font-style:normal; stroke-linejoin:miter; font-size:12; image-rendering:auto; stroke-dashoffset:0;" xmlns="http://www.w3.org/2000/svg">
<!--Generated by the Batik Graphics2D SVG Generator-->
<defs id="genericDefs" />
<g>
<defs id="defs1">
<clipPath clipPathUnits="userSpaceOnUse" id="clipPath1">
<path d="M0 0 L400 0 L400 300 L0 300 L0 0 Z" />
</clipPath>
<clipPath clipPathUnits="userSpaceOnUse" id="clipPath2">
<path d="M-10.4736328125 -263.84375 L389.5263671875 -263.84375 L389.5263671875 36.15625 L-10.4736328125 36.15625 L-10.4736328125 -263.84375 Z" />
</clipPath>
<clipPath clipPathUnits="userSpaceOnUse" id="clipPath3">
<path d="M306.20123291015625 165.2987518310547 L306.20123291015625 565.2987670898438 L6.2012481689453125 565.2987670898438 L6.2012481689453125 165.2987518310547 L306.20123291015625 165.2987518310547 Z" />
</clipPath>
<clipPath clipPathUnits="userSpaceOnUse" id="clipPath4">
<path d="M380.07574462890625 91.42427062988281 L380.07574462890625 491.42425537109375 L80.07572937011719 491.42425537109375 L80.07572937011719 91.42427062988281 L380.07574462890625 91.42427062988281 Z" />
</clipPath>
<clipPath clipPathUnits="userSpaceOnUse" id="clipPath5">
<path d="M453.9501953125 17.5498046875 L453.9501953125 417.5498046875 L153.9501953125 417.5498046875 L153.9501953125 17.5498046875 L453.9501953125 17.5498046875 Z" />
</clipPath>
<clipPath clipPathUnits="userSpaceOnUse" id="clipPath6">
<path d="M512.81494140625 -71.33444213867188 L512.81494140625 328.6655578613281 L212.81491088867188 328.6655578613281 L212.81491088867188 -71.33444213867188 L512.81494140625 -71.33444213867188 Z" />
</clipPath>
<clipPath clipPathUnits="userSpaceOnUse" id="clipPath7">
<path d="M586.6893310546875 -145.20889282226562 L586.6893310546875 254.79110717773438 L286.6893615722656 254.79110717773438 L286.6893615722656 -145.20889282226562 L586.6893310546875 -145.20889282226562 Z" />
</clipPath>
<clipPath clipPathUnits="userSpaceOnUse" id="clipPath8">
<path d="M151.70449829101562 111.51699829101562 L151.70449829101562 511.5169982910156 L-148.29550170898438 511.5169982910156 L-148.29550170898438 111.51699829101562 L151.70449829101562 111.51699829101562 Z" />
</clipPath>
<clipPath clipPathUnits="userSpaceOnUse" id="clipPath9">
<path d="M38.216796875 34.82890701293945 L38.216796875 190.400390625 L390 190.400390625 L390 34.82890701293945 Z" />
</clipPath>
</defs>
<g style="fill:rgb(212,208,200); text-rendering:optimizeLegibility; shape-rendering:geometricPrecision; stroke:rgb(212,208,200);">
<rect x="0" y="0" width="400" style="clip-path:url(#clipPath1); stroke:none;" height="300" />
</g>
<g style="text-rendering:optimizeLegibility; font-size:18; shape-rendering:geometricPrecision; font-weight:bold; font-family:sans-serif;">
<text x="14.37060546875" y="24.888866424560547" style="clip-path:url(#clipPath1); stroke:none;" xml:space="preserve">All Items from Profit and Loss Statement</text>
</g>
<g transform="translate(10.4736328125,263.84375)" style="font-size:10; fill:white; text-rendering:optimizeLegibility; font-family:sans-serif; shape-rendering:geometricPrecision; stroke:white;">
<rect x="0" y="0" width="379.052734375" style="clip-path:url(#clipPath2); stroke:none;" height="33.15625" />
<rect x="0" y="0" width="379.052734375" style="clip-path:url(#clipPath2); fill:none; stroke:gray;" height="33.15625" />
<rect x="3.88671875" y="3.88671875" width="8.8046875" style="clip-path:url(#clipPath2); fill:black; stroke:none;" height="8.8046875" />
<rect x="3.88671875" y="3.88671875" width="8.8046875" style="clip-path:url(#clipPath2); fill:none; stroke:silver; stroke-width:0.5;" height="8.8046875" />
<text x="16.46484375" y="13.9404296875" style="clip-path:url(#clipPath2); fill:black; stroke:none; stroke-width:0.5;" xml:space="preserve">Revenue</text>
<rect x="65.40771484375" y="3.88671875" width="8.8046875" style="clip-path:url(#clipPath2); stroke:none; stroke-width:0.5;" height="8.8046875" />
<rect x="65.40771484375" y="3.88671875" width="8.8046875" style="clip-path:url(#clipPath2); fill:none; stroke:silver; stroke-width:0.5;" height="8.8046875" />
<text x="77.98583984375" y="13.9404296875" style="clip-path:url(#clipPath2); fill:black; stroke:none; stroke-width:0.5;" xml:space="preserve">Labor</text>
<rect x="112.4755859375" y="3.88671875" width="8.8046875" style="clip-path:url(#clipPath2); fill:rgb(64,64,64); stroke:none; stroke-width:0.5;" height="8.8046875" />
<rect x="112.4755859375" y="3.88671875" width="8.8046875" style="clip-path:url(#clipPath2); fill:none; stroke:silver; stroke-width:0.5;" height="8.8046875" />
<text x="125.0537109375" y="13.9404296875" style="clip-path:url(#clipPath2); fill:black; stroke:none; stroke-width:0.5;" xml:space="preserve">Overtime</text>
<rect x="174.52880859375" y="3.88671875" width="8.8046875" style="clip-path:url(#clipPath2); fill:silver; stroke:none; stroke-width:0.5;" height="8.8046875" />
<rect x="174.52880859375" y="3.88671875" width="8.8046875" style="clip-path:url(#clipPath2); fill:none; stroke:silver; stroke-width:0.5;" height="8.8046875" />
<text x="187.10693359375" y="13.9404296875" style="clip-path:url(#clipPath2); fill:black; stroke:none; stroke-width:0.5;" xml:space="preserve">Gross Margin</text>
<rect x="256.03515625" y="3.88671875" width="8.8046875" style="clip-path:url(#clipPath2); fill:fuchsia; stroke:none; stroke-width:0.5;" height="8.8046875" />
<rect x="256.03515625" y="3.88671875" width="8.8046875" style="clip-path:url(#clipPath2); fill:none; stroke:silver; stroke-width:0.5;" height="8.8046875" />
<text x="268.61328125" y="13.9404296875" style="clip-path:url(#clipPath2); fill:black; stroke:none; stroke-width:0.5;" xml:space="preserve">Training Cost</text>
<rect x="336.99462890625" y="3.88671875" width="8.8046875" style="clip-path:url(#clipPath2); fill:rgb(64,64,64); stroke:none; stroke-width:0.5;" height="8.8046875" />
<rect x="336.99462890625" y="3.88671875" width="8.8046875" style="clip-path:url(#clipPath2); fill:none; stroke:silver; stroke-width:0.5;" height="8.8046875" />
<text x="349.57275390625" y="13.9404296875" style="clip-path:url(#clipPath2); fill:black; stroke:none; stroke-width:0.5;" xml:space="preserve">Tools</text>
<rect x="3.88671875" y="20.46484375" width="8.8046875" style="clip-path:url(#clipPath2); fill:black; stroke:none; stroke-width:0.5;" height="8.8046875" />
<rect x="3.88671875" y="20.46484375" width="8.8046875" style="clip-path:url(#clipPath2); fill:none; stroke:silver; stroke-width:0.5;" height="8.8046875" />
<text x="16.46484375" y="30.5185546875" style="clip-path:url(#clipPath2); fill:black; stroke:none; stroke-width:0.5;" xml:space="preserve">Office Space & Operations</text>
<rect x="143.77197265625" y="20.46484375" width="8.8046875" style="clip-path:url(#clipPath2); stroke:none; stroke-width:0.5;" height="8.8046875" />
<rect x="143.77197265625" y="20.46484375" width="8.8046875" style="clip-path:url(#clipPath2); fill:none; stroke:silver; stroke-width:0.5;" height="8.8046875" />
<text x="156.35009765625" y="30.5185546875" style="clip-path:url(#clipPath2); fill:black; stroke:none; stroke-width:0.5;" xml:space="preserve">Total Non Labor Costs</text>
<rect x="265.3125" y="20.46484375" width="8.8046875" style="clip-path:url(#clipPath2); fill:rgb(64,64,64); stroke:none; stroke-width:0.5;" height="8.8046875" />
<rect x="265.3125" y="20.46484375" width="8.8046875" style="clip-path:url(#clipPath2); fill:none; stroke:silver; stroke-width:0.5;" height="8.8046875" />
<text x="277.890625" y="30.5185546875" style="clip-path:url(#clipPath2); fill:black; stroke:none; stroke-width:0.5;" xml:space="preserve">Net Profit</text>
<rect x="38.216796875" y="34.82890625" transform="translate(-10.4736328125,-263.84375)" width="351.783203125" style="clip-path:url(#clipPath1); stroke:none; stroke-width:0.5;" height="155.571484375" />
<rect x="38.216796875" y="34.82890625" transform="translate(-10.4736328125,-263.84375)" width="351.783203125" style="clip-path:url(#clipPath1); fill:none; stroke:gray;" height="155.571484375" />
<text x="196.427734375" y="252.814453125" transform="translate(-10.4736328125,-263.84375)" style="font-size:12; clip-path:url(#clipPath1); fill:black; stroke:none;" xml:space="preserve">Round</text>
<text x="70.45124816894531" y="235.75" transform="translate(-10.4736328125,-263.84375) matrix(0,-1,1,0,-165.2987518310547,306.2012481689453)" style="clip-path:url(#clipPath3); fill:black; stroke:none;" xml:space="preserve">LY Q2 (0)</text>
</g>
<g transform="matrix(0,-1,1,0,-91.42427062988281,380.0757293701172)" style="text-rendering:optimizeLegibility; font-size:10; shape-rendering:geometricPrecision; font-family:sans-serif;">
<text x="144.3257293701172" y="235.75" style="clip-path:url(#clipPath4); stroke:none;" xml:space="preserve">LY Q3 (1)</text>
</g>
<g transform="matrix(0,-1,1,0,-17.5498046875,453.9501953125)" style="text-rendering:optimizeLegibility; font-size:10; shape-rendering:geometricPrecision; font-family:sans-serif;">
<text x="218.2001953125" y="235.75" style="clip-path:url(#clipPath5); stroke:none;" xml:space="preserve">LY Q4 (2)</text>
</g>
<g transform="matrix(0,-1,1,0,71.33444213867188,512.8149108886719)" style="text-rendering:optimizeLegibility; font-size:10; shape-rendering:geometricPrecision; font-family:sans-serif;">
<text x="292.0746765136719" y="220.740234375" style="clip-path:url(#clipPath6); stroke:none;" xml:space="preserve">Q1 (3)</text>
</g>
<g transform="matrix(0,-1,1,0,145.20889282226562,586.6893615722656)" style="text-rendering:optimizeLegibility; font-size:10; shape-rendering:geometricPrecision; font-family:sans-serif;">
<text x="365.9491271972656" y="220.740234375" style="clip-path:url(#clipPath7); stroke:none;" xml:space="preserve">Q2 (4)</text>
</g>
<g style="text-rendering:optimizeLegibility; shape-rendering:geometricPrecision; font-family:sans-serif;" transform="matrix(0,-1,1,0,-111.51699829101562,151.70449829101562)">
<text x="20.09375" y="131.61074829101562" style="clip-path:url(#clipPath8); stroke:none;" xml:space="preserve">$ (MM)</text>
</g>
<g style="text-rendering:optimizeLegibility; font-size:10; shape-rendering:geometricPrecision; font-family:sans-serif;">
<text x="30.6552734375" y="195.42724609375" style="clip-path:url(#clipPath1); stroke:none;" xml:space="preserve">0</text>
<line x1="36.216796875" x2="40.216796875" y1="190.400390625" style="clip-path:url(#clipPath1); fill:none; stroke:silver;" y2="190.400390625" />
</g>
<g style="font-size:10; stroke-linecap:butt; fill:gray; text-rendering:optimizeLegibility; font-family:sans-serif; stroke-linejoin:bevel; shape-rendering:geometricPrecision; stroke-dasharray:2,2; stroke:gray; stroke-width:0.5; stroke-miterlimit:0;">
<line x1="38.216796875" x2="390" y1="190.400390625" style="clip-path:url(#clipPath1); fill:none;" y2="190.400390625" />
<text x="30.6552734375" y="168.63844299316406" style="clip-path:url(#clipPath1); fill:black; stroke:none;" xml:space="preserve">2</text>
</g>
<g style="font-size:10; fill:silver; text-rendering:optimizeLegibility; font-family:sans-serif; shape-rendering:geometricPrecision; stroke:silver;">
<line x1="36.216796875" x2="40.216796875" y1="163.61158752441406" style="clip-path:url(#clipPath1); fill:none;" y2="163.61158752441406" />
</g>
<g style="font-size:10; stroke-linecap:butt; fill:gray; text-rendering:optimizeLegibility; font-family:sans-serif; stroke-linejoin:bevel; shape-rendering:geometricPrecision; stroke-dasharray:2,2; stroke:gray; stroke-width:0.5; stroke-miterlimit:0;">
<line x1="38.216796875" x2="390" y1="163.61158752441406" style="clip-path:url(#clipPath1); fill:none;" y2="163.61158752441406" />
<text x="30.6552734375" y="141.8496551513672" style="clip-path:url(#clipPath1); fill:black; stroke:none;" xml:space="preserve">4</text>
</g>
<g style="font-size:10; fill:silver; text-rendering:optimizeLegibility; font-family:sans-serif; shape-rendering:geometricPrecision; stroke:silver;">
<line x1="36.216796875" x2="40.216796875" y1="136.8227996826172" style="clip-path:url(#clipPath1); fill:none;" y2="136.8227996826172" />
</g>
<g style="font-size:10; stroke-linecap:butt; fill:gray; text-rendering:optimizeLegibility; font-family:sans-serif; stroke-linejoin:bevel; shape-rendering:geometricPrecision; stroke-dasharray:2,2; stroke:gray; stroke-width:0.5; stroke-miterlimit:0;">
<line x1="38.216796875" x2="390" y1="136.8227996826172" style="clip-path:url(#clipPath1); fill:none;" y2="136.8227996826172" />
<text x="30.6552734375" y="115.06085205078125" style="clip-path:url(#clipPath1); fill:black; stroke:none;" xml:space="preserve">6</text>
</g>
<g style="font-size:10; fill:silver; text-rendering:optimizeLegibility; font-family:sans-serif; shape-rendering:geometricPrecision; stroke:silver;">
<line x1="36.216796875" x2="40.216796875" y1="110.03399658203125" style="clip-path:url(#clipPath1); fill:none;" y2="110.03399658203125" />
</g>
<g style="font-size:10; stroke-linecap:butt; fill:gray; text-rendering:optimizeLegibility; font-family:sans-serif; stroke-linejoin:bevel; shape-rendering:geometricPrecision; stroke-dasharray:2,2; stroke:gray; stroke-width:0.5; stroke-miterlimit:0;">
<line x1="38.216796875" x2="390" y1="110.03399658203125" style="clip-path:url(#clipPath1); fill:none;" y2="110.03399658203125" />
<text x="30.6552734375" y="88.27205657958984" style="clip-path:url(#clipPath1); fill:black; stroke:none;" xml:space="preserve">8</text>
</g>
<g style="font-size:10; fill:silver; text-rendering:optimizeLegibility; font-family:sans-serif; shape-rendering:geometricPrecision; stroke:silver;">
<line x1="36.216796875" x2="40.216796875" y1="83.24520111083984" style="clip-path:url(#clipPath1); fill:none;" y2="83.24520111083984" />
</g>
<g style="font-size:10; stroke-linecap:butt; fill:gray; text-rendering:optimizeLegibility; font-family:sans-serif; stroke-linejoin:bevel; shape-rendering:geometricPrecision; stroke-dasharray:2,2; stroke:gray; stroke-width:0.5; stroke-miterlimit:0;">
<line x1="38.216796875" x2="390" y1="83.24520111083984" style="clip-path:url(#clipPath1); fill:none;" y2="83.24520111083984" />
<text x="25.09375" y="61.48326110839844" style="clip-path:url(#clipPath1); fill:black; stroke:none;" xml:space="preserve">10</text>
</g>
<g style="font-size:10; fill:silver; text-rendering:optimizeLegibility; font-family:sans-serif; shape-rendering:geometricPrecision; stroke:silver;">
<line x1="36.216796875" x2="40.216796875" y1="56.45640563964844" style="clip-path:url(#clipPath1); fill:none;" y2="56.45640563964844" />
</g>
<g style="font-size:10; stroke-linecap:butt; fill:gray; text-rendering:optimizeLegibility; font-family:sans-serif; stroke-linejoin:bevel; shape-rendering:geometricPrecision; stroke-dasharray:2,2; stroke:gray; stroke-width:0.5; stroke-miterlimit:0;">
<line x1="38.216796875" x2="390" y1="56.45640563964844" style="clip-path:url(#clipPath1); fill:none;" y2="56.45640563964844" />
</g>
<g style="fill-opacity:0.501960813999176; stroke:rgb(204,204,204); text-rendering:optimizeLegibility; stroke-linecap:butt; stroke-miterlimit:0; shape-rendering:geometricPrecision; stroke-opacity:0.501960813999176; fill:rgb(204,204,204); stroke-dasharray:2,2; stroke-width:0.5; font-family:sans-serif; stroke-linejoin:bevel; font-size:10;">
<line x1="38.216796875" x2="390" y1="190.400390625" style="clip-path:url(#clipPath1); fill:none;" y2="190.400390625" />
</g>
<g style="text-rendering:optimizeLegibility; font-size:10; shape-rendering:geometricPrecision; font-family:sans-serif;">
<line x1="66.359453125" x2="140.23392578124998" y1="47.24775594363044" style="clip-path:url(#clipPath9); fill:none; opacity:0.5;" y2="50.98906595687629" />
<line x1="66.359453125" x2="140.23392578124998" y1="104.09023486096957" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:white;" y2="102.5833650222183" />
<line x1="66.359453125" x2="140.23392578124998" y1="165.32140186307927" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:rgb(64,64,64);" y2="164.46764289843924" />
<line x1="66.359453125" x2="140.23392578124998" y1="158.63690046958158" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:silver;" y2="164.73883928621876" />
<line x1="66.359453125" x2="140.23392578124998" y1="189.6971847002494" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:fuchsia;" y2="189.68044170204107" />
<line x1="66.359453125" x2="140.23392578124998" y1="189.6971847002494" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:rgb(64,64,64);" y2="189.68044170204107" />
<line x1="66.359453125" x2="140.23392578124998" y1="181.76937504859694" style="clip-path:url(#clipPath9); fill:none; opacity:0.5;" y2="181.61868806472182" />
<line x1="66.359453125" x2="140.23392578124998" y1="180.3629631990958" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:white;" y2="180.17879021880395" />
<line x1="66.359453125" x2="140.23392578124998" y1="168.6743278954858" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:rgb(64,64,64);" y2="174.9604396924148" />
<line x1="140.23392578124998" x2="214.1083984375" y1="50.98906595687629" style="clip-path:url(#clipPath9); fill:none; opacity:0.5;" y2="50.71823121785812" />
<line x1="140.23392578124998" x2="214.1083984375" y1="102.5833650222183" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:white;" y2="101.07649518346706" />
<line x1="140.23392578124998" x2="214.1083984375" y1="164.46764289843924" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:rgb(64,64,64);" y2="163.86464046936595" />
<line x1="140.23392578124998" x2="214.1083984375" y1="164.73883928621876" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:silver;" y2="166.57787681502506" />
<line x1="140.23392578124998" x2="214.1083984375" y1="189.68044170204107" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:fuchsia;" y2="189.66369870383272" />
<line x1="140.23392578124998" x2="214.1083984375" y1="189.68044170204107" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:rgb(64,64,64);" y2="189.66369870383272" />
<line x1="140.23392578124998" x2="214.1083984375" y1="181.61868806472182" style="clip-path:url(#clipPath9); fill:none; opacity:0.5;" y2="181.4680010808467" />
<line x1="140.23392578124998" x2="214.1083984375" y1="180.17879021880395" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:white;" y2="179.99461723851215" />
<line x1="140.23392578124998" x2="214.1083984375" y1="174.9604396924148" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:rgb(64,64,64);" y2="176.98365020151292" />
<line x1="214.1083984375" x2="287.98287109374996" y1="50.71823121785812" style="clip-path:url(#clipPath9); fill:none; opacity:0.5;" y2="46.51276511108111" />
<line x1="214.1083984375" x2="287.98287109374996" y1="101.07649518346706" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:white;" y2="101.07649518346706" />
<line x1="214.1083984375" x2="287.98287109374996" y1="163.86464046936595" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:rgb(64,64,64);" y2="163.17624874943013" />
<line x1="214.1083984375" x2="287.98287109374996" y1="166.57787681502506" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:silver;" y2="163.06080242818393" />
<line x1="214.1083984375" x2="287.98287109374996" y1="189.66369870383272" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:fuchsia;" y2="189.66369870383272" />
<line x1="214.1083984375" x2="287.98287109374996" y1="189.66369870383272" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:rgb(64,64,64);" y2="189.66369870383272" />
<line x1="214.1083984375" x2="287.98287109374996" y1="181.4680010808467" style="clip-path:url(#clipPath9); fill:none; opacity:0.5;" y2="181.4680010808467" />
<line x1="214.1083984375" x2="287.98287109374996" y1="179.99461723851215" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:white;" y2="179.99461723851215" />
<line x1="214.1083984375" x2="287.98287109374996" y1="176.98365020151292" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:rgb(64,64,64);" y2="173.46657581467178" />
<line x1="287.98287109374996" x2="361.85734375" y1="46.51276511108111" style="clip-path:url(#clipPath9); fill:none; opacity:0.5;" y2="42.23707217261904" />
<line x1="287.98287109374996" x2="361.85734375" y1="101.07649518346706" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:white;" y2="101.07649518346706" />
<line x1="287.98287109374996" x2="361.85734375" y1="163.17624874943013" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:rgb(64,64,64);" y2="162.45045986869613" />
<line x1="287.98287109374996" x2="361.85734375" y1="163.06080242818393" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:silver;" y2="159.51089837045586" />
<line x1="287.98287109374996" x2="361.85734375" y1="189.66369870383272" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:fuchsia;" y2="189.66369870383272" />
<line x1="287.98287109374996" x2="361.85734375" y1="189.66369870383272" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:rgb(64,64,64);" y2="189.66369870383272" />
<line x1="287.98287109374996" x2="361.85734375" y1="181.4680010808467" style="clip-path:url(#clipPath9); fill:none; opacity:0.5;" y2="181.4680010808467" />
<line x1="287.98287109374996" x2="361.85734375" y1="179.99461723851215" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:white;" y2="179.99461723851215" />
<line x1="287.98287109374996" x2="361.85734375" y1="173.46657581467178" style="clip-path:url(#clipPath9); fill:none; opacity:0.5; stroke:rgb(64,64,64);" y2="169.9166717569437" />
</g>
</g>
</svg>

Tom Mazzotta

Re: SVG Generator - How to get the stream directly (w/out go

Post by Tom Mazzotta » Wed Feb 05, 2003 12:18 am

We figured out what I was doing wrong....

Here's some info so you don't do the same thing...

When you call the stream method from svgGenerator
(ie. svgGenerator.stream( svgOutput, true )), the 'stream' get's emptied. I guess this makes sense...

So if you need to call svgGenerator.stream again for any reason, you need to refill it first.

- I was defining the chart
- filling the svgGenerator with the JFreeChart object
- emptying the stream to a file
- then trying emptying the stream to a string ... and getting nothing in the svg section.

Locked