
themeprimary = getThemeColorFromCss('themeprimary');
themesecondary = getThemeColorFromCss('themesecondary');
themethirdcolor = getThemeColorFromCss('themethirdcolor');
themefourthcolor = getThemeColorFromCss('themefourthcolor');
themefifthcolor = getThemeColorFromCss('themefifthcolor');

var InitiateDonutChart = function() {

	return {
		init : function(datas, color, firstLinef) {

			var Donut = Morris.Donut({
				element : 'fundContain_pie_body',
				data : datas,
				colors : color,
				formatter : function(y) {
					return "￥" + format(y)
				}
			});

			Donut.handlers = Donut.handlers || {};
			Donut.handlers.click = Donut.handlers.click || [];
			Donut.handlers.click.push(function(arg, arg1) {

				/*var firstLine = document.getElementById("first_line");
				var firstLines = firstLine.childNodes;
				for (var i = firstLines.length - 1; i >= 0; i--) {
					firstLine.removeChild(firstLines[i]);
				}*/
				$("#first_line").empty();
				/* arguments; */
				
				firstLinef(arg1);
			});
			firstLinef(arguments[0][0]);
		}
	};
}();

var InitiateAreaChart = function() {
	return {
		init : function(data, color) {
			
			$("#first_line").unbind("click");
			$("#first_line").bind("click");
			if(data.length > 1)
			{
				for(var i=0;i<data.length;i++){
					if(data[i].category!=null&&data[i].category!=""){
						$("#account_first_title_info").html(data[i].category);
					}
				}
			}
			else
			{
				$("#account_first_title_info").html(data[0].category);
			}
			$("#account_first_title_color").css("background", color);
			var Donut1 = Morris.Area({
				element : 'first_line',
				data : data,
				xkey : 'period',
				ykeys : [ 'balance' ],
				labels : [ '金额' ],
				pointSize : 2,
				hideHover : 'auto',
				lineColors : [ color ],
				parseTime : false
			});
			
			Donut1.handlers = Donut1.handlers || {};
			Donut1.handlers.click = Donut1.handlers.click || [];
			Donut1.handlers.click.push(function(arg, arg1) {
				
				accountLineInfoQuery(arg1);

			});
			
		}
	};
}();

 /*InitiateAreaChart.init();
 InitiateDonutChart.init();*/