Stacked and Horizontal Bars


Applet code: <applet code=com.objectplanet.chart.ChartApplet  archive=chart.jar width=450 height=300> <param name=chart value="bar"> <param name=seriesCount value="3"> <param name=sampleValues_0 value="38,-76,25,-38,71,63,25"> <param name=sampleValues_1 value="79,-08,52,-68,43,-55,61"> <param name=sampleValues_2 value="51,76, 58,-32,75,-76,58"> <param name=multiColorOn value=true> <param name=sampleColors value="yellow, orange, red"> <param name=rangeStep value=50> <param name=barWidth value=0.6> <param name=barType value=stacked> <param name=barAlignment value=horizontal> <param name=valueLinesOn value=true> <param name=background value=white> <param name=valueLabelsOn value=true> <param name=valueLabelFont value="Arial,bold,11"> <param name=rangeLabelFont value="Arial,bold,13"> </applet>
Servlet code: <img src="http://localhost:8080/servlet/com.objectplanet.chart.ChartServlet? chart=pie& width=450& height=300& seriesCount=3& sampleValues_0=38,-76,25,-38,71,63,25& sampleValues_1=79,-08,52,-68,43,-55,61& sampleValues_2=51,76,58,-32,75,-76,58& multiColorOn=true& sampleColors=yellow,orange,red& rangeStep=50& barWidth=0.6& barType=stacked& barAlignment=horizontal& valueLinesOn=true& background=white& valueLabelsOn=true& valueLabelFont=Arial,bold,11& rangeLabelFont=Arial,bold,13">
Application code: package com.objectplanet.chart.testing; import com.objectplanet.chart.*; import java.awt.*; public class Bar { public static void main(String[] argv) { double[] sampleValues_0 = new double[] {38,-76,25,-38,71,63,25}; double[] sampleValues_1 = new double[] {79,-8,52,-68,43,-55,61}; double[] sampleValues_2 = new double[] {51,76, 58,-32,75,-76,58}; Color[] sampleColors = new Color[] {Color.yellow, Color.orange, Color.red}; BarChart chart = new BarChart(); chart.setSeriesCount(3); chart.setSampleCount(7); chart.setSampleValues(0, sampleValues_0); chart.setSampleValues(1, sampleValues_1); chart.setSampleValues(2, sampleValues_2); chart.setRange(0,200); chart.setLowerRange(0,-150); chart.setFont("rangeLabelFont", new Font("Arial", Font.BOLD, 13)); chart.setMultiColorOn(true); chart.setSampleColors(sampleColors); chart.setValueLabelsOn(true); chart.setFont("valueLabelFont", new Font("Arial", Font.BOLD, 11)); chart.setValueLinesOn(true); chart.setMaxValueLineCount(10); chart.setBarType(BarChart.STACKED_BARS); chart.setBarAlignment(Chart.HORIZONTAL); chart.setBarWidth(0.6); 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(); } }