/**
 * プロジェクト名 laxCRUDService
 * クラス名 ChartData.java
 * 作成日: 2007/10/02
 * 
 */
package jp.co.lax.sample.service;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class ChartDataMapUtil {
	private HashMap dataMap = new HashMap();

	public void setChartDataMap(final String key, final String value) {
		this.dataMap.put(key, value);
	}

	public String generateJsonData() {
		String jsonData = "{";
		String kanma = "";
		Set set = dataMap.keySet();
		Iterator iterator = set.iterator();
		int i = 0;
		
		while (iterator.hasNext()){
			if (i != 0) {
				kanma = ",";
			}
			String key = (String)iterator.next();
			jsonData =jsonData + kanma +key + ":"+(String)dataMap.get(key);
			i++;
		}
		jsonData = jsonData + "}";
		return jsonData;
	}
	
	public Map getChartDataMap(){
		return this.dataMap;
	}
}
