demo.html 2.2 KB
<div id="radarchart" class="page out" data-title="雷达图插件">
	<div id="radarchart-header"></div>
	<div id="radarchart-a"></div>
    <div id="radarchart-b"></div>
</div>
<script>
require(["NavHeader", "RadarChart"], function(NavHeader, RadarChart) {
	var _u = require("mUtil");
	var hasClsPicker = typeof clsPicker !== "undefined";
	if(!hasClsPicker) {
		new NavHeader({
			el: "radarchart-header",
			option: {
				title:"雷达图插件", 
				smallTitle:"radarchart"
			}
		}).render();
	}
	new RadarChart({
		el: "radarchart-a",
		option: {
			data: [
				{ "name": "销售", "预算分配": "4300", "实际开销": "5000", "max": "6500"},
				{ "name": "管理", "预算分配": "10000", "实际开销": "14000", "max": "16000"},
				{ "name": "信息技术", "预算分配": "28000", "实际开销": "28000", "max": "30000"},
				{ "name": "客服", "预算分配": "35000", "实际开销": "31000", "max": "38000"},
				{ "name": "研发", "预算分配": "50000", "实际开销": "42000", "max": "52000"},
				{ "name": "市场", "预算分配": "19000", "实际开销": "21000", "max": "25000"}
			],//图表数据
			height: 400,//图表高度
			title: {
				show: true,
				text: "基础雷达图"//标题
			},
			radar: {
				center: ["50%", "50%"],	//中心点坐标
	            radius: "50%",			//雷达图半径
	            shape: "polygon"			//图形形状  polygon 多边形 circle 圆形
			},
			legend: {
				show: true,//是否显示图例
				bottom: 10,//图例底部边距
				textStyle: {
					color: "#333"//字体颜色
				}
			},
			color: "#c23531,#2f4554,#61a0a8,#d48265,#91c7ae,#749f83,#ca8622,#bda29a,#6e7074,#546570,#c4ccd3",//颜色,默认
			click: function (params) {
				var url = "/mobilemode/mobile/demo/plugin/NewChart/detail.html?name=" + params.name + "&seriesname=" + params.seriesName + "&value=" + params.value;
				//$u(url, true);
			}
		}
	}).render().then(function(){
		if (!hasClsPicker) return;
		_u.vetically("#radarchart-a");
		clsPicker.golalSetting({
			container: "#radarchart-a",
			type: "Radarchart"
		});
		new clsPicker({
			selector: ".wev-chart-container",
			text: ".wev-chart-container",
			skew: [10, 9],
			lineYSkew: 30,
			position: "bottom right"
		});
	});
});
</script>