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,32,65,65,88,88"> <param name=sampleLabels value="jan\n2003, feb\n2003, mar\n2003, apr\n2003, may\n2003, june\n2003"> <param name=sampleColors value="#FFA000"> <param name=range value=88> <param name=sampleLabelsOn value=true> <param name=sampleLabelStyle value=outside> <param name=sampleLabelColors value="#060B46,#060B46,#060B46,#060B46,#060B46,#060B46"> <param name=sampleLabelFont value=Arial,bold,12> <param name=sampleLabelSelectionColor value=red> <param name=valueLabelsOn value=true> <param name=valueLabelStyle value=inside> <param name=valueLabelFont value=Courier,plain,16> <param name=barLabels value="jan, feb, mar, apr, may, jun"> <param name=barLabelsOn value=true> <param name=barLabelAngle value=270> <param name=barLabelFont value=Arial,bold,12> <param name=barLabelColors value="#961504,#961504,#961504,#961504,#961504,#961504"> <param name=barWidth value=0.5> <param name=valueLinesOn value=true> <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,32,65,65,88,88& sampleLabels=jan\n2003, feb\n2003, mar\n2003, apr\n2003, may\n2003, june\n2003& sampleColors=%23FFA000& range=88& rangeLabelFont=Arial,bold,13& sampleLabelsOn=true& sampleLabelStyle=outside& sampleLabelColors=%23060B46,%23060B46,%23060B46,%23060B46,%23060B46,%23060B46& sampleLabelFont=Arial,bold,12& sampleLabelSelectionColor=red& valueLabelsOn=true& valueLabelStyle=inside& valueLabelFont=Courier,plain,16& barLabels=jan, feb, mar, apr, may, jun& barLabelsOn=true& barLabelAngle=270& barLabelFont=Arial,bold,12& barLabelColors=%23961504,%23961504,%23961504,%23961504,%23961504,%23961504& barWidth=0.5& valueLinesOn=true& 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(6); double[] values = new double[] {32,32,65,65,88,88}; String[] sampleLabels = new String[] {"jan\n2003", "feb\n2003", "mar\n2003", "apr\n2003", "may\n2003", "june\n2003"}; String[] barLabels = new String[] {"jan", "feb", "mar", "apr", "may", "june"}; chart.setSampleValues(0, values); chart.setSampleColor(0, new Color(0xFFA000)); chart.setRange(0, 88); chart.setFont("rangeLabelFont", new Font("Arial", Font.BOLD, 13)); chart.setSampleLabels(sampleLabels); chart.setSampleLabelsOn(true); chart.setSampleLabelStyle(Chart.OUTSIDE); chart.setSampleLabelSelectionColor(Color.red); chart.setFont("sampleLabelFont", new Font("Arial", Font.BOLD, 12)); chart.setBarLabels(barLabels); chart.setBarLabelsOn(true); chart.setLabelAngle("barLabelAngle", 270); for (int i = 0; i < values.length; i++) { chart.setBarLabelColor(i, new Color(0x961504)); } chart.setValueLabelsOn(true); chart.setValueLabelStyle(Chart.INSIDE); chart.setFont("valueLabelFont", new Font("Arial", Font.PLAIN, 14)); chart.setValueLinesOn(true); chart.setMaxValueLineCount(10); chart.setFont("floatingLabelFont", new Font("Arial", Font.BOLD, 11)); chart.setBarWidth(0.5); chart.setBackground(Color.white); Frame f = new Frame(); f.setSize(450,320); f.add("Center", chart); f.show(); } } |