散佈圖時序圖甘特圖JPEG格式
第三步,配置structs.xml 由於我們需要把JFreechart和structs整合,所以需要在structs.xml中配置action。
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<!-- 允許使用靜態方法 -->
<constant name="struts.ognl.allowStaticMethodAccess" value="true"></constant>
<!-- 中文問題 -->
<constant name="struts.i18n.encoding" value="gbk" />
<package name="QQ" extends="jfreechart-default">
<action name="jfreechart" class="com.softeem.action.JfreeCharAction"> <!-- 配置頁面中使用的action -->
<result name="success" type="chart">
<param name="width">600</param>
<param name="height">400</param>
</result>
</action>
<action name="jfreechart1" class="com.softeem.action.QQ_Count_Action">
<result name="success" type="chart">
<param name="width">600</param>
<param name="height">400</param>
</result>
</action>
<action name="jfreechart2" class="com.softeem.action.JfreeCharAction">
<result name="success" type="chart">
<param name="width">600</param>
<param name="height">400</param>
</result>
</action>
<action name="jfreechart3" class="com.softeem.action.JfreeCharAction">
<result name="success" type="chart">
<param name="width">600</param>
<param name="height">400</param>
</result>
</action>
<action name="jfreechart4" class="com.softeem.action.JfreeCharAction">
<result name="success" type="chart">
<param name="width">600</param>
<param name="height">400</param>
</result>
</action>
</package>
</struts>
chart.setBackgroundPaint(ChartColor.WHITE);
// 設定標題顏色
chart.getTitle().setPaint(ChartColor.blue);
// 獲得圖表對象
CategoryPlot p = chart.getCategoryPlot();
// 設定圖的背景顏色,這是出於第二層的背景顏色,也就是映像周圍邊框的顏色
p.setBackgroundPaint(ChartColor.WHITE);
// 設定表格線顏色
p.setRangeGridlinePaint(ChartColor.red);