Circular Gauge Chart
Applet code:
<applet code=com.objectplanet.chart.ChartApplet
archive=chart.ext.jar width=450 height=300>
<param name=chart value=gauge>
<param name=startAngle value=40>
<param name=endAngle value=320>
<param name=range value=300>
<param name=lowerRange value=0>
<param name=pointer value=0,#708caa>
<param name=rangeLabelsOn value=true>
<param name=rangeLabelFont value=Helvetica,bold,12>
<param name=chartBackground value="#efe7ef">
<param name=background value="#ffefc6">
<param name=foreground value="#dc072a">
<param name=chartForeground value="#dc072a">
<param name=border_0 value=4,black>
<param name=border_1 value=2,#a0b9d2>
<param name=border_2 value=1,black>
<param name=border_3 value=25,#b5cec6>
<param name=border_4 value=1,black>
</applet>
Servlet code:
<img src="http://localhost:8080/servlet/com.objectplanet.chart.ChartServlet?
chart=gauge&
width=450&
height=300&
startAngle=40&
endAngle=320&
range=300&
lowerRange=0&
pointer=0,%23708caa&
rangeLabelsOn=true&
rangeLabelFont=Helvetica,bold,12&
chartBackground=%23efe7ef&
background=%23ffefc6&
foreground=%23dc072a&
chartForeground=%23dc072a&
border_0=4,black&
border_1=2,%23a0b9d2&
border_2=1,black&
border_3=25,%23b5cec6&
border_4=1,black">
Application code:
package com.objectplanet.chart.testing;
import com.objectplanet.chart.ext.*;
import java.awt.*;
public class Gauge {
public static void main(String[] argv) {
GaugeChart chart = new GaugeChart();
chart.setStartAngle(40);
chart.setEndAngle(320);
chart.setRange(300);
chart.setLowerRange(0);
chart.setRangeLabelsOn(0, true);
chart.setFont("rangeLabelFont", new Font("Helvetica", Font.BOLD, 12));
chart.setPointer(0, 0);
chart.setPointerColor(0, new Color(0x708caa));
hart.setBorder(0, 4);
chart.setBorder(1, 2);
chart.setBorder(2, 1);
chart.setBorder(3, 25);
chart.setBorder(4, 1);
chart.setBorderColor(0, Color.black);
chart.setBorderColor(1, new Color(0xa0b9d2));
chart.setBorderColor(2, Color.black);
chart.setBorderColor(3, new Color(0xb5cec6));
chart.setBorderColor(4, Color.black);
chart.setChartBackground(new Color(0xefe7ef));
chart.setChartForeground(new Color(0xdc072a));
chart.setBackground(new Color(0xffefc6));
hart.setForeground(new Color(0xdc072a));
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(470, 300);
f.show();
}
}
|