<%@ page import = "net.comrom.chart.*" %> <%@ page import = "net.comrom.chart.gc.*" %> <% String encode="jpeg"; //String uri=request.getRequestURI(); //String myurl="http://"+request.getHeader("Host")+uri.substring(0,uri.length()-12); //12 ist the length of my page name response.setContentType("image/jpeg"); response.setDateHeader ("Expires",0); // get output stream java.io.OutputStream outb=response.getOutputStream(); // size of the chart image int w=580; int h=350; // data double[] d1={20,52.1,85.2,125.2,112,251,542.2}; LineDataSerie data1= new LineDataSerie(d1,new LineStyle(1f,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_DOTS)); data1.valueFont=GraphicsProvider.getFont("Arial",ChartFont.BOLD,10); data1.valueColor=GraphicsProvider.getColor(ChartColor.BLUE); data1.valueFont=GraphicsProvider.getFont("Arial",ChartFont.BOLD,10); // create title Title title=new Title("the Output Amount of ProductA(1995-2001)"); title.color=GraphicsProvider.getColor(ChartColor.BLACK); // create axis Axis XAxis=new Axis(Axis.HORIZONTAL,new Scale()); Axis YAxis=new Axis(Axis.VERTICAL,new Scale()); XAxis.tickAtBase=true; // draw also first tick XAxis.ceroAxis=Axis.CEROAXIS_NO; YAxis.ceroAxis=Axis.CEROAXIS_NO; YAxis.scale.min=0; YAxis.DescColor=GraphicsProvider.getColor(ChartColor.BLACK); YAxis.scaleTickInterval=100; XAxis.scaleTickInterval=1; XAxis.bigTickInterval=1; XAxis.DescColor=GraphicsProvider.getColor(ChartColor.BLACK); String[] lbls={"1995","1996.","1997","1998","1999","2000","2001"}; XAxis.tickLabels=lbls; XAxis.style =new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_NORMAL); YAxis.style =new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_NORMAL); YAxis.gridStyle=new LineStyle(1,GraphicsProvider.getColor("0xC0C0C0"),LineStyle.LINE_NORMAL); XAxis.gridStyle=new LineStyle(1,GraphicsProvider.getColor("0xC0C0C0"),LineStyle.LINE_NORMAL); XAxis.axisFrame=true; YAxis.axisFrame=true; HAxisLabel XLabel= new HAxisLabel("Year",GraphicsProvider.getColor(ChartColor.BLACK),GraphicsProvider.getFont("Arial",ChartFont.ITALIC,12)); VAxisLabel YLabel= new VAxisLabel("thousand",GraphicsProvider.getColor(ChartColor.BLACK),GraphicsProvider.getFont("Arial",ChartFont.ITALIC,12)); // plotter LinePlotter plot=new LinePlotter(); // create chart Chart chart=new Chart(title,plot,XAxis,YAxis); chart.XLabel=XLabel; chart.YLabel=YLabel; chart.addSerie(data1); chart.back=new FillStyle(GraphicsProvider.getColor(ChartColor.WHITE)); chart.setSize(w,h); chart.saveToFile(outb,"jpeg"); outb.close(); %>