日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

利用judge-width屬性實現Vcharts圖表自適應

作者:Mr.wang、、 更新時間: 2022-08-15 編程語言

如何實現Vcharts自適應,跟隨父元素縮放。
Vcharts是VUE基于echarts為解決echarts復雜繁多的配置項而推出封裝圖表組件庫。Vcharts自帶一個屬性judge-width,作用是自適應寬高,但是一般只寬度自適應,這是再添加height='100%'即可實現寬高都自適應。
下面是我開發的一個Vcharts封裝組件:

<template>
  <ve-bar :data="testData" height='100%' :extend="extend" judge-width :colors="colors"></ve-bar>
</template>

<script>
  export default {
    name:"barChart",
    props:{
    testData:{
      default:function(){
        return ""
      }
    }
  },
  data () {
    return {
      colors : ['#6540FD','#FE9000','#F7CB4A','#DCE292','#FFBF9A','#DBA946','#5182E4','#9BCC66','#3FB27E','#B98934',
      '#F88D48','#F35352','#CE62D6','#8954D4','#5156B8','#51B4F1','#69D4DB','#D42D6B'],
      extend: {
        legend:{
              show:false,
            },
            grid:{
              x:10,
              y:20,
              x2:10,
              y2:20,
            },
        xAxis:{
          axisLabel: {
            textStyle: {
              color: '#f0f0f0'
            }
          },
        yAxis: {
          axisLabel: {
            textStyle: {
              color: '#f0f0f0'
            }
          },
    }
  },
}
</script>

原文鏈接:https://blog.csdn.net/qq_30258721/article/details/126291989

欄目分類
最近更新