demo.html 1.82 KB
<div id="funnelchart" class="page out" data-title="漏斗图插件">
	<div id="funnelchart-header"></div>
	<div id="funnelchart-a"></div>
    <div id="funnelchart-b"></div>
</div>
<script>
require(["NavHeader", "FunnelChart"], function(NavHeader, FunnelChart) {
	var _u = require("mUtil");
	var hasClsPicker = typeof clsPicker !== "undefined";
	if(!hasClsPicker) {
		new NavHeader({
			el: "funnelchart-header",
			option: {
				title:"漏斗图插件", 
				smallTitle:"funnelchart"
			}
		}).render();
	}
	new FunnelChart({
		el: "funnelchart-a",
		option: {
			data : [
			 	{"name":"直接访问","value":"335"},
			 	{"name":"邮件营销","value":"310"},
			 	{"name":"联盟广告","value":"234"},
			 	{"name":"视频广告","value":"350"},
			 	{"name":"搜索引擎","value":"548"}
			],//图表数据来源
			height : 400,//图表高度
			title : {
				show : true,
				text : "某站点用户访问来源",//标题
				subtext: "纯属虚构"//副标题
			},
			series : {
				top : "15%",
				left : "15%",
				height : "85%",
				width : "70%",
				sort : "descending" //descending 降序  ascending 升序  none按数据排序
			},
			label : {
				fontSize : 12
			},
			color:"#c23531,#2f4554,#61a0a8,#d48265,#91c7ae,#749f83,#ca8622,#bda29a,#6e7074,#546570,#c4ccd3",//颜色,默认
			click : function(params){
				var url = "/mobilemode/mobile/demo/plugin/NewChart/detail.html?ajax=true&name="+params.name+"&seriesname="+params.seriesName+"&value="+params.value;
				$u(url);
			}
		}
	}).render().then(function(){
		if (!hasClsPicker) return;
		_u.vetically("#funnelchart-a");
		clsPicker.golalSetting({
			container: "#funnelchart-a",
			type: "Funnelchart"
		});
		new clsPicker({
			selector: ".wev-chart-container",
			text: ".wev-chart-container",
			skew: [10, 9],
			lineYSkew: 30,
			position: "bottom right"
		});
	});
});
</script>