Highlighting Sample Points
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=range value=100>
<param name=rangeLabelFont value="Arial,bold,13">
<param name=sampleValues_0 value=",48,,54,,48,,44,,59,">
<param name=sampleValues_1 value=",28,13,31,18,21,8,26,18,31">
<param name=sampleValues_2 value=",75,69,79,91,73,70,94,90,92">
<param name=sampleColors value="red, pink, orange">
<param name=sampleHighlightOn value="true">
<param name=sampleHighlightStyle value="square, circle_filled, diamond_opaque">
<param name=sampleHighlightSize value="25,25,23">
<param name=lineWidth value=1,2,3>
<param name=seriesLineOff value=0>
<param name=valueLinesOn value=true>
<param name=valueLabelsOn value=true>
<param name=valueLabelStyle value=inside>
<param name=valueLabelFont value="Arial,bold,11">
<param name=maxValueLineCount value=10>
<param name=background value="white">
</applet>
Servlet code:
<img src="http://localhost:8080/servlet/com.objectplanet.chart.ChartServlet?
chart=line&
width=450&
height=300&
seriesCount=3&
range=100&
rangeLabelFont=Arial,bold,13&
sampleValues_0=,48,,54,,48,,44,,59,&
sampleValues_1=,28,13,31,18,21,8,26,18,31&
sampleValues_2=,75,69,79,91,73,70,94,90,92&
sampleColors=red,pink,orange&
sampleHighlightOn=true&
sampleHighlightStyle=square,circle_filled,diamond_opaque&
sampleHighlightSize=25,25,23&
lineWidth=1,2,3&
seriesLineOff=0&
valueLinesOn=true&
valueLabelsOn=true&
valueLabelStyle=inside&
valueLabelFont=Arial,bold,11&
maxValueLineCount=10&
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[] {Double.NaN,48,Double.NaN,54,Double.NaN,48,Double.NaN,44,Double.NaN,59,Double.NaN};
double[] sampleValues_1 = new double[] {Double.NaN,28,13,31,18,21,8,26,18,31};
double[] sampleValues_2 = new double[] {Double.NaN,75,69,79,91,73,70,94,90,92};
Color[] sampleColors = new Color[] {Color.red, Color.pink, Color.orange};
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.setValueLabelsOn(true);
chart.setValueLabelStyle(Chart.INSIDE);
chart.setValueLinesOn(true);
chart.setMaxValueLineCount(10);
chart.setFont("valueLabelFont", new Font("Arial", Font.BOLD, 11));
chart.setFont("rangeLabelFont", new Font("Arial", Font.BOLD, 12));
chart.setSampleHighlightOn(true);
chart.setSampleHighlightStyle(0, LineChart.SAMPLE_HIGHLIGHT_SQUARE, 25);
chart.setSampleHighlightStyle(1, LineChart.SAMPLE_HIGHLIGHT_CIRCLE_FILLED, 25);
chart.setSampleHighlightStyle(2, LineChart.SAMPLE_HIGHLIGHT_DIAMOND_OPAQUE, 23);
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();
}
}
|