<%@page import="SoftwareFX.ChartFX.*"%>
<%
ChartServer chart1 = new ChartServer(application,request,response );
chart1.setUserLegendBox(true);
UserLegendBoxItem userLegendBoxItem = chart1.getUserLegendBoxObj().getItem(0);
userLegendBoxItem.setLabel("Warning");
userLegendBoxItem.setColor(java.awt.Color.red);
userLegendBoxItem.setMarkerShape(MarkerShape.RECT);
userLegendBoxItem.setBorderEffect(BorderEffect.NONE);
userLegendBoxItem.getBorder().setColor(java.awt.Color.black);
userLegendBoxItem = chart1.getUserLegendBoxObj().getItem(1);
userLegendBoxItem.setLabel("Caution");
userLegendBoxItem.setColor(java.awt.Color.yellow);
userLegendBoxItem.setMarkerShape(MarkerShape.RECT);
userLegendBoxItem.setBorderEffect(BorderEffect.NONE);
userLegendBoxItem.getBorder().setColor(java.awt.Color.black);
userLegendBoxItem = chart1.getUserLegendBoxObj().getItem(2);
userLegendBoxItem.setLabel("Normal");
userLegendBoxItem.setColor(java.awt.Color.green);
userLegendBoxItem.setMarkerShape(MarkerShape.RECT);
userLegendBoxItem.setBorderEffect(BorderEffect.NONE);
userLegendBoxItem.getBorder().setColor(java.awt.Color.black);
java.util.Random r;
r = new java.util.Random(1);
chart1.openData(COD.VALUES, 1, 5);
PointAttributes redPoint = new PointAttributes(chart1);
PointAttributes greenPoint = new PointAttributes(chart1);
PointAttributes yellowPoint = new PointAttributes(chart1);
redPoint.setColor(java.awt.Color.red);
greenPoint.setColor(java.awt.Color.green);
yellowPoint.setColor(java.awt.Color.yellow);
for (int j=0;j<5;j++)
{
chart1.setValue(0, j,r.nextDouble()* 100);
if (chart1.getValue(0, j)>70)
chart1.setPoint(0, j, redPoint);
else
if (chart1.getValue(0, j)>40 & chart1.getValue(0, j)<70)
chart1.setPoint(0, j, yellowPoint);
else
chart1.setPoint(0, j, greenPoint);
}
chart1.closeData(COD.VALUES);
chart1.setBorderEffect(BorderEffect.NONE);
chart1.setBorderColor(java.awt.Color.black);
chart1.setSmoothFlags(chart1.getSmoothFlags() & SmoothFlags.TEXT);
chart1.getAxisY().getLabelsFormat().setDecimals(0);
ConstantLine constantLine = chart1.getConstantLine(0);
constantLine.setAxis(AxisItem.Y);
constantLine.setValue(40);
constantLine.setColor(java.awt.Color.yellow);
constantLine.setFlags(constantLine.getFlags() | ConstantFlag.BACK_ONLY);
constantLine.setWidth(3);
constantLine = chart1.getConstantLine(1);
constantLine.setAxis(AxisItem.Y);
constantLine.setValue(70);
constantLine.setColor(java.awt.Color.red);
constantLine.setFlags(constantLine.getFlags() | ConstantFlag.BACK_ONLY);
constantLine.setWidth(3);
chart1.getAxisX().setLabel(0, "Mon");
chart1.getAxisX().setLabel(1, "Tue");
chart1.getAxisX().setLabel(2, "Wed");
chart1.getAxisX().setLabel(3, "Thu");
chart1.getAxisX().setLabel(4, "Fri");
%>
<%=chart1.getHtmlTag("450","280")%>
|