最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

在vue中使用echarts實(shí)現(xiàn)上浮與下鉆效果

 更新時(shí)間:2023年05月09日 10:25:58   作者:lijinglianging  
這篇文章主要介紹了在vue中使用echarts實(shí)現(xiàn)上浮與下鉆效果,本文分步驟給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

第一步:

在vue項(xiàng)目中安裝 echarts 

npm i echars -S

第二步:

main.js配置 這里是全局引入

//引入echars
import echarts from 'echarts'
Vue.prototype.$echarts = echarts

第三步

直接上代碼

<template>
 <div id="container">
  <header>浙江省echars地圖</header>
  <div id="echarsMap"></div>
 </div>
</template>
<script>
//引入json
import zhejiang from "../../../static/zhejiangJson/zhejiang";
import hangzhou from "../../../static/zhejiangJson/hangzhou";
import huzhou from "../../../static/zhejiangJson/huzhou";
import jiaxing from "../../../static/zhejiangJson/jiaxing";
import jinhua from "../../../static/zhejiangJson/jinhua";
import lanzhou from "../../../static/zhejiangJson/lanzhou";
import lishui from "../../../static/zhejiangJson/lishui";
import ningbo from "../../../static/zhejiangJson/ningbo";
import quzhou from "../../../static/zhejiangJson/quzhou";
import shaoxing from "../../../static/zhejiangJson/shaoxing";
import taizhou from "../../../static/zhejiangJson/taizhou";
import wenzhou from "../../../static/zhejiangJson/wenzhou";
import zhoushan from "../../../static/zhejiangJson/zhoushan";
export default {
 name: "echars1",
 data() {
  return {
   cityName: "",//區(qū)域的名字
   markerArr: [], //接收散點(diǎn)圖數(shù)據(jù)
  };
 },
 methods: {
  //畫地圖
  initEchars(cityName) {
   var cityMap = {
    杭州市: hangzhou,
    麗水市: lishui,
    蘭州市: lanzhou,
    臺(tái)州市: taizhou,
    嘉興市: jiaxing,
    寧波市: ningbo,
    溫州市: wenzhou,
    湖州市: huzhou,
    紹興市: shaoxing,
    舟山市: zhoushan,
    衢州市: quzhou,
    金華市: jinhua
   };
   var name = [cityName];
   var pos = {
    leftPlus: 115,
    leftCur: 150,
    left: 198,
    top: 50
   };
   var line = [[0, 0], [8, 11], [0, 22]];
   // style
   var style = {
    font: '18px "Microsoft YaHei", sans-serif',
    textColor: "#eee",
    lineColor: "rgba(147, 235, 248, .8)"
   };
   if (cityName == "" || cityName == "浙江") {
    cityName = "浙江";
    this.$echarts.registerMap("浙江", zhejiang);
   }
   let mapCharts = this.$echarts.init(document.getElementById("echarsMap"));
   let mapCharts_option = {
    //鼠標(biāo)懸浮點(diǎn)標(biāo)記
    // tooltip: {
    //  padding: 0,
    //  enterable: true,
    //  transitionDuration: 1,
    //  textStyle: {
    //   color: "#000",
    //   decoration: "none"
    //  },
    //  formatter: function(params) {
    //   var tipHtml = "";
    //   tipHtml =
    //    '<div style="width:100%;height:auto;background:rgba(22,80,158,1);border:1px solid rgba(7,166,255,0.7)">' +
    //    '<div style="width:100%;height:40px;line-height:40px;border-bottom:2px solid rgba(7,166,255,0.7);padding:0 20px">' +
    //    '<i style="display:inline-block;width:8px;height:8px;background:#16d6ff;border-radius:40px;">' +
    //    "</i>" +
    //    '<span style="margin-left:10px;color:#fff;font-size:16px;">' +
    //    params.data.org_name +
    //    "</span>" +
    //    "</div>" +
    //    '<div style="padding:20px">' +
    //    '<p style="color:#fff;font-size:12px;">' +
    //    '<i style="display:inline-block;width:10px;height:10px;background:#16d6ff;border-radius:40px;margin:0 8px">' +
    //    "</i>" +
    //    "工程名稱:" +
    //    '<span style="color:#f48225;margin:0 6px;">' +
    //    params.data.name +
    //    "</span>" +
    //    "</p>" +
    //    "</div>" +
    //    "</div>";
    //   return tipHtml;
    //  }
    // },
    //單詞意思 圖形圖表
    graphic: [
     {
      type: "group",
      left: pos.left,
      top: pos.top - 4,
      children: [
       {
        type: "line",
        left: 0,
        top: -20,
        shape: {
         x1: 0,
         y1: 0,
         x2: 60,
         y2: 0
        },
        style: {
         stroke: style.lineColor
        }
       },
       {
        type: "line",
        left: 0,
        top: 20,
        shape: {
         x1: 0,
         y1: 0,
         x2: 60,
         y2: 0
        },
        style: {
         stroke: style.lineColor
        }
       }
      ]
     },
     {
      id: "",
      type: "group",
      left: pos.left + 2,
      top: pos.top,
      children: [
       {
        type: "polyline",
        left: 90,
        top: -12,
        shape: {
         points: line
        },
        style: {
         stroke: "transparent",
         key: name[0]
        },
        onclick: function() {}
       },
       {
        type: "text",
        left: 0,
        top: "middle",
        style: {
         text: "浙江",
         textAlign: "center",
         fill: style.textColor,
         font: style.font
        },
        onclick: () => {
         mapCharts.clear();
         this.$echarts.registerMap("浙江", zhejiang);
         mapCharts_option.geo.map = "浙江";
         mapCharts.setOption(mapCharts_option, true);
        }
       },
       {
        type: "text",
        left: 0,
        top: 10,
        style: {
         text: "zhejiang",
         textAlign: "center",
         fill: style.textColor,
         font: '12px "Microsoft YaHei", sans-serif'
        },
        onclick: () => {
         mapCharts.clear();
         this.$echarts.registerMap("浙江", zhejiang);
         mapCharts_option.geo.map = "浙江";
         mapCharts.setOption(mapCharts_option, true);
        }
       }
      ]
     }
    ],
    //設(shè)置地圖
    geo: {
     map: cityName,
     zoom: "1.2", //縮放比例
     scaleLimit: {
      //縮放的限度
      min: 1,
      max: 30
     },
     roam: true, //單詞意思是漫步 實(shí)際是可以拖拽
     label: {
      //文字的顏色 單詞意思標(biāo)簽
      normal: {
       //靜態(tài)的時(shí)候顯示的默認(rèn)樣式
       show: true,
       color: "#fff"
      },
      emphasis: {
       //鼠標(biāo)移入動(dòng)態(tài)的時(shí)候顯示的默認(rèn)樣式
       // show: false,
       // color:'#333'
      }
     },
     itemStyle: {
      //區(qū)域設(shè)置
      normal: {
       borderColor: "rgba(147, 235, 248, 1)",
       borderWidth: 1,
       areaColor: {
        type: "radial",
        x: 0.5,
        y: 0.5,
        r: 0.8,
        colorStops: [
         {
          offset: 0,
          color: "rgba(147, 235, 248, 0)" // 0% 處的顏色
         },
         {
          offset: 1,
          color: "rgba(147, 235, 248, .2)" // 100% 處的顏色
         }
        ],
        globalCoord: false // 缺省為 false
       },
       shadowColor: "rgba(128, 217, 248, 1)",
       shadowOffsetX: -2,
       shadowOffsetY: 2,
       shadowBlur: 10
      },
      emphasis: {
       //鼠標(biāo)移入動(dòng)態(tài)的時(shí)候顯示區(qū)域顏色
       areaColor: "#389BB7",
       borderWidth: 0
      }
     }
    },
    series: [] //存點(diǎn)標(biāo)記的地方
   };
   mapCharts.clear();
   mapCharts.setOption(mapCharts_option, true);
   mapCharts.resize();
   mapCharts.on("click", params => {
    //地圖下鉆
    console.log(params);
    if (cityMap[params.name]) {
     this.cityName = params.name;
     var url = cityMap[params.name]; //對(duì)應(yīng)的拼音區(qū)域
     this.$echarts.registerMap(params.name, url);
     mapCharts_option.geo.map = params.name;
     mapCharts.setOption(mapCharts_option, true);
    }
   });
  },
 },
 mounted() {
  this.initEchars("浙江");
 }
};
</script>
<style lang="less" scoped>
#container {
 width: 100%;
 height: calc(100% - 78px);
 background-color: pink;
 #echarsMap {
  width: 80%;
  height: 80%;
  background-color: #000;
  margin: auto;
 }
}
</style>

