Connected Plots And Line Width
Applet code:
<applet code=com.objectplanet.chart.ChartApplet
archive=chart.ext.jar width=450 height=300>
<param name=chart value=plotter>
<param name=chartTitle value="Connected Plots">
<param name=titleFont value=Courier,bold,16>
<param name=seriesCount value=3>
<param name=plots_0 value=10|17,16|33,35|29,48|71,67|51,71|83,90|68>
<param name=plots_1 value=10|59,29|15,56|44,63|22,85|56,90|46>
<param name=plots_2 value=10|88,33|70,46|11,61|82,81|27,90|36>
<param name=plotSize_0 value=10>
<param name=plotSize_1 value=10>
<param name=plotSize_2 value=10>
<param name=plotStyle value=circle_opaque,diamond_opaque,square_opaque>
<param name=rangeOn value=right,bottom>
<param name=seriesColors value=#DE9C73,#B59C39,#D6A5CE>
<param name=connectedLinesOn value=true>
<param name=lineWidth value=2,4,3>
<param name=XValueLinesOn value=false>
<param name=rangeAdjusterOn_right value=true>
<param name=XValueLabelsOn value=true>
<param name=YValueLabelsOn value=true>
<param name=valueLabelStyle value=over>
<param name=background value=white>
</applet>
Servlet code:
<img src="http://localhost:8080/servlet/com.objectplanet.chart.ChartServlet?
chart=plotter&
width=450&
height=300&
chartTitle=Connected%20Plots&
titleFont=Courier,bold,16&
seriesCount=3&
plots_0=10|17,16|33,35|29,48|71,67|51,71|83,90|68&
plots_1=10|59,29|15,56|44,63|22,85|56,90|46&
plots_2=10|88,33|70,46|11,61|82,81|27,90|36&
plotSize_0=10&
plotSize_1=10&
plotSize_2=10&
plotStyle=circle_opaque,diamond_opaque,square_opaque&
seriesColors=%23DE9C73,%23B59C39,%23D6A5CE&
connectedLinesOn=true&
rangeOn=right,bottom&
lineWidth=2,4,3&
XValueLinesOn=false&
XValueLabelsOn=true&
YValueLabelsOn=true&
valueLabelStyle=over&
background=white">
Application code:
package com.objectplanet.chart.testing;
import com.objectplanet.chart.ext.*;
import java.awt.*;
public class Plotter {
public static void main(String[] argv) {
double[][] plots_0 = new double[][] {{10,17},{16,33},{35,29},{48,71},{67,51},{71,83},{90,68}};
double[][] plots_1 = new double[][] {{10,59},{29,15},{56,44},{63,22},{85,56},{90,46}};
double[][] plots_2 = new double[][] {{10,88},{33,70},{46,11},{61,82},{81,27},{90,36}};
Color[] seriesColors = new Color[] {new Color(0xDE9C73), new Color(0xB59C39), new Color(0xD6A5CE)};
PlotterChart chart = new PlotterChart();
chart.setTitleOn(true);
chart.setTitle("Connected Plots");
chart.setFont("titleFont", new Font("Courier", Font.BOLD, 16));
chart.setSeriesCount(3);
chart.setPlots(0, plots_0, 10);
chart.setPlots(1, plots_1, 10);
chart.setPlots(2, plots_2, 10);
chart.setSeriesColors(seriesColors);
chart.setPlotStyle(0, PlotterChart.PLOT_STYLE_CIRCLE_OPAQUE);
chart.setPlotStyle(1, PlotterChart.PLOT_STYLE_DIAMOND_OPAQUE);
chart.setPlotStyle(2, PlotterChart.PLOT_STYLE_SQUARE_OPAQUE);
chart.setConnectedLinesOn(-1, true);
chart.setLineWidth(0,2);
chart.setLineWidth(1,4);
chart.setLineWidth(2,3);
chart.setRangeOn(PlotterChart.LEFT, false);
chart.setRangeOn(PlotterChart.RIGHT, true);
chart.setRangeOn(PlotterChart.BOTTOM, true);
chart.setXValueLinesOn(false);
chart.setRangeAdjusterOn(PlotterChart.RIGHT, true);
chart.setXValueLabelsOn(true);
chart.setYValueLabelsOn(true);
chart.setValueLabelStyle(PlotterChart.OVER);
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();
}
}
|