Hi, 
The code for exporting the chart as svg :
public static void exportChartAsSVG(OutputStream os, JFreeChart chart,
Rectangle bounds) throws IOException {
        // Get a DOMImplementation and create an XML document
        DOMImplementation domImpl =
            GenericDOMImplementation.getDOMImplementation();
        Document document = domImpl.createDocument(null, "svg", null);
        //System.out.println("rectangle width=>" + bounds.getWidth());
        //System.out.println("rectangle height=>" + bounds.getHeight());
        // Create an instance of the SVG Generator
        SVGGraphics2D svgGenerator = new SVGGraphics2D(document);

        // draw the chart in the SVG generator
        chart.draw(svgGenerator, bounds);

        // Write svg file

        Writer out = new OutputStreamWriter(os, "UTF-8");
        svgGenerator.stream(out, true  /*use css*/ );                           
                
        
        }

Now can u suggest something......

Namrata.

thomas.deweese wrote:
> 
> Hi Namrata,
> 
> Namrata <[EMAIL PROTECTED]> wrote on 05/04/2007 06:43:35 
> AM:
> 
>> I have done the latter only. I mean i have called draw on a JFreeChart 
>> object with the SVGGraphics2D. And after tht :
>> OutputStream os = new ByteArrayOutputStream();
>> Writer out = new OutputStreamWriter(os, "UTF-8");
>> svgGenerator.stream(out, true  /*use css*/ ); 
> 
>    Then you will have to ask the JFreeChart folks why it is
> drawing an image rather than drawing the various lines/shapes
> that make up the graph.  I think your PDF files will shrink a
> bit and look better if you figure this out.
> 
>> 
>> Namrata.
>> 
>> thomas.deweese wrote:
>> > 
>> > Hi Namrata,
>> > 
>> >> Namrata wrote:
>> >> > 
>> >> > I have exported the JFreeChart as SVG using batik.
>> > 
>> > Namrata <[EMAIL PROTECTED]> wrote on 05/04/2007 
> 02:37:26 
>> > AM:
>> > 
>> >> The size of each chart is approximately 20k. And the SVG contains the
>> >> following :
>> >>       <image x="0" y="0" width="300"
>> >> xlink:href="data:image/png;base64,
>> >> iVBORw0KGgoAAAANSUhEUgAAASwAAABKCAAAAAAkzDZaAAAArUlEQVR42u3b0QnA
>> > 
>> >    It looks to me like you are not exporting the chart
>> > correctly with Batik.  The image element above contains
>> > a few simple geometric draw commands.  How are you
>> > exporting the chart to Batik?
>> > 
>> >    Are you calling paint/paintComponent on a
>> > ChartPanel?  Or are you calling draw on a JFreeChart 
>> > object with the SVGGraphics2D?  I think you want to
>> > do the latter.
>> > 
>> > 
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: 
> [EMAIL PROTECTED]
>> > 
>> > 
>> > 
>> 
>> -- 
>> View this message in context: http://www.nabble.com/Reducing-the-
>> size-of-SVG-file-tf3679961.html#a10320467
>> Sent from the Batik - Users mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Reducing-the-size-of-SVG-file-tf3679961.html#a10320800
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to