Bar Chart Labels
Applet code: <applet code=com.objectplanet.chart.ChartApplet archive=chart.jar width=450 height=300> <param name=chart value="bar"> <param name=sampleValues value="32,55,70,30,20"> <param name=sampleLabels value="JAN 2003\n, FEB 2003\n, MAR 2003\n, APR 2003\n, MAY 2003\n"> <param name=sampleLabelsOn value=true> <param name=sampleLabelStyle value=floating> <param name=sampleColors value="#F6DEB5"> <param name=range value=100> <param name=rangeLabelFont value="Arial,bold,13"> <param name=sampleAxisLabel value="sampleAxisLabel"> <param name=sampleAxisLabelFont value="Arial,bold,16"> <param name=valueLabelsOn value=true> <param name=valueLabelStyle value=floating> <param name=label_0 value="The label may be set any place you want, 130, 60"> <param name=label_1 value="APRIL 2003,300,150,3,0"> <param name=floatingLabelFont value=Arial,bold,13> <param name=barWidth value=0.9> <param name=background value=white> </applet> Servlet code: <img SRC="http://127.0.0.1:8080/servlet/com.objectplanet.chart.ChartServlet? width=450& height=300& chart=bar& sampleValues=32,55,70,30,20& sampleLabels=JAN 2003\n, FEB 2003\n, MAR 2003\n, APR 2003\n, MAY 2003\n& sampleLabelsOn=true& sampleLabelStyle=floating& sampleColors=%23F6DEB5& range=100& rangeLabelFont=Arial,bold,13& sampleAxisLabel=sampleAxisLabel& sampleAxisLabelFont=Arial,bold,16& valueLabelsOn=true& valueLabelStyle=floating& label_0=The label may be set any place you want, 130, 60& label_1=APRIL 2003,300,150,3,0& floatingLabelFont=Arial,bold,13& barWidth=0.9& background=white"> Application code: package com.objectplanet.chart.testing; import com.objectplanet.chart.*; import java.awt.*; public class Bar { public static void main(String[] argv) { BarChart chart = new BarChart(); chart.setSampleCount(5); double[] values = new double[] {32,55,69,32,22}; String[] sampleLabels = new String[] {"JAN 2003\n", "FEB 2003\n", "MAR 2003\n", "APR 2003\n", "MAY 2003\n"}; chart.setSampleValues(0, values); chart.setSampleColor(0, new Color(0xF6DEB5)); chart.setRange(0, 88); chart.setFont("rangeLabelFont", new Font("Arial", Font.BOLD, 13)); chart.setSampleLabels(sampleLabels); chart.setSampleLabelsOn(true); chart.setSampleLabelStyle(Chart.FLOATING); chart.setValueLabelsOn(true); chart.setValueLabelStyle(Chart.FLOATING); chart.setFont("floatingLabelFont", new Font("Arial", Font.BOLD, 13)); chart.setLabel("sampleAxisLabel", "sampleAxisLabel"); chart.setFont("sampleAxisLabelFont", new Font("Arial", Font.BOLD, 16)); chart.setLabel("label_0", "This label may be set any place you want", 0.4, 0.1); chart.setLabel("label_1", "APRIL 2003", 300, 150, 3, 0); chart.setBarWidth(0.9); chart.setBackground(Color.white); Frame f = new Frame(); f.setSize(450,320); f.add("Center", chart); f.show(); } } |