欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

解決echarts 一條柱狀圖顯示兩個(gè)值,類似進(jìn)度條的問題

 更新時(shí)間:2020年07月20日 15:29:37   作者:Daniel cui  
這篇文章主要介紹了解決echarts 一條柱狀圖顯示兩個(gè)值,類似進(jìn)度條的問題,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧

我就廢話不多說說了,大家還是直接看代碼吧~


var allUseDayChartTwo;
function allUseDayChartTwoFun(obj,xdata,ydata,zdata){
	allUseDayChartTwo = echarts.init(obj);
	var category = xdata;
	var lineData = zdata;
	var barData = ydata;
	option = {
//		backgroundColor:'#F00',
	  tooltip: {
	    trigger: 'axis',
	    backgroundColor:'rgba(0,0,0,.5)',
	    axisPointer: {
	      type: 'shadow',
	      label: {
	        show: true,
	        backgroundColor: '#F1F1F1',
	        color:'#5A5A5A'
	      }
	    },
	    confine: true
	  },
	  grid: {
      left: '1%',
      	right: '3%',
     	bottom: '5%',
    	top: '5%',
    	containLabel: true
    },
	  xAxis: {
	    axisLine: {
	      lineStyle: {
	        color: '#B4B4B4'
	      }
	    },
	    axisTick:{
	      show:false,
	    },
	    axisLine:{
        show:false
      },
      axisTick:{
        show:false
      },
      splitLine:{
        show:false
      },
			axisLabel:{
	    	textStyle: {
          fontSize: 14,
        },
	      formatter:'{value} ',
	    },
 
	  },
	  yAxis: [{
			data: category,
	    splitLine: {show: false},
	    axisLine: {
	      lineStyle: {
	        color: '#B4B4B4',
	      }
	    },
	    axisLabel:{
	    	textStyle: {
          fontSize: 14,
//         color: '#B2B2B2'
        },
	      formatter:'{value} ',
	    },
	    axisLine:{
        show:false
      },
      axisTick:{
        show:false
      },
      splitLine:{
        show:false
      }
	  }
//	  ,{
//			data: category,
//	    splitLine: {show: false},
//	    axisLine: {
//	      lineStyle: {
//	        color: '#B4B4B4',
//	      }
//	    },
//	    axisLabel:{
//	      formatter:'{value} ',
//	    }
//	  }
	  ],
	  series: [{
	    name: '用量',
	    type: 'bar',
	    barWidth: 15,
	    barGap: '-100%',
	    itemStyle: {
	      normal: {
	        barBorderRadius: 5,
	        color: new echarts.graphic.LinearGradient(
	          0, 0, 0, 1,
	          [
	            {offset: 0, color: 'rgba(88,228,88,0.8)'},
	            {offset: 1, color: 'rgba(88,228,88,0.8)'}
	          ]
	        )
	      }
	    },
	    data: barData
	  },{
	    name: '閾值',
	    type: 'bar',
	    barGap: '-100%',
	    barWidth: 15,
	    itemStyle: {
	      normal: {
	        barBorderRadius: 5,
	        color: new echarts.graphic.LinearGradient(
	          0, 0, 0, 1,
	          [
	            {offset: 0, color: 'rgba(234,234,234,0.8)'},
	            {offset: 0.2, color: 'rgba(234,234,234,1)'},
	            {offset: 1, color: 'rgba(234,234,234,1)'}
	          ]
	        )
	      }
	    },
	    z: -12,
	    data: lineData
	  }
//	  ,{
//	    name: '背景',
//	    type: 'bar',
//	    barGap: '-100%',
//	    barWidth: 15,
//	    itemStyle: {
//	      normal: {
//	        barBorderRadius: 5,
//	        color: new echarts.graphic.LinearGradient(
//	          0, 0, 0, 1,
//	          [
//	            {offset: 0, color: 'rgba(0,0,0,0.2)'},
//	            {offset: 0.2, color: 'rgba(0,0,0,0.)'},
//	            {offset: 1, color: 'rgba(0,0,0,0.24)'}
//	          ]
//	        )
//	      }
//	    },
//	    z: -20,
//	    data: [50,50,50,50,50,50,50,50,50]
//	  }
	  ]
	};
	allUseDayChartTwo.setOption(option);
}

補(bǔ)充知識:echarts 柱狀圖實(shí)現(xiàn)進(jìn)度條,進(jìn)行數(shù)據(jù)驅(qū)動

echarts 柱狀圖實(shí)現(xiàn)進(jìn)度條,進(jìn)行數(shù)據(jù)驅(qū)動

效果圖

直接寫上配置項(xiàng),根據(jù)自己的需求更改

