问题描述
jfreeChart标题怎么分行啊?而且第一行的字体要求比其他行大。另外散布图怎么让数据点加上不同的说明内容呢?
解决方案
解决方案二:
还有个问题,纵坐标轴的标题中的每个字能正过来么?就是每个字都顺时针转90度
解决方案三:
来个高手阿,新人没有点数。。。痛苦
解决方案四:
纵坐标轴的标题中的每个字能正过来么?好像不能吧,我也想这样做,不过没找到这方面的资料。至于你其他问题我就不知道了。
解决方案五:
<%@pagecontentType="text/html;charset=utf-8"%><%@pageimport="org.jfree.data.general.DefaultPieDataset"%><%@pageimport="org.jfree.chart.*"%><%@pageimport="org.jfree.chart.plot.*"%><%@pageimport="org.jfree.chart.servlet.ServletUtilities"%><%@pageimport="org.jfree.chart.labels.StandardPieToolTipGenerator"%><%@pageimport="org.jfree.chart.urls.StandardPieURLGenerator"%><%@pageimport="org.jfree.chart.entity.StandardEntityCollection"%><%@pageimport="java.io.*"%><HTML><HEAD><METAhttp-equiv=Content-Typecontent="text/html;charset=utf-8"><TITLE>demo</TITLE></HEAD><BODY><%//设置输出编码格式response.setContentType("text/html;charset=UTF-8");DefaultPieDatasetdata=newDefaultPieDataset();data.setValue("高中以下",1370);data.setValue("高中",1530);data.setValue("大专",5700);data.setValue("本科",8280);data.setValue("硕士",4420);data.setValue("博士",180);PiePlot3Dplot=newPiePlot3D(data);//3D饼图//生成2D--chart物件//PiePlotplot=newPiePlot(data);plot.setURLGenerator(newStandardPieURLGenerator("view.jsp"));//设定链接JFreeChartchart=newJFreeChart("",JFreeChart.DEFAULT_TITLE_FONT,plot,true);chart.setBackgroundPaint(java.awt.Color.white);//可选,设置图片背景色chart.setTitle("程序员学历情况调查表");//可选,设置图片标题plot.setToolTipGenerator(newStandardPieToolTipGenerator());StandardEntityCollectionsec=newStandardEntityCollection();ChartRenderingInfoinfo=newChartRenderingInfo(sec);PrintWriterw=newPrintWriter(out);//输出MAP信息//500是图片长度,300是图片高度Stringfilename=ServletUtilities.saveChartAsPNG(chart,500,300,info,session);ChartUtilities.writeImageMap(w,"map0",info,false);StringgraphURL=request.getContextPath()+"/servlet/DisplayChart?filename="+filename;%><PALIGN="CENTER"><imgsrc="<%=graphURL%>"width=500height=300border=0usemap="#map0"></P></BODY></HTML>
解决方案六:
<HTML><HEAD><METAhttp-equiv=Content-Typecontent="text/html;charset=utf-8"><TITLE>demo2</TITLE></HEAD><body><%@pagecontentType="text/html;charset=GBK"%><%@pageimport="org.jfree.chart.ChartFactory,org.jfree.chart.JFreeChart,org.jfree.chart.plot.PlotOrientation,org.jfree.chart.servlet.ServletUtilities,org.jfree.data.category.*"%><%//设置输出编码格式response.setContentType("text/html;charset=UTF-8");CategoryDatasetdataset;Stringcategory=request.getParameter("category");category=newString(category.getBytes("iso-8859-1"),"utf-8");//System.out.println(category);if(category.equals("本科")||category.equals("高中")||category.equals("大专")){dataset=getDataSet();}elseif(category.equals("硕士")||category.equals("博士")){dataset=getDataSet2();}else{dataset=getDataSet3();}Stringtitle=category+"程序员在各城市薪金情况统计";JFreeChartchart=ChartFactory.createBarChart3D(title,"城市","薪金",dataset,PlotOrientation.VERTICAL,true,false,false);Stringfilename=ServletUtilities.saveChartAsPNG(chart,500,300,null,session);StringgraphURL=request.getContextPath()+"/servlet/DisplayChart?filename="+filename;%><PALIGN="CENTER"><imgsrc="<%=graphURL%>"width=500height=300border=0usemap="#<%=filename%>"></P><%!privatestaticCategoryDatasetgetDataSet(){DefaultCategoryDatasetdataset=newDefaultCategoryDataset();dataset.addValue(2000,"北京","VB");dataset.addValue(1800,"上海","VB");dataset.addValue(2200,"广州","VB");dataset.addValue(3200,"北京","JAVA");dataset.addValue(3500,"上海","JAVA");dataset.addValue(3600,"广州","JAVA");dataset.addValue(3300,"北京","DOTNET");dataset.addValue(3400,"上海","DOTNET");dataset.addValue(3700,"广州","DOTNET");dataset.addValue(2500,"北京","DELPHI");dataset.addValue(2800,"上海","DELPHI");dataset.addValue(3200,"广州","DELPHI");dataset.addValue(5000,"北京","VC");dataset.addValue(3500,"上海","VC");dataset.addValue(4600,"广州","VC");returndataset;}privatestaticCategoryDatasetgetDataSet2(){DefaultCategoryDatasetdataset=newDefaultCategoryDataset();dataset.addValue(2000,"上海","VB");dataset.addValue(3000,"北京","JAVA");dataset.addValue(3330,"上海","JAVA");dataset.addValue(3500,"广州","JAVA");dataset.addValue(3500,"北京","DOTNET");dataset.addValue(4000,"上海","DOTNET");dataset.addValue(4800,"广州","DOTNET");dataset.addValue(2600,"北京","DELPHI");dataset.addValue(2200,"上海","DELPHI");dataset.addValue(4000,"北京","VC");dataset.addValue(4000,"上海","VC");dataset.addValue(4200,"广州","VC");returndataset;}privatestaticCategoryDatasetgetDataSet3(){DefaultCategoryDatasetdataset=newDefaultCategoryDataset();dataset.addValue(2100,"北京","VB");dataset.addValue(2200,"上海","VB");dataset.addValue(2100,"广州","VB");dataset.addValue(3000,"北京","JAVA");dataset.addValue(3200,"上海","JAVA");dataset.addValue(3600,"广州","JAVA");dataset.addValue(4100,"北京","DOTNET");dataset.addValue(4200,"上海","DOTNET");dataset.addValue(4160,"广州","DOTNET");dataset.addValue(2400,"北京","DELPHI");dataset.addValue(2600,"上海","DELPHI");dataset.addValue(2500,"广州","DELPHI");dataset.addValue(5400,"北京","VC");dataset.addValue(5000,"上海","VC");dataset.addValue(5500,"广州","VC");returndataset;}%></body></html>
解决方案七:
引用3楼van_bo11的回复:
纵坐标轴的标题中的每个字能正过来么?好像不能吧,我也想这样做,不过没找到这方面的资料。至于你其他问题我就不知道了。
谢谢,标题分行问题已经找到其中的方法了,Title.addSubTilte("第二行"),好像是这个方法解决的,纵坐标怎么旋转呢....