gpt4 book ai didi

echart 写一个大屏展示圆边渐变柱状图

转载 作者:知者 更新时间:2024-03-13 01:52:40 28 4
gpt4 key购买 nike


 

效果如上图所示: 

backgroundColor: "rgba(0,0,0,0)",
              tooltip: {
                show: true,
                formatter: activeName.value == "电" ?"{b}:{c}kWh":"{b}:{c}m³",
              },
              grid: {
                left: "5%",
                top: "-6%",
                right: "15%",
                bottom: "8%",
                containLabel: true,
              },

              xAxis: {
                type: "value",
                show: false,
                position: "top",
                axisTick: {
                  show: false,
                },
                axisLine: {
                  show: false,
                  lineStyle: {
                    color: "#fff",
                  },
                },
                splitLine: {
                  show: false,
                },
              },
              yAxis: [
                {
                  type: "category",
                  axisTick: {
                    show: false,
                    alignWithLabel: false,
                    length: 5,
                  },
                  splitLine: {
                    //网格线
                    show: false,
                  },
                  inverse: "true", //排序
                  axisLine: {
                    show: false,
                    lineStyle: {
                      color: "#fff",
                    },
                  },
                  data: [
                    activeName.value == "电"
                      ? allyongdianTop5[0].mingzi
                      : allyongshuiTop5[0].mingzi,
                    activeName.value == "电"
                      ? allyongdianTop5[1].mingzi
                      : allyongshuiTop5[1].mingzi,
                    activeName.value == "电"
                      ? allyongdianTop5[2].mingzi
                      : allyongshuiTop5[2].mingzi,
                    activeName.value == "电"
                      ? allyongdianTop5[3].mingzi
                      : allyongshuiTop5[3].mingzi,
                    activeName.value == "电"
                      ? allyongdianTop5[4].mingzi
                      : allyongshuiTop5[4].mingzi,
                  ],

                  // y轴坐标字体颜色以及大小
                  axisLabel: {
                    fontSize: 14,
                    textStyle: {
                      color: function (params, Index) {
                        // 标签国家字体颜色
                        var colorarrays = [
                          "#71A7FA",
                          "#41DDC7",
                          "#C96016",
                          "#71FA96",
                          "#6688D8",
                        ];
                        return colorarrays[Index];
                      },
                    },
                  },
                },
              ],
              series: [
                {
                  type: "bar",
                  label: {
                    normal: {
                      show: true,
                      position: "right",
                      formatter: activeName.value == "电" ? "{c}kWh" : "{c}m³",
                      textStyle: {
                        color: "#fff",
                        fontSize: "10",
                      },
                    },
                  },
                  itemStyle: {
                    normal: {
                      show: true,
                      color: function (params) {
                        let num = colorArray.length;
                        return {
                          type: "linear",
                          colorStops: [
                            {
                              offset: 0,
                              color: colorArray[params.dataIndex % num].bottom,
                            },
                            {
                              offset: 1,
                              color: colorArray[params.dataIndex % num].top,
                            },
                          ],
                        };
                      },
                      barBorderRadius: 70,
                      borderWidth: 10,
                    },
                  },
                  barGap: "0%",
                  barCategoryGap: "60%",
                  data: [
                    activeName.value == "电"
                      ? allyongdianTop5[0].value
                      : allyongshuiTop5[0].value,
                    activeName.value == "电"
                      ? allyongdianTop5[1].value
                      : allyongshuiTop5[1].value,
                    activeName.value == "电"
                      ? allyongdianTop5[2].value
                      : allyongshuiTop5[2].value,
                    activeName.value == "电"
                      ? allyongdianTop5[3].value
                      : allyongshuiTop5[3].value,
                    activeName.value == "电"
                      ? allyongdianTop5[4].value
                      : allyongshuiTop5[4].value,
                  ],
                },
              ],

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com