option = {
    backgroundColor: '#0a1d53',
    grid: {
     left: '2%',
     top: '2%',
     right: '2%',
     bottom: '2%',
     containLabel: true
    },
    tooltip: {
     trigger: 'item',
     axisPointer: {
      // 坐標(biāo)軸指示器,坐標(biāo)軸觸發(fā)有效
      type: 'shadow' // 默認(rèn)為直線,可選為:'line' | 'shadow'
     }
    },
    textStyle: {
     color: '#fff'
    },
    xAxis: {
     show: false,
     type: 'value',
     // 設(shè)置x軸顯示幾段
     min: 0,
     max: 100,
     inverse: true,
     splitLine: {
      show: false
     },
     interval: 50
    },
    yAxis: {
     show: true,
     type: 'category',
     data: [
      '周一',
      '周二',
      '周三',
      '周五',
      '周五',
      '周六',
      '周日'
     ],
     axisTick: { show: false },
     axisLine: {
      show: false,
      lineStyle: {
       color: 'red'
      }
     },
     splitLine: {
      show: false
     },
     inside: true,
     textStyle: {
      color: '#000c45'
     }
    },
    series: [
     {
      type: 'bar',
      itemStyle: {
       normal: {
        color: '#000c45', // 定義柱形的背景色
        barBorderRadius: [5, 5, 5, 5] // 定義背景柱形的圓角
       }
      },
      barGap: '-100%', // 設(shè)置柱形重合的重要步驟
      data: [100, 100, 100, 100, 100, 100, 100],
      z: 0,
      silent: true,
      animation: false, // 關(guān)閉動畫效果
      barWidth: '10px' // 設(shè)置柱形寬度
     },
     {
      type: 'bar',
      data: [50, 50, 50, 50, 50,50, 50],
      barWidth: '10px',
      barGap: '-100%', // 設(shè)置柱形重合的重要步驟
      label: {
       normal: {
        show: true, //是否顯現(xiàn),不顯示的話設(shè)置成false
        position: "left", //顯示的位置
        distance: 10, //距離侄子的值 // label要顯示的值比如: 20%
        formatter: function(param) {
         return param.value;
        },
        textStyle: {
         //這個(gè)地方顏色是支持回調(diào)函數(shù)的這種的,如果是一種顏色則可以寫成: color :'#1089E7'
         color: function(params) {
          var num = myColor.length; //得到myColor顏色數(shù)組的長度
          return myColor[params.dataIndex % num]; //返回顏色數(shù)組中的一個(gè)對應(yīng)的顏色值
         },
         fontSize: "16"
        }
       }
      },
      itemStyle: {
       normal: {
        color: function (params) {
         var colorList = [
          '#bbb743',
          '#bbae43',
          '#bb9d43',
          '#bb8c43',
          '#bb7e43',
          '#bb5c43',
          '#bb4643'
         ]
         return colorList[params.dataIndex]
        },
        barBorderRadius: [5, 5, 5, 5] // 定義柱形的圓角
       }
      }
     }
    ]
   }

以上這篇解決echarts 一條柱狀圖顯示兩個(gè)值,類似進(jìn)度條的問題就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • vue3中如何使用iframe嵌入vue2頁面

    vue3中如何使用iframe嵌入vue2頁面

    這篇文章主要介紹了vue3中如何使用iframe嵌入vue2頁面問題,具有很好的參考價(jià)值,希望對大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-10-10
  • vue+webpack中配置ESLint

    vue+webpack中配置ESLint

    這篇文章主要介紹了vue+webpack中配置ESLint,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2018-11-11
  • Vue計(jì)算屬性的使用

    Vue計(jì)算屬性的使用

    本篇文章主要介紹了Vue計(jì)算屬性的使用,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-08-08
  • Vue3中引用本地圖片路徑的方法詳解

    Vue3中引用本地圖片路徑的方法詳解

    這篇文章主要為大家詳細(xì)介紹了Vue3中引用本地圖片路徑的常用方法,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下
    2024-03-03
  • vue使用自定義指令來控制頁面按鈕組的權(quán)限思想

    vue使用自定義指令來控制頁面按鈕組的權(quán)限思想

    這篇文章主要介紹了vue使用自定義指令來控制頁面按鈕組的權(quán)限思想,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-08-08
  • vue大屏展示適配的方法

    vue大屏展示適配的方法

    這篇文章主要為大家詳細(xì)介紹了vue大屏展示適配,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-10-10
  • vue項(xiàng)目打包后瀏覽器緩存問題及解決

    vue項(xiàng)目打包后瀏覽器緩存問題及解決

    這篇文章主要介紹了vue項(xiàng)目打包后瀏覽器緩存問題及解決方案,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-03-03
  • nuxt踩坑之Vuex狀態(tài)樹的模塊方式使用詳解

    nuxt踩坑之Vuex狀態(tài)樹的模塊方式使用詳解

    這篇文章主要介紹了nuxt踩坑之Vuex狀態(tài)樹的模塊方式使用詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-09-09
  • 詳解Vue計(jì)算屬性原理

    詳解Vue計(jì)算屬性原理

    計(jì)算屬性是Vue中比較好用的API,開發(fā)者可以利用計(jì)算屬將復(fù)雜的計(jì)算進(jìn)行緩存,同時(shí)基于它的響應(yīng)式特性,我們無需關(guān)注數(shù)據(jù)更新問題,但需要注意的是,計(jì)算屬性是惰性求值的,本文將詳細(xì)介紹計(jì)算屬性的實(shí)現(xiàn)原理,需要的朋友可以參考下
    2023-05-05
  • vue項(xiàng)目中自動導(dǎo)入svg并愉快的使用方式

    vue項(xiàng)目中自動導(dǎo)入svg并愉快的使用方式

    這篇文章主要介紹了vue項(xiàng)目中自動導(dǎo)入svg并愉快的使用方式,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-11-11

最新評論