效果圖

在這里插入圖片描述

點(diǎn)擊下一層

在這里插入圖片描述

總結(jié)

以上所述是小編給大家介紹的在vue中使用 echarts 實(shí)現(xiàn)上浮與下鉆效果,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
如果你覺(jué)得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!

相關(guān)文章

  • 分享7個(gè)成為更好的Vue開(kāi)發(fā)者的技巧

    分享7個(gè)成為更好的Vue開(kāi)發(fā)者的技巧

    作為使用Vue已經(jīng)很多年的人,特別是去年一直在使用?Vue3,因此,學(xué)到了很多東西。所以本文為大家準(zhǔn)備了7個(gè)讓我們成為更好?Vue?開(kāi)發(fā)者的技巧,需要的可以參考一下
    2022-06-06
  • Vue+Echarts實(shí)現(xiàn)繪制多設(shè)備狀態(tài)甘特圖

    Vue+Echarts實(shí)現(xiàn)繪制多設(shè)備狀態(tài)甘特圖

    這篇文章主要為大家詳細(xì)介紹了Vue如何結(jié)合Echarts實(shí)現(xiàn)繪制多設(shè)備狀態(tài)甘特圖,文中的示例代碼講解詳細(xì),有需要的小伙伴可以跟隨小編一起學(xué)習(xí)一下
    2024-03-03
  • 關(guān)于Vue如何清除緩存的方法詳解

    關(guān)于Vue如何清除緩存的方法詳解

    緩存清除成為克服瀏覽器緩存中過(guò)時(shí)內(nèi)容挑戰(zhàn)的關(guān)鍵技術(shù),術(shù)語(yǔ)“緩存清除”是指故意使靜態(tài)資源失效或進(jìn)行版本控制,迫使瀏覽器在發(fā)生更改時(shí)獲取新資源,本文給大家介紹了Vue如何清除緩存,需要的朋友可以參考下
    2023-12-12
  • vue移動(dòng)端項(xiàng)目vant組件庫(kù)之tag詳解

    vue移動(dòng)端項(xiàng)目vant組件庫(kù)之tag詳解

    這篇文章主要介紹了vue移動(dòng)端項(xiàng)目vant組件庫(kù)之tag詳解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-04-04
  • vue2老項(xiàng)目vite升級(jí)改造過(guò)程記錄

    vue2老項(xiàng)目vite升級(jí)改造過(guò)程記錄

    目前vite主要默認(rèn)是支持給vue3使用的,并且如果使用官方的cli創(chuàng)建的項(xiàng)目一樣會(huì)默認(rèn)使用vue3去構(gòu)建項(xiàng)目,此時(shí)對(duì)于一些vue2的老項(xiàng)目就顯得不友好了,下面這篇文章主要給大家介紹了關(guān)于vue2老項(xiàng)目vite升級(jí)改造的相關(guān)資料,需要的朋友可以參考下
    2022-12-12
  • vue?layout模板頁(yè)的使用實(shí)例詳解

    vue?layout模板頁(yè)的使用實(shí)例詳解

    Vue 項(xiàng)目中使用布局組件來(lái)創(chuàng)建頁(yè)面布局的方式是完全可行的,而且在很多項(xiàng)目中都被廣泛采用,包括像 ruoyi 這樣的框架,這篇文章主要介紹了vue?layout模板頁(yè)的使用,需要的朋友可以參考下
    2023-08-08
  • vue3點(diǎn)擊不同的菜單頁(yè)切換局部頁(yè)面實(shí)現(xiàn)方法

    vue3點(diǎn)擊不同的菜單頁(yè)切換局部頁(yè)面實(shí)現(xiàn)方法

    這篇文章主要給大家介紹了關(guān)于vue3點(diǎn)擊不同的菜單頁(yè)切換局部頁(yè)面實(shí)現(xiàn)的相關(guān)資料,文中示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用vue3具有一定的參考價(jià)值,需要的朋友可以參考下
    2023-08-08
  • Vue-Quill-Editor富文本編輯器的使用教程

    Vue-Quill-Editor富文本編輯器的使用教程

    這篇文章主要為大家詳細(xì)介紹了Vue-Quill-Editor富文本編輯器的使用教程,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-09-09
  • Vue3中引入scss文件的方法步驟

    Vue3中引入scss文件的方法步驟

    這篇文章主要給大家介紹了關(guān)于Vue3中引入scss文件的方法步驟,在實(shí)際項(xiàng)目中,各種樣式往往有很多重復(fù)的情況,為了能夠使樣式的后續(xù)開(kāi)發(fā)和維護(hù)更加愜意,將這些共同的代碼進(jìn)行命名然后調(diào)用這些變量是一個(gè)很好的選擇,需要的朋友可以參考下
    2023-08-08
  • vue+vuex+axio從后臺(tái)獲取數(shù)據(jù)存入vuex實(shí)現(xiàn)組件之間共享數(shù)據(jù)

    vue+vuex+axio從后臺(tái)獲取數(shù)據(jù)存入vuex實(shí)現(xiàn)組件之間共享數(shù)據(jù)

    這篇文章主要介紹了vue+vuex+axio從后臺(tái)獲取數(shù)據(jù)存入vuex,組件之間共享數(shù)據(jù),非常具有實(shí)用價(jià)值,需要的朋友可以參考下
    2017-04-04

最新評(píng)論

江北区| 托克托县| 太仆寺旗| 绩溪县| 曲阳县| 水城县| 屯留县| 乐平市| 海兴县| 翁牛特旗| 赤水市| 浦北县| 革吉县| 塔城市| 仁怀市| 长海县| 阳原县| 莱芜市| 天祝| 延长县| 汉阴县| 武强县| 安阳市| 北流市| 南澳县| 安溪县| 咸宁市| 拜泉县| 巢湖市| 蕲春县| 定州市| 汉中市| 安塞县| 颍上县| 中西区| 吕梁市| 北安市| 恩施市| 洪雅县| 平乐县| 新疆|