Multiple Ranges for Overlay Charts


Applet code: <applet code=com.objectplanet.chart.ChartApplet archive=chart.jar width=450 height=300> <param name=sampleValues value="15,25,39,31,67"> <param name=rangeOn_2 value=true> <param name=rangeOn_3 value=true> <param name=rangeColor value=#6D684F> <param name=rangeColor_2 value=#10345A> <param name=rangeColor_3 value=#D18103> <param name=rangeStep value=100> <param name=rangeStep_2 value=100> <param name=rangeStep_3 value=20> <param name=rangePosition value=right> <param name=rangePosition_2 value=right> <param name=rangePosition_3 value=right> <param name=rangeAdjusterOn value=true> <param name=rangeAdjusterOn_2 value=true> <param name=rangeAdjusterOn_3 value=true> <param name=barWidth value=0.6> <param name=valueLinesOn value=true> <param name=sampleColors value="#CEC7A5"> <param name=chartBackground value=#eeeeee> <param name=background value=#CEC7A5> <param name=overlay0 value="bar"> <param name=overlay0_valueLabelsOn value="true"> <param name=overlay0_sampleValues value="28,36,95,55,87"> <param name=overlay0_sampleColors value="#10345A"> <param name=overlay0_seriesRange_0 value="2"> <param name=overlay0_barWidth value="0.2"> <param name=overlay1 value="line"> <param name=overlay1_lineWidth value="2"> <param name=overlay1_sampleHighlightOn value="true"> <param name=overlay1_sampleHighlightStyle value="circle_opaque"> <param name=overlay1_sampleValues value="2,3,4,4.5,5,6,8,11"> <param name=overlay1_seriesRange_0 value="3"> <param name=overlay1_sampleColors value="#FF9A00"> </applet>
Servlet code: <img src="http://localhost:8080/servlet/com.objectplanet.chart.ChartServlet? chart=bar& width=450& height=300& sampleValues=15,25,39,31,67& rangeOn_2=true& rangeOn_3=true& rangeColor=%236D684F& rangeColor_2=%2310345A& rangeColor_3=%23D18103& rangeStep=100& rangeStep_2=100& rangeStep_3=20& rangePosition=right& rangePosition_2=right& rangePosition_3=right& rangeAdjusterOn=true& rangeAdjusterOn_2=true& rangeAdjusterOn_3=true& barWidth=0.6& valueLinesOn=true& sampleColors=%23CEC7A5& chartBackground=%23eeeeee& background=%23CEC7A5& overlay0=bar& overlay0_valueLabelsOn=true& overlay0_sampleValues=28,36,95,55,87& overlay0_sampleColors=%2310345A& overlay0_seriesRange_0=2& overlay0_barWidth=0.2& overlay1=line& overlay1_lineWidth=2& overlay1_sampleHighlightOn=true& overlay1_sampleHighlightStyle=circle_opaque& overlay1_sampleValues=2,3,4,4.5,5,6,8,11& overlay1_seriesRange_0=3& overlay1_sampleColors=%23FF9A00">
Application code: package com.objectplanet.chart.testing; import com.objectplanet.chart.*; import java.awt.*; public class Overlay { public static void main(String[] argv) { double[] sampleValues = new double[] {15,25,39,31,67}; double[] overlayValues_0 = new double[] {28,36,95,55,87}; double[] overlayValues_1 = new double[] {2,3,4,4.5,5,6,8,11}; BarChart chart = new BarChart(); chart.setSampleCount(sampleValues.length); chart.setSampleValues(0, sampleValues); chart.setRangeOn(1, true); chart.setRangeOn(2, true); chart.setRelativeRange(0, 1.0, 100); chart.setRangePosition(0, 1); chart.setRangePosition(1, 1); chart.setRangePosition(2, 1); chart.setRangeAdjusterOn(0, true); chart.setRangeAdjusterOn(1, true); chart.setRangeAdjusterOn(2, true); chart.setRangeColor(0, new Color(0x6d684f)); chart.setRangeColor(1, new Color(0x10345a)); chart.setRangeColor(2, new Color(0xd18103)); chart.setSeriesRange(0, 0); chart.setBarWidth(0.6); chart.setValueLinesOn(true); chart.setSampleColors(new Color[] {new Color(0xcec7a5)}); chart.setChartBackground(new Color(0xeeeeee)); chart.setBackground(new Color(0xcec7a5)); BarChart overlay0 = new BarChart(); overlay0.setSampleCount(overlayValues_0.length); overlay0.setSampleValues(0, overlayValues_0); overlay0.setSampleColors(new Color[] {new Color(0x10345a)}); overlay0.setSeriesRange(0, 1); overlay0.setBarWidth(0.2); overlay0.setValueLabelsOn(true); chart.setOverlayChart(0, overlay0); chart.setRelativeRange(1, 1.0, 100); LineChart overlay1 = new LineChart(); overlay1.setSampleCount(overlayValues_1.length); overlay1.setSampleValues(0, overlayValues_1); overlay1.setSampleColors(new Color[] {new Color(0xff9a00)}); overlay1.setSeriesRange(0, 2); overlay1.setSampleHighlightOn(true); overlay1.setSampleHighlightStyle(0, LineChart.SAMPLE_HIGHLIGHT_CIRCLE_OPAQUE, 4); chart.setOverlayChart(1, overlay1); chart.setRelativeRange(2, 1.0, 20); 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(); } }