DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35655>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35655

           Summary: Strange drawing bug in 1.6
           Product: Batik
           Version: 1.5
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: SVGGraphics2D
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


I've found a strange bug in Batik 1.6.

I want to save a simple pie chart (created with jfreechart) to SVG format.
When I use batik 1.5, everything works fine...
I got the following result:

http://people.inf.elte.hu/robi/svg/test1.svg

With 1.6 (using the same code and the same jfreechart lib)
the result looks interesting:

http://people.inf.elte.hu/robi/svg/test2.svg

The complete code is the following:

BEGIN CODE -------------------------------------------------

import java.awt.geom.Rectangle2D;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;

import org.apache.batik.dom.GenericDOMImplementation;
import org.apache.batik.svggen.SVGGraphics2D;
import org.apache.batik.svggen.SVGGraphics2DIOException;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.data.general.DefaultPieDataset;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;

/*
 * Created on 2005.07.05.
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */

/**
 * @author rszalai
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class SVGTest1 {

        public static void main(String[] args) throws SVGGraphics2DIOException,
UnsupportedEncodingException, FileNotFoundException {
                
                // Create a Pie dataset...
                DefaultPieDataset data = new DefaultPieDataset();
                data.setValue("Category 1", 43.2);
                data.setValue("Category 2", 27.9);
                data.setValue("Category 3", 79.5);
                
                // Create a Pie chart...
                JFreeChart chart = ChartFactory.createPieChart("Sample Pie 
Chart", data, true,
true, false);
                
                // Get a DOMImplementation
                DOMImplementation domImpl = 
GenericDOMImplementation.getDOMImplementation();
                
                Document document = domImpl.createDocument(null, "svg", null);
                
                SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
                
                chart.draw(svgGenerator, new Rectangle2D.Double(0, 0, 400, 
300));
                
                boolean useCSS = true;
                
                Writer out = new OutputStreamWriter(new FileOutputStream(new
File("test.svg")), "UTF-8");
                
                svgGenerator.stream(out, useCSS);
                
        }
}

END CODE -------------------------------------------------------------

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

Reply via email to