amis 词云

{
  "type": "page",
  "body": [
    {
      "type": "service",
      "id": "u:df370d1eb27a",
      "body": [
        {
          "type": "custom",
          "html": "<div id=\"myEchart\" style=\"width:500px;height:500px\"></div>",
          "onMount": "",
          "id": "u:7e33675cd102"
        }
      ],
      "messages": {
      },
      "onEvent": {
        "fetchInited": {
          "weight": 0,
          "actions": [
            {
              "actionType": "custom",
              "script": "const chart = echarts.init(document.getElementById('myEchart'));\nconsole.log(2222222)\nconst originData = [{ \"name\": \"男神\", \"value\": 2.64 },\n{ \"name\": \"好身材\", \"value\": 4.03 },\n{ \"name\": \"校草\", \"value\": 24.95 },\n{ \"name\": \"酷\", \"value\": 4.04 },\n{ \"name\": \"时尚\", \"value\": 5.27 },\n{ \"name\": \"阳光活力\", \"value\": 5.80 },\n{ \"name\": \"初恋\", \"value\": 3.09 },\n{ \"name\": \"英俊潇洒1\", \"value\": 24.71 },\n{ \"name\": \"霸气\", \"value\": 6.33 },\n{ \"name\": \"腼腆\", \"value\": 2.55 },\n{ \"name\": \"蠢萌\", \"value\": 3.88 },\n{ \"name\": \"青春\", \"value\": 8.04 },\n{ \"name\": \"网红\", \"value\": 5.87 },\n{ \"name\": \"萌\", \"value\": 6.97 },\n{ \"name\": \"认真\", \"value\": 2.53 },\n{ \"name\": \"古典\", \"value\": 2.49 },\n{ \"name\": \"温柔\", \"value\": 3.91 },\n{ \"name\": \"有个性\", \"value\": 3.25 },\n{ \"name\": \"可爱\", \"value\": 9.93 },\n{ \"name\": \"幽默诙谐\", \"value\": 3.65 }];\n\nconst data = originData.map(val => ({\n  ...val,\n  textStyle: {\n    normal: {\n      color: 'rgb(' + [\n        Math.round(Math.random() * 160),\n        Math.round(Math.random() * 160),\n        Math.round(Math.random() * 160)\n      ].join(',') + ')'\n    }\n  }\n}));\n\nchart.setOption({\n  series: [{\n    type: 'wordCloud',\n    shape: 'circle',\n    left: 'center',\n    top: 'center',\n    width: '70%',\n    height: '80%',\n    right: null,\n    bottom: null,\n    sizeRange: [12, 60],\n    rotationRange: [-90, 90],\n    rotationStep: 45,\n    gridSize: 8,\n    drawOutOfBound: false,\n    textStyle: {\n      normal: {\n        fontFamily: 'sans-serif',\n        fontWeight: 'normal'\n      },\n      emphasis: {\n        shadowBlur: 10,\n        shadowColor: '#333'\n      }\n    },\n    data\n  }]\n});\nconsole.log(chart)"
            }
          ]
        }
      },
      "api": {
        "url": "http://10.172.108.163:5555/api/gateway/v2/request",
        "method": "post",
        "messages": {
        },
        "requestAdaptor": "api.body = { \"s\": \"\", \"o\": \"\" };\r\nconst s = security.encrypt(JSON.stringify(api.data), 'b5701c01b8c1778f568418b6ff7f089a');\r\nconst o = security.encrypt(\"{\\\"Os\\\":\\\"\\\",\\\"DeviceId\\\":\\\"Utility\\\",\\\"AppVer\\\":\\\"0\\\"}\", 'b5701c01b8c1778f568418b6ff7f089a');\r\napi.body.s = s;\r\napi.body.o = o;\r\napi.data = api.body;\r\nreturn api;",
        "adaptor": "const resData = JSON.parse(security.decrypt(payload.r, 'b5701c01b8c1778f568418b6ff7f089a'));\r\nconsole.log(resData);\r\n\r\nconst originData = [{ \"name\": \"男神\", \"value\": 2.64 },\r\n{ \"name\": \"好身材\", \"value\": 4.03 },\r\n{ \"name\": \"校草\", \"value\": 24.95 },\r\n{ \"name\": \"酷\", \"value\": 4.04 },\r\n{ \"name\": \"时尚\", \"value\": 5.27 },\r\n{ \"name\": \"阳光活力\", \"value\": 5.80 },\r\n{ \"name\": \"初恋\", \"value\": 3.09 },\r\n{ \"name\": \"英俊潇洒\", \"value\": 24.71 },\r\n{ \"name\": \"霸气\", \"value\": 6.33 },\r\n{ \"name\": \"腼腆\", \"value\": 2.55 },\r\n{ \"name\": \"蠢萌\", \"value\": 3.88 },\r\n{ \"name\": \"青春\", \"value\": 8.04 },\r\n{ \"name\": \"网红\", \"value\": 5.87 },\r\n{ \"name\": \"萌\", \"value\": 6.97 },\r\n{ \"name\": \"认真\", \"value\": 2.53 },\r\n{ \"name\": \"古典\", \"value\": 2.49 },\r\n{ \"name\": \"温柔\", \"value\": 3.91 },\r\n{ \"name\": \"有个性\", \"value\": 3.25 },\r\n{ \"name\": \"可爱\", \"value\": 9.93 },\r\n{ \"name\": \"幽默诙谐\", \"value\": 3.65 }]\r\nreturn {\r\n  status: 0,\r\n  msg: 'OK',\r\n  data: originData\r\n}\r\n",
        "dataType": "json",
        "headers": {
          "apiID": "ffff-1687246097401-10772443-0774",
          "userKey": "30006A9257D225B2414E53F99EE85DA9"
        },
        "data": {
          "ProjectId": 21,
          "Func": "员工关爱-projectHotTopicWords"
        }
      }
    }
  ],
  "id": "u:7eb6a1c7d33d",
  "pullRefresh": {
    "disabled": true
  },
  "regions": [
    "body"
  ],
  "title": "Simple Form Page",
  "onEvent": {
    "init": {
      "weight": 0,
      "actions": [
        {
          "actionType": "custom",
          "script": "\nvar script = document.createElement('script');\nscript.src = 'http://10.199.148.121:8082/downloadFile/echarts.js';\ndocument.head.appendChild(script);\nvar script2 = document.createElement('script');\nscript2.src = 'http://10.199.148.121:8082/downloadFile/echarts-wordcloud.js';\ndocument.head.appendChild(script2);\nconsole.log(1111111);\n"
        }
      ]
    }
  },
  "form": {
    "title": "新增接收人",
    "closeOnEsc": false,
    "showCloseButton": true,
    "className": "p-1",
    "items": [
      {
        "type": "container",
        "body": [
          {
            "type": "form",
            "className": "h-full pl-4 pr-4",
            "body": [
              {
                "type": "select",
                "label": "级别",
                "name": "select1",
                "options": [
                  {
                    "label": "选项A",
                    "value": "A"
                  },
                  {
                    "label": "选项B",
                    "value": "B"
                  }
                ],
                "id": "u:21a9f4785dd7",
                "multiple": false
              },
              {
                "type": "tree-select",
                "label": "部门",
                "name": "tree1",
                "options": [
                  {
                    "label": "选项A",
                    "value": "A",
                    "children": [
                      {
                        "label": "选项C",
                        "value": "C"
                      },
                      {
                        "label": "选项D",
                        "value": "D"
                      }
                    ]
                  },
                  {
                    "label": "选项B",
                    "value": "B"
                  }
                ],
                "id": "u:e95572c2d57f",
                "multiple": false,
                "enableNodePath": false,
                "hideRoot": true,
                "showIcon": true,
                "initiallyOpen": true,
                "onEvent": {
                }
              },
              {
                "type": "select",
                "label": "工号",
                "name": "select2",
                "options": [
                  {
                    "label": "选项A",
                    "value": "A"
                  },
                  {
                    "label": "选项B",
                    "value": "B"
                  }
                ],
                "id": "u:872f13ab544a",
                "multiple": false
              },
              {
                "type": "input-text",
                "label": "姓名",
                "name": "text",
                "id": "u:5033bd518c28"
              },
              {
                "type": "input-text",
                "label": "手机号",
                "name": "text2",
                "id": "u:31d049d8d4be"
              },
              {
                "type": "input-text",
                "label": "邮箱",
                "name": "text3",
                "id": "u:03ca0364867c",
                "validations": {
                },
                "validationErrors": {
                },
                "showCounter": false
              },
              {
                "type": "checkboxes",
                "label": "接收方式",
                "name": "checkboxes",
                "multiple": true,
                "options": [
                  {
                    "label": "讯小通",
                    "value": "A"
                  },
                  {
                    "label": "爱口袋",
                    "value": "B"
                  },
                  {
                    "label": "邮箱",
                    "value": "邮箱"
                  },
                  {
                    "label": "短信",
                    "value": "短信"
                  }
                ],
                "id": "u:c428ac594537",
                "checkAll": false,
                "joinValues": true,
                "value": "A,B,邮箱"
              }
            ],
            "id": "u:d468f669b921"
          }
        ],
        "size": "xs",
        "style": {
          "position": "static",
          "display": "block",
          "flex": "1 1 auto",
          "flexGrow": 1,
          "flexBasis": "auto"
        },
        "wrapperBody": false,
        "isFixedHeight": false,
        "isFixedWidth": false,
        "id": "u:a4e3024e438f"
      }
    ],
    "style": {
      "position": "relative"
    },
    "id": "u:b4cd197ce589"
  }
}

  <script type="text/javascript" src='http://10.199.148.121:8082/downloadFile/echarts.js'></script>
  <script type="text/javascript" src='http://10.199.148.121:8082/downloadFile/echarts-wordcloud.js'></script>
  
  
    <div id="myEchart" style="width: 500px;height: 500px;"></div>
    
    
    
    <script>
    console.log(1111111);
    const chart = echarts.init(document.getElementById('myEchart'));
    const originData = [{ "name": "男神", "value": 2.64 },
    { "name": "好身材", "value": 4.03 },
    { "name": "校草", "value": 24.95 },
    { "name": "酷", "value": 4.04 },
    { "name": "时尚", "value": 5.27 },
    { "name": "阳光活力", "value": 5.80 },
    { "name": "初恋", "value": 3.09 },
    { "name": "英俊潇洒", "value": 24.71 },
    { "name": "霸气", "value": 6.33 },
    { "name": "腼腆", "value": 2.55 },
    { "name": "蠢萌", "value": 3.88 },
    { "name": "青春", "value": 8.04 },
    { "name": "网红", "value": 5.87 },
    { "name": "萌", "value": 6.97 },
    { "name": "认真", "value": 2.53 },
    { "name": "古典", "value": 2.49 },
    { "name": "温柔", "value": 3.91 },
    { "name": "有个性", "value": 3.25 },
    { "name": "可爱", "value": 9.93 },
    { "name": "幽默诙谐", "value": 3.65 }];

    const data = originData.map(val => ({
      ...val,
      textStyle: {
          color: 'rgb(' + [
            Math.round(Math.random() * 160),
            Math.round(Math.random() * 160),
            Math.round(Math.random() * 160)
          ].join(',') + ')'
      }
    }));

    chart.setOption({
      series: [{
        type: 'wordCloud',
        shape: 'circle',
        left: 'center',
        top: 'center',
        width: '70%',
        height: '80%',
        right: null,
        bottom: null,
        sizeRange: [12, 60],
        rotationRange: [-90, 90],
        rotationStep: 45,
        gridSize: 8,
        drawOutOfBound: false,
        textStyle: {
          normal: {
            fontFamily: 'sans-serif',
            fontWeight: 'normal'
          },
          emphasis: {
            shadowBlur: 10,
            shadowColor: '#333'
          }
        },
        data
      }]
    });


  </script>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值