Multiple Pies
Applet code:
<applet code=com.objectplanet.chart.ChartApplet
archive=chart.jar width=450 height=300>
<param name=chart value="pie">
<param name=chartTitle value="Software Distribution">
<param name=titleFont value="Courier, bold, 22">
<param name=seriesCount value="3">
<param name=sampleValues_0 value="200, 300, 400, 300">
<param name=sampleValues_1 value="300, 400, 500, 600">
<param name=sampleValues_2 value="160, 150, 130, 100">
<param name=sampleLabels value="America, Europe, Asia, Africa">
<param name=seriesLabels value="Charting, Survey, Network">
<param name=pieLabelsOn value="true">
<param name=percentLabelsOn value="true">
<param name=percentLabelStyle value="inside">
<param name=sampleColors value="#AD6300,#B52900,#E7CE6B">
<param name=legendOn value=true>
<param name=sliceSeperatorColor value=white>
<param name=3dModeOn value="true">
<param name=background value=white>
</applet>
Servlet code:
<http://localhost:8080/servlet/com.objectplanet.chart.ChartServlet?
chart=pie&
width=450&
height=300&
chartTitle=Software%20Distribution&
titleFont=Courier,bold,22&
seriesCount=3&
sampleValues_0=200,300,400,300&
sampleValues_1=300,400,500,600&
sampleValues_2=160,150,130,100&
sampleLabels=America,Europe,Asia,Africa&
seriesLabels=Charting,Survey,Network&
pieLabelsOn=true&
percentLabelsOn=true&
percentLabelStyle=inside&
sampleColors=%23AD6300,%23B52900,%23E7CE6B&
legendOn=true&
sliceSeperatorColor=white&
3dModeOn=true&
background=white">
Application code:
package com.objectplanet.chart.testing;
import com.objectplanet.chart.*;
import java.awt.*;
public class Pie {
public static void main(String[] argv) {
double[] sampleValues_0 = new double[] {200, 300, 400, 300};
double[] sampleValues_1 = new double[] {300, 400, 500, 600};
double[] sampleValues_2 = new double[] {160, 150, 130, 100};
PieChart chart = new PieChart();
chart.setTitleOn(true);
chart.setTitle("Software Distribution");
chart.setFont("titleFont", new Font("Courier", Font.BOLD, 22));
chart.setSeriesCount(3);
chart.setSampleCount(4);
chart.setSampleValues(0, sampleValues_0);
chart.setSampleValues(1, sampleValues_1);
chart.setSampleValues(2, sampleValues_2);
chart.setSampleLabels(new String[] {"America","Europe","Asia","Africa"});
chart.setSeriesLabels(new String[] {"Charting","Survey","Network"});
chart.setPieLabelsOn(true);
chart.setPercentLabelsOn(true);
chart.setPercentLabelStyle(Chart.INSIDE);
chart.setSampleColors(new Color[] {new Color(0xad6300), new Color(0xb52900), new Color(0xe7ce6b)});
chart.setLegendOn(true);
chart.setSliceSeperatorColor(Color.white);
chart.set3DModeOn(true);
chart.setBackground(Color.white);
com.objectplanet.chart.NonFlickerPanel p = new com.objectplanet.chart.NonFlickerPanel(new BorderLayout());
p.add("Center", chart);
Frame f = new Frame();
f.add("Center", p);
f.setSize(450,320);
f.show();
}
}
|