📄 barchart_jsp.java
字号:
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import org.apache.commons.logging.Log;
import java.io.IOException;
import org.apache.commons.logging.LogFactory;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultCategoryDataset;
import java.awt.Color;
import org.jfree.chart.renderer.category.BarRenderer3D;
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.plot.CategoryPlot;
public final class barchart_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.List _jspx_dependants;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.AnnotationProcessor _jsp_annotationprocessor;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
}
public void _jspDestroy() {
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\n");
out.write(" \n");
out.write(" \n");
out.write(" \n");
out.write(" \n");
out.write("\n");
out.write(" \n");
out.write(" \n");
out.write(" \n");
out.write(" \n");
out.write(" \n");
out.write(" \n");
out.write(" \n");
out.write("\n");
out.write(" \n");
out.write(" \n");
out.write(" \n");
out.write(" \n");
out.write(" \n");
out.write("\n");
DefaultCategoryDataset dataset = new DefaultCategoryDataset();dataset.addValue( 150 , " A " , " ?? " );dataset.addValue( 530 , " B " , " ?? " );dataset.addValue( 160 , " C " , " ?? " );dataset.addValue( 160 , " D " , " ?? " );dataset.addValue( 160 , " E " , " ?? " );//dataset.addValue( 120 , " ?? " , " ?? " );//dataset.addValue( 230 , " ?? " , " ?? " );//dataset.addValue( 360 , " ?? " , " ?? " );//dataset.addValue( 600 , " ?? " , " ?? " );//dataset.addValue( 430 , " ?? " , " ?? " );//dataset.addValue( 560 , " ?? " , " ?? " );//dataset.addValue( 400 , " ?? " , " ?? " );//dataset.addValue( 530 , " ?? " , " ?? " );//dataset.addValue( 660 , " ?? " , " ?? " );//dataset.addValue( 500 , " ?? " , " ?? " );//dataset.addValue( 630 , " ?? " , " ?? " );//dataset.addValue( 430 , " ?? " , " ?? " );//dataset.addValue( 500 , " ?? " , " ?? " );//dataset.addValue( 630 , " ?? " , " ?? " );//dataset.addValue( 430 , " ?? " , " ?? " );JFreeChart chart = ChartFactory.createBarChart3D( " ???????-By Alpha " , " ????-http://www.blogjava.net/Alpha/ " , " ?? " ,dataset,PlotOrientation.VERTICAL, true , false , false );chart.setBackgroundPaint(Color.WHITE);CategoryPlot plot = chart.getCategoryPlot();CategoryAxis domainAxis = plot.getDomainAxis();// domainAxis.setVerticalCategoryLabels( false );plot.setDomainAxis(domainAxis);BarRenderer3D renderer = new BarRenderer3D();renderer.setBaseOutlinePaint(Color.BLACK);// ??????????????????renderer.setItemMargin( 0.1 );// ????????????????????renderer.setItemLabelGenerator( new StandardCategoryItemLabelGenerator());renderer.setItemLabelsVisible( true );plot.setRenderer(renderer);//???????plot.setForegroundAlpha( 0.8f);ChartUtilities.writeChartAsJPEG(response.getOutputStream(),chart, 640 , 400 );
out.write(' ');
out.write('\n');
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -