Stacked Lines
Applet code:
<applet code=com.objectplanet.chart.ChartApplet
archive=chart.jar width=450 height=300>
<param name=chart value="line">
<param name=seriesCount value=3>
<param name=sampleColors value="#7095D8,#FFEF84,#FFBD84">
<param name=sampleValues_0 value="73,68,108,125,133,201,226,159,118,165,225,280,267,352,109">
<param name=sampleValues_1 value="69,84,103,136,129,152,141,175,240,225,138,202,246,284,278">
<param name=sampleValues_2 value="81,77,94,123,124,141,115,164,270,187,175,202,374,327,204">
<param name=range value=1000>
<param name=rangeLabelFont value="Arial,bold,11">
<param name=defaultGridLinesOn value=true>
<param name=defaultGridLinesColor value=white>
<param name=legendLabels value="serie 1, serie 2, serie 3">
<param name=legendPosition value=bottom>
<param name=valueLabelsOn value=true>
<param name=valueLabelStyle value=outside>
<param name=valueLabelFont value="Arial,bold,11">
<param name=valueLinesOn value=true>
<param name=valueLinesColor value=white>
<param name=legendOn value=true>
<param name=legendFont value="Arial,bold,11">
<param name=outlineOff value=true>
<param name=stackedOn value=true>
<param name=3DModeOn value=true>
<param name=chartBackground value=#EFEFEF>
<param name=background value=white>
</applet>
Servlet code:
<img src="http://localhost:8080/servlet/com.objectplanet.chart.ChartServlet?
chart=pie&
width=450&
height=300&
seriesCount=3&
sampleColors=%237095D8,%23FFEF84,%23FFBD84&
sampleValues_0=73,68,108,125,133,201,226,159,118,165,225,280,267,352,109&
sampleValues_1=69,84,103,136,129,152,141,175,240,225,138,202,246,284,278&
sampleValues_2=81,77,94,123,124,141,115,164,270,187,175,202,374,327,204&
range=1000&
rangeLabelFont=Arial,bold,11&
defaultGridLinesOn=true&
defaultGridLinesColor=white&
legendLabels=serie1,serie2,serie3&
legendPosition=bottom&
valueLabelsOn=true&
valueLabelStyle=outside&
valueLabelFont=Arial,bold,11&
valueLinesOn=true&
valueLinesColor=white&
legendOn=true&
legendFont=Arial,bold,11&
outlineOff=true&
stackedOn=true&
3DModeOn=true&
chartBackground=%23EFEFEF&
background=white">
Application code:
package com.objectplanet.chart.testing;
import com.objectplanet.chart.*;
import java.awt.*;
public class Line {
public static void main(String[] argv) {
double[] sampleValues_0 = new double[] {73,68,108,125,133,201,226,159,118,165,225,280,267,352,109};
double[] sampleValues_1 = new double[] {69,84,103,136,129,152,141,175,240,225,138,202,246,284,278};
double[] sampleValues_2 = new double[] {81,77,94,123,124,141,115,164,270,187,175,202,374,327,204};
Color[] sampleColors = new Color[] {new Color(0x7095D8), new Color(0xFFEF84), new Color(0xFFBD84)};
LineChart chart = new LineChart();
chart.setSeriesCount(3);
chart.setSampleCount(sampleValues_0.length);
chart.setSampleValues(0, sampleValues_0);
chart.setSampleValues(1, sampleValues_1);
chart.setSampleValues(2, sampleValues_2);
chart.setSampleColors(sampleColors);
chart.setRange(0,1000);
chart.setFont("rangeLabelFont", new Font("Arial", Font.BOLD, 11));
chart.setValueLabelsOn(true);
chart.setValueLabelStyle(Chart.OUTSIDE);
chart.setValueLinesOn(true);
chart.setValueLinesColor(Color.white);
chart.setDefaultGridLinesOn(true);
chart.setDefaultGridLinesColor(Color.white);
chart.setFont("valueLabelFont", new Font("Arial", Font.BOLD, 11));
chart.setLegendOn(true);
chart.setLegendPosition(Chart.BOTTOM);
chart.setLegendLabels(new String[] {"serie 1", "serie 2", "serie 3"});
chart.setFont("legendFont", new Font("Dialog", Font.BOLD, 12));
chart.setStackedOn(true);
chart.set3DModeOn(true);
chart.setChartBackground(new Color(0xefefef));
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();
}
}
|