echarts散点图,象限分析系列

var option = {
              title: [{
                text: '性格群体分析',
                subtext: '分析对象:XX区域',
                left: 'center',
                textStyle: {
                  fontSize: 16
                }
              }, {
                text: 'Ⅰ',
                z:1,
                textAlign: 'center',
                left: '75%',
                top: '25%',
                textStyle: {
                  fontSize: 36,
                  fontWeight:'normal',
                  color:'#999'
                }
              }, {
                text: 'Ⅱ',
                z:1,
                textAlign: 'center',
                left: '75%',
                top: '65%',
                textStyle: {
                  fontSize: 36,
                  fontWeight:'normal',
                  color:'#999'
                }
              }, {
                text: 'Ⅲ',
                z:1,
                textAlign: 'center',
                left: '25%',
                top: '65%',
                textStyle: {
                  fontSize: 36,
                  fontWeight:'normal',
                  color:'#999'
                }
              }, {
                text: 'Ⅳ',
                z:1,
                textAlign: 'center',
                left: '25%',
                top: '25%',
                textStyle: {
                  fontSize: 36,
                  fontWeight:'normal',
                  color:'#999'
                }
              }, 
              {
                text: '类型Ⅰ:性格外向开朗,愿意社交',
                textAlign: 'center',
                left: '94%',
                top: '20%',
                textStyle: {
                  fontSize: 14
                }
              }, 
              {
                text: '类型Ⅱ:性格内向,不喜欢社交',
                textAlign: 'center',
                left: '94%',
                top: '23%',
                textStyle: {
                  fontSize: 14
                }
              }, {
                text: '类型Ⅲ:怪异,不喜欢社交',
                textAlign: 'center',
                left: '94.4%',
                top: '26%',
                textStyle: {
                  fontSize: 14
                }
              }, {
                text: '类型Ⅳ:想法另类,喜欢社交',
                textAlign: 'center',
                left: '94.4%',
                top: '29%',
                textStyle: {
                  fontSize: 14
                }
              }
              ],
            grid: {
              top:'10%',
              left: '3%',
              right: '7%',
              bottom: '1%',
              containLabel: true
            },
          tooltip: {
            showDelay: 0,
            formatter: function(params) {
              if (params.value.length > 1) {
                return params.seriesName + ' :<br/>' + params.value[0] + 'cm ' + params.value[1] + 'kg ';
              }
            },
            axisPointer: {
              show: true,
              type: 'cross',
              lineStyle: {
                type: 'dashed',
                width: 1
              }
            }
          },
          toolbox: {
            feature: {
              dataZoom: {},
              brush: {
                type: ['']
              }
            }
          },
          legend: [
                {
                  orient: 'horizontal',
                  x: '89%',
                  y: '7%',
                  align: 'left',
                  data: ['正常性格'],
                  textStyle: {
                    fontSize: 14
                  }
                },
                {
                  orient: 'horizontal',
                  x: '94%',
                  y: '7%',
                  align: 'left',
                  data: ['离群性格'],
                  textStyle: {
                    fontSize: 14
                  }
                },
                {
                  orient: 'horizontal',
                  x: '89%',
                  y: '10%',
                  align: 'left',
                  data: ['性格中位数'],
                  textStyle: {
                    fontSize: 14
                  }
                },
                {
                  orient: 'horizontal',
                  x: '94%',
                  y: '10%',
                  align: 'left',
                  data: ['均分人数'],
                  textStyle: {
                    fontSize: 14
                  }
                }
          ],
          xAxis: [{
            type: 'value',
            name: "专注指数",
            scale: true,
            splitLine: {
              show: false
            }
          }],
          yAxis: [{
            type: 'value',
            scale: true,
            name: "人数",
            splitLine: {
              show: false
            }
          }],
    series : [
        {   
            name:'离群性格',
            z:3,
            type: 'effectScatter',
            symbolSize: 30,
             label: {
                normal: {
                    show: true,
                    formatter: function (param) {
                        return param.data[2];
                    },
                    position: 'insideTop'//版本3系列

           //**********   最新官网4系列版本    散点的突出点的文字样式部分 *************//

                    position: [35,5],
                    backgroundColor:'#19318F',
                    color:'#fff',
                    borderColor:'#19318F',
                    borderWidth:1,
                    borderRadius:2,
                    padding:[6,15]

          //**********   最新官网4系列版本  *************//
                }
            },
            itemStyle: {
              normal: {
                color: "#EF535C"
              }
            },
            data: [
                [190, 95,'墨菲斯'], [190, 59.0,'柠檬'],  [157.0, 63.0,'益达'],[162,90,'龙猫']
            ]
        },
        {
            name:'正常性格',
            z:3,
            type:'scatter',
            symbolSize: 25,
            itemStyle: {
              normal: {
                  color: '#6FE12F'      
              }
            },
            data: [[174.0, 65.6], [175.3, 71.8], [193.5, 80.7], [186.5, 72.6], [187.2, 78.8],
                [181.5, 74.8], [184.0, 86.4], [184.5, 78.4], [175.0, 62.0], [184.0, 81.6]
            ]
        },
        
        {
            name:'均分人数',
            type:'scatter',
            data: [[150, 78]],
            itemStyle:{
              normal: {
                color:'#8B4DF6'
              }
            },
            markLine : {
                data : [{type : 'average', name : '均分人数'}],
                labei:{
                    show:false
                }
            }
        },
        
        {
          name:'性格中位数',
            type:'scatter',
            data: [[175, 50]],
            itemStyle: {
              normal: {
                color: '#05D6DE'
              }
            },
            markLine : {
                data : [
                      {type : 'average', 
                      name : '性格中位数',
                      valueIndex: 0
                          
                    }
                ]
            }  
        }
    ]
  };



此图的版本基于3系列使用的,当前官网最新的4系列版本,有一些部分的样式有差异(中位线,以及分均线)
此段代码可直接复制运行与官网的模拟编辑器上,

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值