<%@ 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; // series double[] d1={150,254.1,74.15,125.45,654.2,85}; BarDataSerie data1= new BarDataSerie(d1,new FillStyle(GraphicsProvider.getColor("0xF0C0C0"))); data1.border=new LineStyle(1,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_NORMAL); data1.valueFont=GraphicsProvider.getFont("Arial",ChartFont.PLAIN,10); data1.borderType=data1.BORDER_RAISED; // legend Legend l=new Legend(); l.border=new LineStyle(1,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_NORMAL); l.addItem("Company A",new FillStyle(GraphicsProvider.getColor(ChartColor.CYAN))); l.addItem("Company B",new FillStyle(GraphicsProvider.getColor(ChartColor.GREEN))); // create title Title title=new Title("@font value='ARIAL|BOLD|14'@productA sales(2001)"); // 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.scale.min=0; YAxis.IntegerScale=true; YAxis.scale.min=0; XAxis.scaleTickInterval=100; XAxis.gridStyle=new LineStyle(1,GraphicsProvider.getColor("0xC0C0C0"),LineStyle.LINE_NORMAL);//define the grid type of xaxis //YAxis.gridStyle=new LineStyle(1,GraphicsProvider.getColor(ChartColor.WHITE),LineStyle.LINE_DOTS);//define the grid type of yaxis String[] lbls={"Japan","Korea","Singapore","Thailand","Malaysia","India"}; YAxis.tickLabels=lbls; HAxisLabel XLabel= new HAxisLabel("thousand $",GraphicsProvider.getColor(ChartColor.BLACK),GraphicsProvider.getFont("Arial",ChartFont.PLAIN,12)); VAxisLabel YLabel= new VAxisLabel("",GraphicsProvider.getColor(ChartColor.BLACK),GraphicsProvider.getFont("Arial",ChartFont.PLAIN,12)); YLabel.vertical=true; YAxis.axisFrame=true; XAxis.axisFrame=true; // plotter BarPlotter plot=new BarPlotter(); plot.verticalBars=false; //plot.interBarSpace=0; plot.back=new FillStyle(GraphicsProvider.getColor("0xFFDDDD")); // create report Chart chart=new Chart(title,plot,XAxis,YAxis); chart.XLabel=XLabel; chart.YLabel=YLabel; //chart.legend=l; chart.addSerie(data1); chart.back=new FillStyle(GraphicsProvider.getColor(ChartColor.WHITE)); chart.setSize(w,h); chart.saveToFile(outb,"jpeg"); outb.close(); %>