echarts实现七天天气预报

发布时间:2023年12月25日
效果图

在这里插入图片描述

实现代码
const imglist = {
  "晴": 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAYAAAA6oTAqAAAAAXNSR0IArs4c6QAAByJJREFUaEO9Wl1rFGcUfs67u/nYbOIXJlGopBTx27aQWGOwSMS75sao2BtBQVD/gWCJouA/sIWCBW8M1nqjd1IplW5DYqLW+EUoSi9iEjHaJmaz2d05ZWd2NjvvOztnp5s6N7swM2fP856v55yzhCW6+EVb3Ww6tQvMuy3QRjBvUIRWi9GoCPXMSIEwQ4wJi+i5Aj8D0d1EbX2SPn45vxRqUDVCHADzPWzljgC0j5lrPfLy0hmA+yvu9/xn4SKiNMC3iXElEW+4WQ2w/wSGeU909umT42D0WbBaqKitdjQCGB2bAk2CcC6xafP3RL9kwx50aDAzT5t7mfkiGOsXj73kqINMwwwQAfnP/OV+z3/aVwEeYYyITjdumvopDKCKwaT+XLsuk8r0E3Gnq4ttkBI3yluIwXAtxcwgIuQ/fS/pfcLvsdrY4fpPxv+qBFRFYOaeNXdZWb7BxM2lyuvKGmAKwPIAHUM4wPKfth00Q/lZmkBTHFX7mzZO/SYBEsHMPl59FLC+Y0aNJEy6L3pZGQFEWADUicSW1z8E/UYgmJnRVefBOOOcmJ+Pa6L1iJaymXFfiilcaNz65ptygMqCsS1iWZeLcWGHhxMPrttIljDdKjiGKnmeFI4ltkz7WsgXzNxoc5eF7B22UFMKxkg+YQ0jHLxRhjS/dGKNFxTFuuNbzRgywKQer12Xy80PAdxspE7D6bWiqKc3MUg09Q03LaTxYuoultqpiKrtqN/izXIGmPePViYB7vTPNpJjBd/XLWtms8rlE1GyYdt0V+kbHjBzoyt7LYuvFwNeO2k9Xiv/abckBsecntp1+XrMKqUOxLdOFwtrEUyeoqRGHzxhu7L7X9JJisnL8BrtDe0HJK9jxljD9s82u9SnCOb9oxUnYVmXPHRDj4GwppDQLYU8Racatr391q4cdmy8aKubm3n7EkwtHn7ik008FV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AAAAAElFTkSuQmCC';
const maxTemp = ["16.3", "16.2", "20.6", "14.2", "17.6", "15.7", "14.3"];
const minTemp = ["-5.4", "-2.8", "-3.5", "-2.5", "12.4", "-1.2", "-13"];

const weekday = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"];
const daylist = ["25日", "26日", "27日", "28日", "29日", "30日", "31日"];
const weatherlist = ["小雨", "小雨", "阴", "小雨", "多云", "小雨", "小雨"];
//数据转换成rich对象
let style = weatherlist.map((i) => {
  return {
    backgroundColor: {
      image: imglist[i]
    },
    height: 40,
    width: 40
  }
});

let rich = {}
style.forEach((i, index) => {
  rich[index] = i;
});
rich.b = {
  // color: 'white',
  fontSize: 12,
  lineHeight: 30,
  height: 20
};

option = {
  backgroundColor: "#fff",
  title: {
    text: "7天天气预报",
    left: "5%",
    show: false
  },
  tooltip: {
    trigger: "axis",
    axisPointer: {
      type: "shadow",
      shadowStyle: {
        color: "rgba(99,166,253,0.1)"
      },
      shadowBlur: 10
    },
    formatter: function (params) {
      let str = weekday[params[0].dataIndex] + "," + params[0].name + "<br />";
      params.forEach((item, index) => {
        console.log(item);
        str += `${item.marker}${item.seriesName}: ${item.data}<br />`;
        if (index == params.length - 1) {
          str += `${item.marker}天气:${weatherlist[item.dataIndex]}<br />`;
        }

      });
      return str;
    }

  },
  legend: {
    show: false
  },
  grid: {
    show: true,
    backgroundColor: "transparent",
    opacity: 0.3,
    borderWidth: "0",
    top: "20%",
    bottom: "20%"
  },
  toolbox: {
    show: false,
    right: "5%",
    feature: {
      magicType: {
        type: ["line", "bar", "stack"]
      },
      dataZoom: {
        yAxisIndex: "none"
      },
      restore: {},
      saveAsImage: {}
    }
  },
  xAxis: [
    // 日期
    {
      type: "category",
      boundaryGap: false,
      position: "top",
      offset: -50,
      zlevel: 100,
      axisLine: {
        show: false
      },
      axisTick: {
        show: false
      },
      axisLabel: {
        interval: 0,
        formatter: ["{a|{value}}"].join("\n"),
        rich: {
          a: {
            // color: 'white',
            fontSize: 18
          }
        }
      },
      nameTextStyle: {},
      data: daylist
    },
    // 星期
    {
      type: "category",
      position: "bottom",
      offset: -50,
      boundaryGap: false,
      zlevel: 100,
      axisLine: {
        show: false
      },
      axisTick: {
        show: false
      },
      axisLabel: {
        interval: 0,
        formatter: ["{a|{value}}"].join("\n"),
        rich: {
          a: {
            // color: 'white',
            fontSize: 14
          }
        }
      },
      nameTextStyle: {
        fontWeight: "bold",
        fontSize: 19
      },
      data: weekday
    },
    // 天气图标
    {
      type: "category",
      boundaryGap: false,
      position: "top",
      offset: -120,
      zlevel: 100,
      axisLine: {
        show: false
      },
      axisTick: {
        show: false
      },
      axisLabel: {
        interval: 0,
        formatter: function (value, index) {
          return "{k|}\n{" + index + "| }\n{b|" + value + "}";
        },
        rich
      },
      nameTextStyle: {
        fontWeight: "bold",
        fontSize: 19
      },
      data: weatherlist
    }
  ],
  yAxis: {
    show: false,
    type: "value",

    axisLabel: {
      formatter: "{value}" + "℃"
    },
    max: function (value) {
      return value.max + 20;
    },
    min: function (value) {
      return value.min - 20;
    }
  },
  series: [
    {
      name: "最高温度",
      type: "line",
      data: maxTemp,
      symbol: "emptyCircle",
      symbolSize: 10,
      showSymbol: true,
      smooth: true,
    },
    {
      name: "最低温度",
      type: "line",
      data: minTemp,
      symbol: "emptyCircle",
      symbolSize: 10,
      showSymbol: true,
      smooth: true,
    }
  ]
}

文章来源:https://blog.csdn.net/preoccupied_/article/details/135191296
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。