FusionCharts 생 성 보고서 응용

더 읽 기
1.전시 할 데 이 터 를 조립 해 야 합 니 다.데이터 모델 을 어떻게 디자인 하 는 지 보 여 주 려 는 도형 과 필요 한 데 이 터 를 보면 됩 니 다.간단 한 걸 로.
실체 류 는 두 개의 속성 만 있 고 Bean 안의 실체 류 도 사용 할 수 있 습 니 다.괜 찮 습 니 다.
package com.golden.entity;

public class Doughnut {

	public Doughnut() {
	}

	private String label;

	private int value;

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}

	public Doughnut(String label, int value) {
		super();
		this.label = label;
		this.value = value;
	}

}

 
2.Servlet 에 요청 을 하고 간단하게 사용 할 수도 있 고 Action 에 요청 할 수도 있 습 니 다.괜 찮 습 니 다.이 Servlet 는 나중에 데 이 터 를 얻어 요청 환경 에 설정 합 니 다.
package com.golden.servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.golden.entity.Doughnut;

@SuppressWarnings("serial")
public class FirstServlet extends HttpServlet {
	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		List list = new ArrayList();
		Doughnut d1 = new Doughnut("France", 17);
		Doughnut d2 = new Doughnut("India", 12);
		Doughnut d3 = new Doughnut("Brazil", 18);
		Doughnut d4 = new Doughnut("USA", 8);
		Doughnut d5 = new Doughnut("Australia", 10);
		Doughnut d6 = new Doughnut("Japan", 7);
		Doughnut d7 = new Doughnut("England", 5);
		Doughnut d8 = new Doughnut("Nigeria", 12);
		Doughnut d9 = new Doughnut("Italy", 8);
		Doughnut d10 = new Doughnut("China", 10);
		Doughnut d11 = new Doughnut("Canada", 19);
		Doughnut d12 = new Doughnut("Germany", 15);
		list.add(d1);
		list.add(d2);
		list.add(d3);
		list.add(d4);
		list.add(d5);
		list.add(d6);
		list.add(d7);
		list.add(d8);
		list.add(d9);
		list.add(d10);
		list.add(d11);
		list.add(d12);
		request.getSession().setAttribute("list", list);
		request.getRequestDispatcher("/show.jsp").forward(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}

}

 
3.설정,예 를 들 어 필요 한 Swf 파일 과 JS 파일 은 JSTL 이 필요 하기 때문에 가방 을 도입 하고 페이지 에 라벨 을 도입 하 며 저급한 작업 을 빨리 해결 해 야 합 니 다.
4.페이지 를 불 러 올 때 데이터 가 XML 파일 을 만 드 는 문자열 을 초기 화하 고 SWF 에 설정 하면 데 이 터 를 표시 하고 해결 합 니 다.







	
		
		FusionCharts      
		
		
		var majorXml;
		//var list;
		function init(){
			initXml();
		}
		function initXml(){
			majorXml="<chart palette='2' showBorder='1'>";
			majorXml += "<c:forEach var ='item' items='${list}'><set label='${item.label}' value='${item.value}'/></c:forEach>";
			majorXml+="</chart>";
			showDou3D();
		}
   		function showDou3D(){
	       var myChart=new FusionCharts("<%=request.getContextPath()%>/FusionCharts/Doughnut3D.swf", "ChartId", "600", "300", "0", "0");
	       myChart.setDataXML(majorXml);
	       myChart.render("majorbus");
	    }
		
	

	
		

 
5.파일 이 어디 에 있 는 지 모 르 겠 습 니 다.Webroot 에 js 와 Fusion Charts 폴 더 를 만 들 고 각각 근처에 넣 습 니 다.JSTL 이 없 는 LIB 에 있 습 니 다.
  • js.rar (4.5 KB)

  • 다운로드 횟수:495
  • FusionCharts.rar (57.2 KB)

  • 다운로드 횟수:556
  • lib.rar (390.2 KB)

  • 다운로드 횟수:797

    좋은 웹페이지 즐겨찾기