Echarts可视化教程

  1. 网站首页
  2. 百度ECharts
  3. ECharts实例
  4. ECharts入门
  5. 地图大全
  6. ECharts官网

百度echarts横向柱状图(显示百分比)

var option = {
backgroundColor: '#0A1934',
  grid: {
    top: '10%',
    left: '10%',
    right: '12*%',
    bottom: '10%',
    containLabel: true
  },
  yAxis: [{
    type: 'category',
    data: ['月度目标', '季度目标', '年度目标'],
    inverse: true,
    axisTick: {
      show: false
    },
    axisLabel: {
      margin: 20,
      textStyle: {
        fontSize: 18,
        color: '#fff'
      }
    },
    axisLine: {
      show: false
    }
  }],
  xAxis: [{
    type: 'value',
    axisLabel: {
      show: false
    },
    axisLine: {
      show: false
    },
    splitLine: {
      show: false
    }
  }],
  series: [{
    type: 'bar',
    barWidth: 14,
    data: [30, 70, 120],
    label: {
      normal: {
        show: true,
        position: 'insideBottomRight',
        formatter: '{c}%',
        distance: 0,
        offset: [30, -20],
        color: '#fff',
        fontSize: 16,
        padding: [5, 15, 10, 15],
        backgroundColor: {
          image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIwAAAA+CAYAAAD5wvNAAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA0xpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDY3IDc5LjE1Nzc0NywgMjAxNS8wMy8zMC0yMzo0MDo0MiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZ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hHsElB5JtdAWh0JakBH9jGW4OJ9UN9GO3/wUYAAaXtVsjsG1HQAAAABJRU5ErkJggg=='
        }
      }
    },
    itemStyle: {
      normal: {
        color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
          offset: 0,
          color: '#57eabf' // 0% 处的颜色
        }, {
          offset: 1,
          color: '#2563f9' // 100% 处的颜色
        }], false),
        barBorderRadius: 14
      }
    }
  }, {
    type: "bar",
    barWidth: 14,
    xAxisIndex: 0,
    barGap: "-100%",
    data: [120, 120],
    itemStyle: {
      normal: {
        color: "#444a58",
        barBorderRadius: 14
      }
    },
    zlevel: -1
  }]
};
点击展开全文

相关文章

  1. 横向柱状图之预约情况
  2. 百度echarts多图表联合效果图(饼图/柱状图)
  3. 百度echarts之3d动态柱状图(实时变动)
  4. 百度echarts柱状图通过环比数据展示(↑↓)
  5. 百度echarts柱状图实现颜色渐变

热门workflows工作流