FusionCharts封装-单系列图组合

时间:2021-01-23 11:54:19

ChartAction.java:

/**
 * @Title:ChartAction.java
 * @Package:com.fusionchart.action
 * @Description:单系列图组合
 * @author:Youhaidong(游海东)
 * @date:2014-1-23 下午10:48:31
 * @version V1.0
 */
package com.fusionchart.action;

import java.util.ArrayList;
import java.util.List;

import com.fusionchart.model.ColumnChart;
import com.opensymphony.xwork2.ActionSupport;

/**
 * 类功能说明
 * 类修改者 修改日期
 * 修改说明
 * <p>Title:ChartAction.java</p>
 * <p>Description:游海东个人开发</p>
 * <p>Copyright:Copyright(c)2013</p>
 * @author:游海东
 * @date:2014-1-23 下午10:48:31
 * @version V1.0
 */
public class ChartAction extends ActionSupport
{
	/**
	 * @Fields  serialVersionUID:序列号
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * list
	 */
	private List<ColumnChart> list = new ArrayList<ColumnChart>();

	/* (non-Javadoc)
	 * <p>Title:execute</p>
	 * <p>Description:</p>
	 * @return
	 * @throws Exception
	 * @see com.opensymphony.xwork2.ActionSupport#execute()
	 */
	@Override
	public String execute() throws Exception
	{
		buildChart();
		return SUCCESS;
	}

	/**
	 *
	 * @Title:buildChart
	 * @Description:形成柱形图
	 * @param:@return
	 * @return:String
	 * @throws
	 */
	@SuppressWarnings("null")
	public List<ColumnChart> buildChart()
	{
		List<ColumnChart> list = new ArrayList<ColumnChart>();
		ColumnChart columnChart = null;
		for(int i=1;i<=12;i++)
		{
			columnChart.setLabel(i + "月");
			columnChart.setValue(Math.random()*100 + "");
			list.add(columnChart);
		}
		return list;
	}

	/**
	 * @return the list
	 */
	public List<ColumnChart> getList() {
		return list;
	}

	/**
	 * @param list the list to set
	 */
	public void setList(List<ColumnChart> list) {
		this.list = list;
	}

}