console
// 路径配置
require.config({
paths: {
echarts: 'http://echarts.baidu.com/build/dist'
}
});
// 使用
require(['echarts', 'echarts/chart/scatter' //
], function(ec) {
// 基于准备好的dom,初始化echarts图表
var myChart = ec.init(document.getElementById('main'));
var wcrws1 = [
[572,757,'辣妈萌宝团'],
[566, 330, '美丽心情SING'], [534, 150, '豆包兔'], {
value: [515, 148, '父母世界'],
itemStyle: {
normal: {
color: '#b83249',
label: {
show: true,
position: 'top',
formatter: function(params) {
return params.value[2]
}
}
}
}
},
[490, 139, '生活好物攻略'], [488, 99, '喵喵购'], [530, 91, '逗玩'], [522, 88, '爸妈堂育儿'], [526, 83, '暴走的买买兔'], [506, 69, '妈咪宝宝小助手'], [304, 66, '辣妈潮宝汇'], [456, 65, '陪你一起'], [461, 64, '拜托了妈妈'], [428, 51, '糖醋雁子'], [324, 49, '棒妈经验谈'], [261, 45, '贝爱妈咪'], [476, 40, '点点的美好生活'], [480, 38, '宝妈说'], [371, 37, '家有三宝达人'], [435, 35, '冯尼美']];
var option = {
title: {
text: '',
left: 'center',
top: 20
},
tooltip: {
show: true
},
xAxis: {
name: '综合能力',
nameTextStyle: {
fontWeight: 'bold',
fontSize: 15
},
type: 'value',
scale: true,
min: 200,
max: 580,
offset: -180,
axisLabel: {
show: true,
inside: true
},
splitLine: {
show: false
},
axisLine: {
lineStyle: {
color: '#3259B8'
}
}
},
yAxis: [{
name: '任务完成数',
nameTextStyle: {
fontWeight: 'bold',
fontSize: 15
},
type: 'value',
scale: true,
offset: -260,
axisLabel: {
formatter: '{value} '
},
splitLine: {
show: false
},
axisLine: {
lineStyle: {
color: '#3259B8'
}
}
}],
grid: {
x: '10%',
y: '13%',
width: '78%',
height: '68%',
borderColor:'transparent'
},
series: [{
type: 'scatter',
data: wcrws1,
symbolSize: 4,
itemStyle: {
normal: {
color: '#192c5c',
/* label: {
show: true,
position: 'top',
formatter: function(params) {
return params.value[2]
}
}
*/
}
},
markLine: {
show: true,
itemStyle: {
normal: {
color: '#59b832',
lineStyle: {
color: '#59b832',
type: 'solid'
}
}
},
data: [{
type: 'average',
name: '平均值',
valueIndex: 0
},
{
type: 'average',
name: '平均值',
valueIndex: 1
}]
}
}]
};
// 为echarts对象加载数据
myChart.setOption(option);
});
<script src="http://echarts.baidu.com/build/dist/echarts.js">
</script>
<div id="main" style="height:400px">
</div>