I modified your "Concentric Donut Chart" sample codes to generate a SVG output to a SAXParser, the parser threw the following exception:
org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
I got the same error when I tried validating the file output using Oxygen, can you shed some lights on this, below is the modified codes:
public byte[] getChartSVG() {
int angle = 50;
//The data for the pie chart
double[] data = {25, 18, 15, 12, 8, 30, 35, 40 };
double[] data2 = {20, 25, 15, 10, 15, 35, 20, 35 };
//The labels for the pie chart
String[] labels = {"Cash", "Bonds - Coporate (Cautious)", "Venture", "Other", "Equities - AIM (alternative Investment Market",
"Futures & Options", "Funds - Corporate Bond", "Enterprise Investment Schemes"};
// Create a PieChart object of size 700 x 360 pixels, with transparent background
PieChart c = new PieChart(700, 360);
c.enableVectorOutput();
// Add a title to the chart with 18pts Times Bold Italic font
c.addTitle("Concentric Donut Chart", "Times New Roman Bold Italic", 18);
// Set donut center at (160, 200), and outer/inner radii as 150/100 pixels
c.setDonutSize(160, 200, 150, 100);
// Add a label at the bottom-right corner of the ring to label the outer ring Use
// 12pts Arial Bold Italic font in white (ffffff) color, on a green (008800)
// background, with soft lighting effect and 5 pixels rounded corners
TextBox t = c.addText(260, 300, " Year 2006 ", "Arial Bold Italic", 12, 0xffffff);
t.setBackground(0x008800, Chart.Transparent, Chart.softLighting());
t.setRoundedCorners(5);
// Set the legend box at (320, 50) with 12 pts Arial Bold Italic font, with no border
c.addLegend(320, 50, true, "Arial Bold Italic",
3).setBackground(Chart.Transparent, Chart.Transparent);
// Set the pie data and the pie labels
c.setData(data, labels);
//Use ring shading effect for the sectors
c.setSectorStyle(Chart.RoundedEdgeShading);
c.setLabelStyle("Arial Bold", 10, Chart.Transparent);
c.set3D(25, angle);
// write output to file system
c.makeChart("C:\\\\Share\\\\test.svg");
// return svg byte output to caller
return c.makeChart(Chart.SVG);
} |