Integrate JFreechart and Structs in the simplest way and modify the background color

Source: Internet
Author: User

Gantt Chart JPEG format



Step 3: Configure structs. xml

Because we need to integrate JFreechart and structs, We need to configure action in structs. xml.

<! DOCTYPE struts PUBLIC "-// Apache Software Foundation // DTD Struts Configuration 2.1 // EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<Struts>
<! -- Allow static methods -->
<Constant name = "struts. ognl. allowStaticMethodAccess" value = "true"> </constant>
<! -- Chinese -->
<Constant name = "struts. i18n. encoding" value = "gbk"/>
<Package name = "QQ" extends = "jfreechart-default">
<Action name = "jfreechart" class = "com. softeem. action. JfreeCharAction"> <! -- Configure the action used on the page -->
<Result name = "success" type = "chart">
<Param name = "width"> 600 </param>
& Lt; param name = "height" & gt; 400 & lt;/param & gt;
</Result>
</Action>
<Action name = "jfreechart1" class = "com. softeem. action. QQ_Count_Action">
<Result name = "success" type = "chart">
<Param name = "width"> 600 </param>
& Lt; param name = "height" & gt; 400 & lt;/param & gt;
</Result>
</Action>
<Action name = "jfreechart2" class = "com. softeem. action. JfreeCharAction">
<Result name = "success" type = "chart">
<Param name = "width"> 600 </param>
& Lt; param name = "height" & gt; 400 & lt;/param & gt;
</Result>
</Action>
<Action name = "jfreechart3" class = "com. softeem. action. JfreeCharAction">
<Result name = "success" type = "chart">
<Param name = "width"> 600 </param>
& Lt; param name = "height" & gt; 400 & lt;/param & gt;
</Result>
</Action>
<Action name = "jfreechart4" class = "com. softeem. action. JfreeCharAction">
<Result name = "success" type = "chart">
<Param name = "width"> 600 </param>
& Lt; param name = "height" & gt; 400 & lt;/param & gt;
</Result>
</Action>
</Package>
</Struts>




Chart. setBackgroundPaint (ChartColor. WHITE );
// Set the title Color
Chart. getTitle (). setPaint (ChartColor. blue );
// Obtain the chart object
CategoryPlot p = chart. getCategoryPlot ();
// Set the background color of the image. This is the background color of the second layer, that is, the color of the border around the image.
P. setBackgroundPaint (ChartColor. WHITE );
// Set the table line color
P. setRangeGridlinePaint (ChartColor. red );


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.