zoukankan      html  css  js  c++  java
  • echarts

       initEcharts() {
          let myChart = echarts.init(document.getElementById("partTwo"));
          //只让click事件触发一次
          myChart.off("click");
          let option = {
            backgroundColor: "transparent",
            color: [
              "#FF72A6",
              "#FF9502",
              "#FEEC02",
              "#506CEF",
              "#38A5EA ",
              "#ad36ff",
            ],
            tooltip: {
              trigger: "axis",
              axisPointer: {
                type: "shadow",
              },
              textStyle: {
                color: "#fff",
              },
              backgroundColor: "#000A3070",
              borderColor: "#000A3060",
            },
            legend: {
              data: this.projectDomainsList.map((v) => v.name),
              orient: "vertical",
              right: "0%",
              top: "15%",
              icon: "circle",
              itemWidth: 10,
              itemHeight: 10,
              itemGap: 20,
              textStyle: {
                color: "#fff",
                fontSize: 12,
              },
            },
            series: [
              {
                name: "项目行业分布",
                type: "pie",
                clockwise: false,
                startAngle: 90,
                center: ["38%", "50%"],
                radius: ["45%", "65%"],
                hoverAnimation: false,
                label: {
                  show: true,
                  orient: "outside",
                  formatter: "{a|{b}: {d}%}",
                  rich: {
                    a: {
                      color: "#fff",
                    },
                  },
                  left: 10,
                  top: 20,
                  bottom: 20,
                },
                data: this.projectDomainsList.map((v) => {
                  return { name: v.name, value: v.project };
                }),
              },
            ],
          };
          myChart.setOption(option);
          //点击饼图跳研发
          myChart.on("click", (params) => {
            this.visible = true;
            let serviceName = params.name;
            this.projectDomainsList.forEach((item) => {
              if (serviceName == item.name) {
                this.serviceType = item.id;
              }
            });
            this.getSreviceTypeList();
          });
          // // let names = ["制造流量", "轨道交通", "金融", "政府", "通信"];
          // let firstSelectName = "制造流量";
          // myChart.dispatchAction({
          //   type: "highlight",
          //   // 数据的 index,如果不指定也可以通过 name 属性根据名称指定数据
          //   name: firstSelectName,
          // });
          // let selectIndex = 1;
          // setInterval(() => {
          //   myChart.dispatchAction({
          //     type: "downplay",
          //     seriesIndex: 1,
          //   });
          //   myChart.dispatchAction({
          //     type: "highlight",
          //     // 数据的 index,如果不指定也可以通过 name 属性根据名称指定数据
          //     name: names[selectIndex],
          //   });
          //   selectIndex++;
          //   if (selectIndex >= names.length) {
          //     selectIndex = 0;
          //   }
          // }, 3000);
        },
  • 相关阅读:
    简单的冒泡排序算法(java)
    寻找两个数组中的公共元素Java程序代码
    利用快速排序求两集合交集
    一种简单的吉布斯采样modify中应用
    递归生成小于某个数的所有集合
    卡拉曼算法简答程序
    模态对话框退出DoModal过程中需注意的陷阱
    是否可以使用空对象指针调用成员函数及访问成员变量
    windows c++如何使窗口动态改变位置
    windows的滚动条使用
  • 原文地址:https://www.cnblogs.com/bwnnxxx123/p/15685816.html
Copyright © 2011-2022 走看看