Highlighting Plots Using Images
Applet code:
<applet code=com.objectplanet.chart.ChartApplet
archive=chart.ext.jar width=450 height=300>
<param name=chart value=plotter>
<param name=seriesCount value=3>
<param name=plots_0 value=-35|-3,-4|-40,5|40,20|-20>
<param name=plots_1 value=-25|-40,10|20,30|-35>
<param name=plots_2 value=-25|30,-15|-10,24|1,55|-40>
<param name=rangeOn value=top,left,bottom,right>
<param name=XUpperRange value=50>
<param name=YupperRange value=60>
<param name=XLowerRange value=-50>
<param name=YLowerRange value=-60>
<param name=plotImage_0 value=images\sun.gif>
<param name=plotImage_1 value=images\radio-blue.gif>
<param name=plotImage_2 value=images\radio-green.gif>
<param name=background value=white>
</applet>
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[][] {{-35,-3},{-4,-40},{5,40},{20,-20}};
double[][] plots_1 = new double[][] {{-25,-40},{10,20},{30,-35}};
double[][] plots_2 = new double[][] {{25,30},{-15,-10},{24,1},{55,-40}};
Color[] seriesColors = new Color[] {new Color(0xDE9C73), new Color(0xB59C39), new Color(0xD6A5CE)};
PlotterChart chart = new PlotterChart();
chart.setSeriesCount(3);
chart.setPlots(0, plots_0);
chart.setPlots(1, plots_1);
chart.setPlots(2, plots_2);
chart.setRangeOn(PlotterChart.TOP, true);
chart.setRangeOn(PlotterChart.RIGHT, true);
chart.setXUpperRange(50);
chart.setXLowerRange(-50);
chart.setYUpperRange(60);
chart.setYLowerRange(-60);
chart.setBackground(Color.white);
Image image = chart.loadImage("images\\sun.gif");
chart.addImage("sun", image);
image = chart.loadImage("images\\radio-blue.gif");
chart.addImage("radio-blue", image);
image = chart.loadImage("images\\radio-green.gif");
chart.addImage("radio-green", image);
chart.setPlotImage(0, "sun");
chart.setPlotImage(1, "radio-blue");
chart.setPlotImage(2, "radio-green");
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();
}
}
|