Pie Chart Labels


Applet code: <applet code=com.objectplanet.chart.ChartApplet archive=chart.jar width=450 height=300> <param name=chart value=pie> <param name=chartTitle value="Internet Connections Over..."> <param name=titleFont value="Times, plain, 18"> <param name=sampleValues value="29184,23808,13056,10752"> <param name=sampleColors value="#FFB47F,#FF7C1F,#BF4F00,#5F2700"> <param name=sliceSeperatorOn value=false> <param name=sampleLabelsOn value=true> <param name=sampleLabelStyle value=pointing> <param name=sampleLabels value="Broadband\n, ADSL\n, Dial-Up\n, GPRS\n"> <param name=pointingLabelFont value="Times, bold, 11"> <param name=percentLabelsOn value=true> <param name=percentLabelStyle value=inside> <param name=depth value=0.2> <param name=selectionStyle value=circle> <param name=valueLabelsOn value="true"> <param name=valueLabelStyle value="pointing"> <param name=valueLabelPostfix value=" Gb"> <param name=insideLabelFont value="Arial, bold, 13"> <param name=pieRotationOn value="true"> <param name=background value=white> </applet>
Servlet code: <img src="http://localhost:8080/servlet/com.objectplanet.chart.ChartServlet? chart=pie& width=450& height=300& chartTitle=Internet%20Connections%20Over...& titleFont=Times,plain,18& sampleValues=29184,23808,13056,10752& sampleColors=%23FFB47F,%23FF7C1F,%23BF4F00,%235F2700& sliceSeperatorOn=false& sampleLabelsOn=true& sampleLabelStyle=pointing& sampleLabels=Broadband\n,ADSL\n,Dial-Up\n,GPRS\n& pointingLabelFont=Times,bold,11& percentLabelsOn=true& percentLabelStyle=inside& depth=0.2& selectionStyle=circle& valueLabelsOn=true& valueLabelStyle=pointing& valueLabelPostfix=Gb& insideLabelFont=Arial,bold,13& pieRotationOn=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 = new double[] {29184,23808,13056,10752}; Color[] sampleColors = new Color[] {new Color(0xffb47f), new Color(0xff7c1f), new Color(0xbf4f00), new Color(0x5f2700)}; PieChart chart = new PieChart(); chart.setTitleOn(true); chart.setTitle("Internet Connections Over..."); chart.setFont("titleFont", new Font("Times", Font.PLAIN, 18)); chart.setSampleCount(4); chart.setSampleValues(0, sampleValues); chart.setSampleLabels(new String[] {"Broadband\n","ADSL\n","Dial-Up\n","GPRS\n"}); chart.setSampleLabelsOn(true); chart.setSampleLabelStyle(Chart.POINTING); chart.setValueLabelsOn(true); chart.setValueLabelStyle(Chart.POINTING); chart.setLabel("valueLabelPrefix", "Gb"); chart.setFont("pointingLabelFont", new Font("Times", Font.BOLD, 11)); chart.setPercentLabelsOn(true); chart.setPercentLabelStyle(Chart.INSIDE); chart.setFont("insideLabelFont", new Font("Arial", Font.BOLD, 13)); chart.setSampleColors(sampleColors); chart.setSliceSeperatorOn(false); chart.setSelectionStyle(PieChart.SELECTION_STYLE_CIRCLE); chart.set3DModeOn(true); chart.setDepth(0.2); chart.setPieRotationOn(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(); } }